From 721aac1c3bb00cb516eceeba2076992547b2e469 Mon Sep 17 00:00:00 2001 From: Jacob Dahl Date: Tue, 10 Nov 2026 18:07:26 -0700 Subject: [PATCH] build(bitbang_uart): let esc_4way and serialpassthrough each select the pin UART The ESC pin UART was only built with SERIALPASSTHROUGH_BITBANG, so a board had to enable the MAVLink serial passthrough module to get esc_4way, which does not use it. The ARK STM32H7 boards enabled that module only for the backend and drop it. Assisted-by: Claude:claude-fable-5-2 --- boards/ark/fmu-v6s/default.px4board | 2 -- boards/ark/fmu-v6x/default.px4board | 2 -- boards/ark/fpv/default.px4board | 2 -- boards/ark/pi6x/default.px4board | 2 -- docs/en/peripherals/esc_configuration_4way.md | 4 +--- platforms/nuttx/Kconfig | 15 +++++++++++++++ platforms/nuttx/src/px4/nxp/imx95/CMakeLists.txt | 2 +- platforms/nuttx/src/px4/nxp/rt106x/CMakeLists.txt | 2 +- platforms/nuttx/src/px4/nxp/rt117x/CMakeLists.txt | 2 +- .../nuttx/src/px4/stm/stm32f7/CMakeLists.txt | 2 +- .../nuttx/src/px4/stm/stm32h7/CMakeLists.txt | 2 +- src/drivers/esc_4way/Kconfig | 3 ++- src/drivers/serialpassthrough/Kconfig | 13 +------------ 13 files changed, 24 insertions(+), 29 deletions(-) diff --git a/boards/ark/fmu-v6s/default.px4board b/boards/ark/fmu-v6s/default.px4board index 439515f682a..0e33ec05a1e 100644 --- a/boards/ark/fmu-v6s/default.px4board +++ b/boards/ark/fmu-v6s/default.px4board @@ -41,8 +41,6 @@ CONFIG_DRIVERS_PWM_OUT=y CONFIG_DRIVERS_PX4IO=y CONFIG_COMMON_RC=y CONFIG_DRIVERS_SAFETY_BUTTON=y -CONFIG_DRIVERS_SERIALPASSTHROUGH=y -CONFIG_SERIALPASSTHROUGH_BITBANG=y CONFIG_DRIVERS_ESC_4WAY=y CONFIG_DRIVERS_TONE_ALARM=y CONFIG_DRIVERS_UAVCAN=y diff --git a/boards/ark/fmu-v6x/default.px4board b/boards/ark/fmu-v6x/default.px4board index 459c4a0cfcc..ff18f3cbb62 100644 --- a/boards/ark/fmu-v6x/default.px4board +++ b/boards/ark/fmu-v6x/default.px4board @@ -41,8 +41,6 @@ CONFIG_DRIVERS_PWM_OUT=y CONFIG_DRIVERS_PX4IO=y CONFIG_COMMON_RC=y CONFIG_DRIVERS_SAFETY_BUTTON=y -CONFIG_DRIVERS_SERIALPASSTHROUGH=y -CONFIG_SERIALPASSTHROUGH_BITBANG=y CONFIG_DRIVERS_ESC_4WAY=y CONFIG_DRIVERS_TONE_ALARM=y CONFIG_DRIVERS_UAVCAN=y diff --git a/boards/ark/fpv/default.px4board b/boards/ark/fpv/default.px4board index ef1d200d6cc..04c8c59e7d6 100644 --- a/boards/ark/fpv/default.px4board +++ b/boards/ark/fpv/default.px4board @@ -32,8 +32,6 @@ CONFIG_DRIVERS_OSD_MSP_OSD=y CONFIG_DRIVERS_PCA9685_PWM_OUT=y CONFIG_DRIVERS_PWM_OUT=y CONFIG_COMMON_RC=y -CONFIG_DRIVERS_SERIALPASSTHROUGH=y -CONFIG_SERIALPASSTHROUGH_BITBANG=y CONFIG_DRIVERS_ESC_4WAY=y CONFIG_DRIVERS_UAVCAN=y CONFIG_MODULES_BATTERY_STATUS=y diff --git a/boards/ark/pi6x/default.px4board b/boards/ark/pi6x/default.px4board index 031ec7c5755..bfe4e2c5690 100644 --- a/boards/ark/pi6x/default.px4board +++ b/boards/ark/pi6x/default.px4board @@ -24,8 +24,6 @@ CONFIG_DRIVERS_PCA9685_PWM_OUT=y CONFIG_DRIVERS_POWER_MONITOR_INA226=y CONFIG_DRIVERS_PWM_OUT=y CONFIG_COMMON_RC=y -CONFIG_DRIVERS_SERIALPASSTHROUGH=y -CONFIG_SERIALPASSTHROUGH_BITBANG=y CONFIG_DRIVERS_ESC_4WAY=y CONFIG_DRIVERS_TONE_ALARM=y CONFIG_DRIVERS_UAVCAN=y diff --git a/docs/en/peripherals/esc_configuration_4way.md b/docs/en/peripherals/esc_configuration_4way.md index e795cfb66d5..0fc8621727e 100644 --- a/docs/en/peripherals/esc_configuration_4way.md +++ b/docs/en/peripherals/esc_configuration_4way.md @@ -95,11 +95,9 @@ esc-configurator.com has an override for this and shows the port regardless of i The ESC configuration server drives the ESC signal pins as a half-duplex UART. That backend exists for STM32F7/H7 boards and for the NXP i.MX RT1064/RT1176 and i.MX95 boards. -To enable the server, add these keys to the board's `default.px4board`: +To enable the server, add this key to the board's `default.px4board`: ```text -CONFIG_DRIVERS_SERIALPASSTHROUGH=y -CONFIG_SERIALPASSTHROUGH_BITBANG=y CONFIG_DRIVERS_ESC_4WAY=y ``` diff --git a/platforms/nuttx/Kconfig b/platforms/nuttx/Kconfig index 95cf6ea4f8a..9dd2718ec8b 100644 --- a/platforms/nuttx/Kconfig +++ b/platforms/nuttx/Kconfig @@ -24,3 +24,18 @@ config BOARD_PWM_FREQ default 1000000 if !ARCH_CHIP_S32K3XX ---help--- Board default PWM frequency + +config UART_BITBANG + bool + ---help--- + Half-duplex UART on the ESC signal pins (drv_bitbang_uart.h). + Selected by the drivers that use it. + +config UART_BITBANG_TIMER + int "Timer instance for bit-bang UART" + depends on UART_BITBANG + default 13 + range 1 17 + ---help--- + Timer instance to use for bit-bang UART timing mode. + Default TIM13. diff --git a/platforms/nuttx/src/px4/nxp/imx95/CMakeLists.txt b/platforms/nuttx/src/px4/nxp/imx95/CMakeLists.txt index ea8651c843a..f06ab2bd9a9 100644 --- a/platforms/nuttx/src/px4/nxp/imx95/CMakeLists.txt +++ b/platforms/nuttx/src/px4/nxp/imx95/CMakeLists.txt @@ -42,6 +42,6 @@ add_subdirectory(../imx9/spi spi) add_subdirectory(../imx9/tone_alarm tone_alarm) add_subdirectory(../nxp_common/dshot dshot) -if(CONFIG_SERIALPASSTHROUGH_BITBANG) +if(CONFIG_UART_BITBANG) add_subdirectory(../nxp_common/flexio_uart flexio_uart) endif() diff --git a/platforms/nuttx/src/px4/nxp/rt106x/CMakeLists.txt b/platforms/nuttx/src/px4/nxp/rt106x/CMakeLists.txt index 02b5b9191ec..7f50a3eb4fb 100644 --- a/platforms/nuttx/src/px4/nxp/rt106x/CMakeLists.txt +++ b/platforms/nuttx/src/px4/nxp/rt106x/CMakeLists.txt @@ -39,7 +39,7 @@ add_subdirectory(../imxrt/board_reset board_reset) add_subdirectory(../imxrt/romapi romapi) add_subdirectory(../nxp_common/dshot dshot) -if(CONFIG_SERIALPASSTHROUGH_BITBANG) +if(CONFIG_UART_BITBANG) add_subdirectory(../nxp_common/flexio_uart flexio_uart) endif() diff --git a/platforms/nuttx/src/px4/nxp/rt117x/CMakeLists.txt b/platforms/nuttx/src/px4/nxp/rt117x/CMakeLists.txt index c62467faf6c..06f7257df08 100644 --- a/platforms/nuttx/src/px4/nxp/rt117x/CMakeLists.txt +++ b/platforms/nuttx/src/px4/nxp/rt117x/CMakeLists.txt @@ -45,7 +45,7 @@ add_subdirectory(../imxrt/version version) add_subdirectory(../imxrt/spi spi) add_subdirectory(../nxp_common/dshot dshot) -if(CONFIG_SERIALPASSTHROUGH_BITBANG) +if(CONFIG_UART_BITBANG) add_subdirectory(../nxp_common/flexio_uart flexio_uart) endif() diff --git a/platforms/nuttx/src/px4/stm/stm32f7/CMakeLists.txt b/platforms/nuttx/src/px4/stm/stm32f7/CMakeLists.txt index c9d5bff8db7..34cc4716af9 100644 --- a/platforms/nuttx/src/px4/stm/stm32f7/CMakeLists.txt +++ b/platforms/nuttx/src/px4/stm/stm32f7/CMakeLists.txt @@ -44,7 +44,7 @@ add_subdirectory(../stm32_common/spi spi) add_subdirectory(../stm32_common/tone_alarm tone_alarm) add_subdirectory(../stm32_common/version version) -if(CONFIG_SERIALPASSTHROUGH_BITBANG) +if(CONFIG_UART_BITBANG) add_subdirectory(../stm32_common/bitbang_uart bitbang_uart) endif() diff --git a/platforms/nuttx/src/px4/stm/stm32h7/CMakeLists.txt b/platforms/nuttx/src/px4/stm/stm32h7/CMakeLists.txt index 36faef08771..aba1046203f 100644 --- a/platforms/nuttx/src/px4/stm/stm32h7/CMakeLists.txt +++ b/platforms/nuttx/src/px4/stm/stm32h7/CMakeLists.txt @@ -45,7 +45,7 @@ add_subdirectory(../stm32_common/spi spi) add_subdirectory(../stm32_common/tone_alarm tone_alarm) add_subdirectory(../stm32_common/version version) -if(CONFIG_SERIALPASSTHROUGH_BITBANG) +if(CONFIG_UART_BITBANG) add_subdirectory(../stm32_common/bitbang_uart bitbang_uart) endif() diff --git a/src/drivers/esc_4way/Kconfig b/src/drivers/esc_4way/Kconfig index de0e0508297..596fc68002b 100644 --- a/src/drivers/esc_4way/Kconfig +++ b/src/drivers/esc_4way/Kconfig @@ -1,7 +1,8 @@ menuconfig DRIVERS_ESC_4WAY bool "esc_4way (MSP and 4way ESC configuration server over USB or a serial port)" default n - depends on SERIALPASSTHROUGH_BITBANG + depends on PLATFORM_NUTTX + select UART_BITBANG ---help--- Serves the BLHeli/AM32 4way interface protocol to ESC configurators (am32.ca, esc-configurator.com) through the flight controller: MSP on diff --git a/src/drivers/serialpassthrough/Kconfig b/src/drivers/serialpassthrough/Kconfig index 9b0f99e8e32..d4cc081965f 100644 --- a/src/drivers/serialpassthrough/Kconfig +++ b/src/drivers/serialpassthrough/Kconfig @@ -12,19 +12,8 @@ config SERIALPASSTHROUGH_BITBANG bool "Enable bit-bang UART support (ESC channel mode)" default n depends on PLATFORM_NUTTX + select UART_BITBANG ---help--- Enable bit-bang UART. -if SERIALPASSTHROUGH_BITBANG - -config UART_BITBANG_TIMER - int "Timer instance for bit-bang UART" - default 13 - range 1 17 - ---help--- - Timer instance to use for bit-bang UART timing mode. - Default TIM13. - -endif # SERIALPASSTHROUGH_BITBANG - endif # DRIVERS_SERIALPASSTHROUGH