Commit Graph
6 Commits
Author SHA1 Message Date
Benjamin CabéandFarhang ddc9474819 fix(boards/3dr/ctrl-n1): drive the PD10 LED push-pull, active high (#29372)
* fix(boards/3dr/ctrl-n1): drive the PD10 LED push-pull, active high

The LED on PD10 lights when the pin drives high, and the board has no
pull-up on that line. Configured as an open-drain output driven low to
switch it on, it never lit, in the application nor in the bootloader.
Drive it push-pull, initially low, and high to switch it on.

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Assisted-by: Claude:opus-5.5

---------

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Co-authored-by: Farhang <46557204+farhangnaderi@users.noreply.github.com>
2026-10-21 15:16:35 -04:00
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
Jacob Dahl d983b6424f refactor(boards): remove dead defines from board_config.h (#28168)
* refactor(boards): remove unused INPUT_CAP* board defines

INPUT_CAP*_TIMER, INPUT_CAP*_CHANNEL and GPIO_INPUT_CAP* have never had a
consumer. They are present as far back as v1.8.0 (then in
src/drivers/boards/px4fmu-v5/board_config.h) and no code outside a
board_config.h has ever read them.

Input capture is configured in the board timer_config.cpp via
initIOTimerChannelCapture() and driven by
platforms/nuttx/.../io_pins/input_capture.c. On ten of these boards the
removed defines restate, in a second notation, exactly the channel
timer_config.cpp already declares -- fmu-v5x described T5C4 on PI0 and
declares initIOTimerChannelCapture({Timer5, Channel4}, {PortI, Pin0}).

Being unread, the duplicates drifted:

  - cuav/7-nano INPUT_CAP4 named GPIO_TIM4_CH1IN_2 on PD12 while its own
    INPUT_CAP4_TIMER said 15; the configured channel is T15C2 on PE6.
  - modalai/fc-v2 and sky-drones/smartap-airlink declare input capture
    pins while configuring no capture channel at all.

New boards kept inheriting the block by copying an existing
board_config.h.

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

* refactor(boards): remove leftover BOARD_HAS_PWM defines

a8e75d174c ("boards: remove BOARD_HAS_PWM and use
DIRECT_PWM_OUTPUT_CHANNELS") dropped the last consumer in 2021, but the
board_config.h side of that cleanup was never finished and boards added
since have kept copying it in. Every remaining definition is a bare alias
of DIRECT_PWM_OUTPUT_CHANNELS, which is the macro actually read.

mamba-f405-mk2 defined it twice in the same header.

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

* refactor(boards): remove leftover DIRECT_INPUT_TIMER_CHANNELS defines

c5c80e31b6 ("boards: remove DIRECT_INPUT_TIMER_CHANNELS from
board_config.h") removed the last consumer in 2021. These ten boards
either predate the sweep or were added afterwards by copying a
board_config.h that still carried it.

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

* refactor(boards): remove unused BOARD_NUMBER_I2C_BUSES defines

Nothing reads BOARD_NUMBER_I2C_BUSES. The bus count actually in use is
PX4_NUMBER_I2C_BUSES, which each architecture sets in its micro_hal.h
(STM32_NI2C, KINETIS_NI2C, or a literal) and a board cannot influence.

The near-miss name is worse than a plain unused define: it reads like the
board is declaring its bus count when the value is inert.

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

* refactor(boards): remove unused BOARD_DMA_NUM_DSHOT_CHANNELS defines

Nothing reads it. The dshot driver sizes its DMA buffers from
MAX_IO_TIMERS and MAX_NUM_CHANNELS_PER_TIMER, so the accompanying comment
describes a budget the board cannot actually declare.

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

* refactor(boards/ark): remove dead board_config defines

cannode: the eight GPIO_TIM*_RESET pin configs were never added to
PX4_GPIO_INIT_LIST, unlike the GPIO_I2C1_{SCL,SDA}_RESET pair written
beside them, so nothing ever applied them.

fmu-v6s: ARKV6S_0 is a leftover from copying the fmu-v6x config. fmu-v6x
keys its SPI buses on the FMUM ID via initSPIFmumID(ARKV6X_0, ...), but
fmu-v6s has a single hardware version and uses the plain initSPIBus form,
so the ID is never referenced.

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

---------

Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
2026-08-05 22:26:22 -06:00
Alexis Guijarro 0542e1f157 feat(boards/3dr/ctrl-n1): configure barometer as DPS368 (#27854) 2026-07-15 21:39:15 -04:00
Alexis Guijarro 25724b5244 fix(boards/3dr/ctrl-n1): board port fixes and driver corrections (#27405)
* fix(drivers/ak09940a): fix probe retry, devtype collision, and register naming

* fix(drivers/neopixel): check init return value and fix module name typo

* fix(boards/3dr/ctrl-n1): correct magnetometer i2c bus, LED indexing, chip variant for bootloader, and TIM3 conflict with srgbled_dma

* fix(boards/3dr/ctrl-n1): update bootloader for STM32H743VI
2026-05-20 11:04:29 -06:00
Alexis Guijarro c59f208cc7 feat(boards): add support for 3DR Control N1 flight controller (#27395)
* fix(srgbled_dma): stm32_dmasetup now works with H7 boards

* feat(drivers/ak09940a): add AKM AK09940A magnetometer driver

* feat(boards/3dr/ctrl-n1)!: add 3DR Control-N1 flight controller

* fix(boards/3dr/ctrl-n1): macro replacement list is now enclosed in parentheses

* fix(boards/3dr/ctrl-n1): applying copyright changes

* fix(boards/3dr/ctrl-n1): removing serial console
2026-05-19 13:13:54 -05:00