From b26b3ac29d5cc3610c3bf48ac3cb2c84cc194436 Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Tue, 27 Jan 2026 13:38:03 +1300 Subject: [PATCH] boards: fixup timers and DMA for KakuteH7-Wing --- .../nuttx-config/include/board_dma_map.h | 12 +++++++----- boards/holybro/kakuteh7-wing/src/timer_config.cpp | 10 ++++++---- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/boards/holybro/kakuteh7-wing/nuttx-config/include/board_dma_map.h b/boards/holybro/kakuteh7-wing/nuttx-config/include/board_dma_map.h index 3bf265085c..0c54385483 100644 --- a/boards/holybro/kakuteh7-wing/nuttx-config/include/board_dma_map.h +++ b/boards/holybro/kakuteh7-wing/nuttx-config/include/board_dma_map.h @@ -58,11 +58,13 @@ //#define DMAMAP_USART6_RX DMAMAP_DMA12_USART6RX_0 /* 5 DMA1:71 PX4IO */ //#define DMAMAP_USART6_TX DMAMAP_DMA12_USART6TX_0 /* 6 DMA1:72 PX4IO */ -// Assigned in timer_config.cpp - -// TODO -// Timer 4 /* 7 DMA1:32 TIM4UP */ -// Timer 5 /* 8 DMA1:50 TIM5UP */ +// Dynamically assigned in timer_config.cpp for DShot (allocated/freed per cycle): +// Timer 1 TIM1UP (burst) + TIM1CH1-4 (capture) +// Timer 2 TIM2UP (burst) + TIM2CH1-4 (capture) +// Timer 3 TIM3UP (burst) + TIM3CH1-4 (capture) +// Timer 4 TIM4UP (burst) + TIM4CH1-3 (capture, CH4 has no DMA) +// Timer 5 TIM5UP (burst) + TIM5CH1-4 (capture) +// Timer 15 - no TIM15UP DMA, cannot do DShot // DMAMUX2 Using at most 8 Channels on DMA2 -------- Assigned // V diff --git a/boards/holybro/kakuteh7-wing/src/timer_config.cpp b/boards/holybro/kakuteh7-wing/src/timer_config.cpp index eaa8d887e3..29286bf91c 100644 --- a/boards/holybro/kakuteh7-wing/src/timer_config.cpp +++ b/boards/holybro/kakuteh7-wing/src/timer_config.cpp @@ -38,18 +38,20 @@ constexpr io_timers_t io_timers[MAX_IO_TIMERS] = { initIOTimer(Timer::Timer1, DMA{DMA::Index1}), initIOTimer(Timer::Timer4, DMA{DMA::Index1}), initIOTimer(Timer::Timer5, DMA{DMA::Index1}), - initIOTimer(Timer::Timer15), - initIOTimer(Timer::Timer3), - initIOTimer(Timer::Timer2), + initIOTimer(Timer::Timer15), // Note: Timer15 has no TIM_UP DMA on STM32H7, cannot do DShot + initIOTimer(Timer::Timer3, DMA{DMA::Index1}), + initIOTimer(Timer::Timer2, DMA{DMA::Index1}), }; +// Note: Timer4 Channel4 has no DMAMUX mapping on STM32H7, so BDShot telemetry capture +// is not available on that channel. DShot output still works (uses TIM_UP DMA for burst). constexpr timer_io_channels_t timer_io_channels[MAX_TIMER_IO_CHANNELS] = { initIOTimerChannel(io_timers, {Timer::Timer1, Timer::Channel1}, {GPIO::PortA, GPIO::Pin8}), initIOTimerChannel(io_timers, {Timer::Timer1, Timer::Channel2}, {GPIO::PortE, GPIO::Pin11}), initIOTimerChannel(io_timers, {Timer::Timer1, Timer::Channel3}, {GPIO::PortE, GPIO::Pin13}), initIOTimerChannel(io_timers, {Timer::Timer1, Timer::Channel4}, {GPIO::PortE, GPIO::Pin14}), initIOTimerChannel(io_timers, {Timer::Timer4, Timer::Channel3}, {GPIO::PortD, GPIO::Pin14}), - initIOTimerChannel(io_timers, {Timer::Timer4, Timer::Channel4}, {GPIO::PortD, GPIO::Pin15}), + initIOTimerChannel(io_timers, {Timer::Timer4, Timer::Channel4}, {GPIO::PortD, GPIO::Pin15}), // no BDShot capture initIOTimerChannel(io_timers, {Timer::Timer5, Timer::Channel1}, {GPIO::PortA, GPIO::Pin0}), initIOTimerChannel(io_timers, {Timer::Timer5, Timer::Channel2}, {GPIO::PortA, GPIO::Pin1}), initIOTimerChannel(io_timers, {Timer::Timer15, Timer::Channel1}, {GPIO::PortE, GPIO::Pin5}),