Files
PX4-Autopilot/boards/matek
Jacob Dahl 633af12ea4 fix(boards): drive PWM outputs low at reset instead of input pull-up (#28746)
* fix(boards): drive PWM outputs low at reset instead of input pull-up

board_on_reset() was written in 2017 to put the FMU timer pins into a
driven low state so ESCs see a defined level from reset until the
output driver claims them. The fmu-v5 refactor in 54bd0a9f2a switched
the pin list to GPIO_INPUT|GPIO_PULLUP without comment, and the 2020
timer-config refactor propagated that as PX4_MAKE_GPIO_INPUT() to every
board derived from fmu-v5. The px4/fmu-v2..v4 lineage and later
px4/fmu-v6x (#19535) kept the driven low output.

A weak pull-up on the motor line is the state the AM32 bootloader
treats as "stay in the bootloader": it tests the pin against its own
pull-down and only jumps to the application on a clean low
(am32-firmware/AM32-bootloader#24). On boards where the MCU pin goes
straight to the ESC pad, a battery-only boot therefore leaves the ESCs
uninitialised (#27696, #28731). A weak pull in either direction also
leaves unassigned channels high impedance, so edges on a neighbouring
DShot line couple in and can spin a motor with no output assigned
(#26525). The 2021 attempt at pull-downs (#17686) hit the same problem
from the other side.

Switch the remaining STM32, kinetis and rt106x boards to
io_timer_channel_get_gpio_output(), matching the boards that already
drive low. The rt117x boards are unchanged because their input macro
has no pull.

The ARK boards additionally overrode the reset state with a pull-down
via PX4_GPIO_INIT_LIST; those entries are removed so the driven low
from board_on_reset() stands.

Assisted-by: Claude:claude-fable-5-1
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>

* fix(boards): keep capture channels as inputs and cover the missed boards

Driving every timer pin low at reset also drove the capture channels on
fmu-v5, fmu-v5x, fmu-v6u, durandal-v1, pix32v5 and corvon/v5, where a GPS
PPS or camera output may be wired. Until pps_capture or camera_capture
claims the pin, that output would fight a push-pull low, so those
channels keep their previous input state.

The three fmu-v6xrt boards float their PWM pins through a different
input macro and zenfc/h743 landed after this branch was cut; all four now
drive low as well.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>

---------

Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
2026-10-13 15:10:19 -06:00
..