bitdump / BLHeli

BLHeli for brushless ESC firmware
GNU General Public License v3.0
1.97k stars 1.09k forks source link

Dshot specifications and DIGITAL_CMD_BEEP1 #561

Closed theely closed 3 years ago

theely commented 3 years ago

Hi, I am working on a Dshot ATMega4809 microcontroller implementation to drive BLHeli 32 and BLHeli_S ESCs. So far I managed to successfully set throttle values for BLHeli 32 ESCs at 150, 300 and 600 Kbps. Next I would like to control motor buzzing using the DIGITAL_CMD_BEEP1 command but I had no luck.

Where can I find specifications on how to use the DIGITAL_CMD_BEEP1 command?

What I have found so far is: -motors should be idle, I suppose this means throttle value 48 should be sent before issuing the DIGITAL_CMD_BEEP1 command. -After issuing command DIGITAL_CMD_BEEP1 ensure a minimum daly of 260us before sending any new command.

Is that all? Something else I could try?

mathiasvr commented 3 years ago

Yes motors need to be completely stopped before sending commands, you can also send a value of 0 for this.

theely commented 3 years ago

Thanks. I made sure the motors were completely stopped and used value 0 but I am still not able to trigger the beep. If I connect the ESC to a BF flight controller it works, so that excludes any issue with the ESC.

Do you know if the DIGITAL_CMD_BEEP1 needs to be sent multiple times before adding the delay. Or it should be sufficient to send it once? What I am currently trying is to continuously send DIGITAL_CMD_BEEP1 with an interval of 260us between the commands.

theely commented 3 years ago

Selved! For the DIGITAL_CMD_BEEP1 command to work:

  1. Telemetry bit needs to be set to 1.
  2. Delay the following command by at least 260ms.

p.s. consider documenting this requirements.

mathiasvr commented 3 years ago

Ah that's right, I wonder what is the reason that the telemetry bit must be set for commands to work?

sskaug commented 3 years ago

This, I believe, is just the way Felix designed it for KISS.

theely commented 3 years ago

Something else that is unexpected is how the beeps are behaving across BLHeli versions. On BLHeli_32 BEEP1 to BEEP4 are changing in tonality, BEEP5 however is also longer. On BLHeli_S BEEP5 is the same length as the others.

The fact that BEEP5 is longer is quite cool as it enables more use-cases.

Would it be possible to align BLHeli_S to BLHeli_32?

sskaug commented 3 years ago

Sorry, but no more development is done on BLHeli_S by us. But being open source you are free to modify as you wish.

theely commented 3 years ago

Alright, seems like BEEP4 is identical to BEEP5: https://github.com/bitdump/BLHeli/blob/467834db443a887534c1f2c9fb0ff61fd6b40e3e/BLHeli_S%20SiLabs/BLHeli_S.asm#L4016

And beep_f5 should be added here: https://github.com/bitdump/BLHeli/blob/467834db443a887534c1f2c9fb0ff61fd6b40e3e/BLHeli_S%20SiLabs/BLHeli_S.asm#L2910

Unfortunately however there is no easy way to set the beep length, looks hardcoded and I have no idea how I could parametrise it :-(

mathiasvr commented 3 years ago

@theely you increase temp4 for beep length and temp3 for pitch.