Bidirectional DShot Bitbang vs Timer implementation #11425
-
Which is a better implementation of Bidirectional DShot: Setting up a HACKRCF405 FC on 4.3 and want to take advantage of the DMA Channels to read the Gyro data, since it has a MPU6000 on it. However can't use the Bitbang Implementation of Bidirectional DShot because it uses up one the DMA Channels needed by the Gyro. Funny thing is, Bitbang uses 3 DMA Channels, but I only need two. Reason it uses 3 is because the FC has 6 motor outputs, but only have 4 motors connected. I tried to free up the unused motor outputs from resources and timers, but bitbang still wants to use three DMA Channels. Does Bitbang not use the motor mixer settings to determine how many motors are needed? Seems like it uses the hard-coded motor output number from the board itself. Had to disable Bitbang and set up each of the four motors on its own timer and DMA Channel. Doing so let me use the DMA Channels for the Gyro reads, even thou I used more DMA Channels to sett it up this way. Guess the ability to reassign the DMA Channels for the motors help to free up the proper DMA Channels for the Gyro to use. Since of can choose which DMA Channels the Gyro or Bitbang want to use. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
@Warl0rd0ne Both implementations are functional, although on a couple of occasions I've seen lower error counts with bit banged where I've see a small number of errors with timer based. Looking at the config for this FC, unfortunately motors 1, 2 and 3 are all on different ports. If you're able to avoid use of one of these, for example, by not using
The current resource allocation with
You can see the resources for Note the fact that on an F4 if you use bit-banged DSHOT you can't use DMA on SPI using DMA2, which is SPI1, most commonly used for the gyro. Ideally, therefore, if you can set If we set the following
We get
Note that
The config for this board contains the following which is causing this issue
Entering the following will allow the use of DMA2 Stream 1 which we can see is currently free.
And that gives us the following where DMA can be used on all three SPI busses using timer based DSHOT and the ADC also allocated a stream.
@loopur As the registered owner of the config for this board I suggest you raise a PR to change https://github.com/betaflight/unified-targets/blob/master/configs/default/HARC-HAKRCF405.config as per the following. This will give a good out of the box experience for users of 4.3.
|
Beta Was this translation helpful? Give feedback.
@Warl0rd0ne Both implementations are functional, although on a couple of occasions I've seen lower error counts with bit banged where I've see a small number of errors with timer based.
Looking at the config for this FC, unfortunately motors 1, 2 and 3 are all on different ports. If you're able to avoid use of one of these, for example, by not using
B00
then you'll be able to reduce the number of DMA streams from three to two.The current resource allocation with
dshot_bitbang=ON
is