inav
inav copied to clipboard
Fix motor output glitch by initializing IO after timer
We have reports of some ESC's not arming when DSHOT is selected. When connecting to the ESC, it would show that the ESC detected multishot instead of DSHOT. This problem seems to happen only with ESC's that use AT32 microcontrollers. E.g., it happens with the Hobbywing XRotor G2 65A 4-in-1, but not with the Hobbywing 60 A 4-in-1. The former uses an AT32, the latter an STM32.
I inspected the motor signals with a logic analyzer during boot and there were short glitches where the output goes high for about 1.2 to 2.4 us during the timer configuration. When moving the IO configuration after the timer configuration, the glitches don't happen and the ESC's arm as expected.