From a3bb0d5b0a6efcbe24c21b9ac4c12cb2b3be44cb Mon Sep 17 00:00:00 2001 From: Jacob Dahl Date: Tue, 10 Feb 2026 19:29:00 -0900 Subject: [PATCH] fix kconfig, add _REG32 --- boards/ark/fpv/default.px4board | 2 +- .../nuttx/src/px4/stm/stm32_common/dshot/CMakeLists.txt | 2 +- .../nuttx/src/px4/stm/stm32_common/dshot/dshot_bitbang.c | 3 +-- src/drivers/dshot/Kconfig | 7 +++++++ 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/boards/ark/fpv/default.px4board b/boards/ark/fpv/default.px4board index c98dc784ac..cfda76a8af 100644 --- a/boards/ark/fpv/default.px4board +++ b/boards/ark/fpv/default.px4board @@ -14,7 +14,7 @@ CONFIG_DRIVERS_CDCACM_AUTOSTART=y CONFIG_COMMON_DIFFERENTIAL_PRESSURE=y CONFIG_COMMON_DISTANCE_SENSOR=y CONFIG_DRIVERS_DSHOT=y -CONFIG_DRIVERS_DSHOT_BITBANG=y +CONFIG_DSHOT_BITBANG=y CONFIG_DRIVERS_GPS=y CONFIG_DRIVERS_HEATER=y CONFIG_DRIVERS_IMU_INVENSENSE_IIM42653=y diff --git a/platforms/nuttx/src/px4/stm/stm32_common/dshot/CMakeLists.txt b/platforms/nuttx/src/px4/stm/stm32_common/dshot/CMakeLists.txt index 9574923f65..4c09d219e4 100644 --- a/platforms/nuttx/src/px4/stm/stm32_common/dshot/CMakeLists.txt +++ b/platforms/nuttx/src/px4/stm/stm32_common/dshot/CMakeLists.txt @@ -31,7 +31,7 @@ # ############################################################################ -if(CONFIG_DRIVERS_DSHOT_BITBANG) +if(CONFIG_DSHOT_BITBANG) set(DSHOT_SRC dshot_bitbang.c) else() set(DSHOT_SRC dshot.c) diff --git a/platforms/nuttx/src/px4/stm/stm32_common/dshot/dshot_bitbang.c b/platforms/nuttx/src/px4/stm/stm32_common/dshot/dshot_bitbang.c index 19bcce5270..3889d91a21 100644 --- a/platforms/nuttx/src/px4/stm/stm32_common/dshot/dshot_bitbang.c +++ b/platforms/nuttx/src/px4/stm/stm32_common/dshot/dshot_bitbang.c @@ -87,6 +87,7 @@ #endif // Timer register macros (from io_timer.c, local to this file) +#define _REG32(_base, _reg) (*(volatile uint32_t *)(_base + _reg)) #define REG(_tmr, _reg) _REG32(io_timers[_tmr].base, _reg) #define rCR1(_tmr) REG(_tmr, STM32_GTIM_CR1_OFFSET) #define rCR2(_tmr) REG(_tmr, STM32_GTIM_CR2_OFFSET) @@ -232,8 +233,6 @@ static void timer_configure_pacer(uint8_t timer_index) // Auto-reload: one DMA transfer per timer update rARR(timer_index) = SUBPERIODS_PER_BIT - 1; - test - // Generate update event to load prescaler rEGR(timer_index) = GTIM_EGR_UG; diff --git a/src/drivers/dshot/Kconfig b/src/drivers/dshot/Kconfig index a37510aa0a..4090b23b31 100644 --- a/src/drivers/dshot/Kconfig +++ b/src/drivers/dshot/Kconfig @@ -3,3 +3,10 @@ menuconfig DRIVERS_DSHOT default n ---help--- Enable support for dshot + +config DSHOT_BITBANG + bool "Use bitbang DShot" + default n + depends on DRIVERS_DSHOT + ---help--- + Use bitbang GPIO DShot instead of DMA burst to timer registers