am32-firmware / AM32

GNU General Public License v3.0
312 stars 111 forks source link

Sending Dshot value 48 results in motor spinning, expected motor to stop #125

Closed frank26080115 closed 4 days ago

frank26080115 commented 5 days ago

using released build v2.16 from am32.ca on a DYS GSPACE_F051

configuration is single directional rotation mode, using Dshot300, sent 100 packets of 0 to arm the ESC and then sending 48 continuously

expected motor to not spin

actual result: motor spins very slowly

code in dshot.c starting at line https://github.com/am32-firmware/AM32/blob/d621bf2a2be1ed4b4ac9597df089f0727edbc67c/Src/dshot.c#L81 clearly indicates that values 47 or lower are regarded as commands and not throttle values

code from ExpressLRS https://github.com/ExpressLRS/ExpressLRS/blob/7ac5f4d21cb18fb77cf2f5a60bf71716e861e533/src/lib/ServoOutput/DShotRMT.h#L20 constexpr auto DSHOT_THROTTLE_MIN = 48; and https://github.com/ExpressLRS/ExpressLRS/blob/7ac5f4d21cb18fb77cf2f5a60bf71716e861e533/src/lib/ServoOutput/DShotRMT.cpp#L106

if (throttle_value < DSHOT_THROTTLE_MIN) {
    throttle_value = DSHOT_THROTTLE_MIN;
}

enforces this

this means Dshot value 48 should be regarded as 0 throttle and the motor should not spin

logic analyzer on the signal confirms the data being sent is 48

image

NOTE: BLHeli_32 does not behave this way, 48 makes it stop

NOTE: following lines of code also indicates that 47 is full stop: https://github.com/am32-firmware/AM32/blob/d621bf2a2be1ed4b4ac9597df089f0727edbc67c/Src/main.c#L1191 https://github.com/am32-firmware/AM32/blob/d621bf2a2be1ed4b4ac9597df089f0727edbc67c/Src/main.c#L1238 , but values 47 and under are basically impossible to be input due to the conditions I mentioned previously

frank26080115 commented 4 days ago

although I would still like 48 to represent stop (because that's how BLHeli32 works), I implemented a way to send zeros from the data source