From 74ea2ed0176039dafbe446ba8d3612f965e85988 Mon Sep 17 00:00:00 2001 From: functionpointer Date: Sun, 23 Nov 2025 16:45:23 +0100 Subject: [PATCH] NEXUSX: USE_DSHOT_DMAR, use TIM2 instead of TIM5 Apparently DSHOT_DMAR can only work with max 4 timers. With the previous timer setup this caused a limit of 7 motors. The new setup increases it 9. However, it costs some flexibility. The new default config sets up TIM1 as MOTOR by default, creating sane defaults for platforms with 1 or 4 motors. --- src/main/target/NEXUSX/config.c | 3 +++ src/main/target/NEXUSX/target.c | 4 ++-- src/main/target/NEXUSX/target.h | 2 ++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/target/NEXUSX/config.c b/src/main/target/NEXUSX/config.c index 09970cef5c1..0d5b4a88276 100644 --- a/src/main/target/NEXUSX/config.c +++ b/src/main/target/NEXUSX/config.c @@ -36,4 +36,7 @@ void targetConfiguration(void) { pinioBoxConfigMutable()->permanentId[0] = BOX_PERMANENT_ID_USER1; + + // default "ESC" pin to be a motor + timerOverridesMutable(timer2id(TIM1))->outputMode = OUTPUT_MODE_MOTORS; } diff --git a/src/main/target/NEXUSX/target.c b/src/main/target/NEXUSX/target.c index 3589a56c224..799dc762322 100644 --- a/src/main/target/NEXUSX/target.c +++ b/src/main/target/NEXUSX/target.c @@ -33,8 +33,8 @@ timerHardware_t timerHardware[] = { DEF_TIM(TIM1, CH2, PA9, TIM_USE_OUTPUT_AUTO, 0, 0), // labelled "ESC" - DEF_TIM(TIM5, CH3, PA2, TIM_USE_OUTPUT_AUTO, 0, 0), // labelled "RPM", clashes with UART2 TX - DEF_TIM(TIM5, CH4, PA3, TIM_USE_OUTPUT_AUTO, 0, 0), // labelled "TLM", clashes with UART2 RX + DEF_TIM(TIM2, CH3, PA2, TIM_USE_OUTPUT_AUTO, 0, 0), // labelled "RPM", clashes with UART2 TX + DEF_TIM(TIM2, CH4, PA3, TIM_USE_OUTPUT_AUTO, 0, 0), // labelled "TLM", clashes with UART2 RX DEF_TIM(TIM4, CH1, PB6, TIM_USE_OUTPUT_AUTO, 0, 0), // labelled "AUX", clashes with UART1 TX and I2C1 SCL DEF_TIM(TIM4, CH2, PB7, TIM_USE_OUTPUT_AUTO, 0, 0), // labelled "SBUS", clashes with UART1 RX and I2C1 SDA diff --git a/src/main/target/NEXUSX/target.h b/src/main/target/NEXUSX/target.h index 8270ea4ac68..def2ada57b0 100644 --- a/src/main/target/NEXUSX/target.h +++ b/src/main/target/NEXUSX/target.h @@ -151,3 +151,5 @@ #define USE_SERIALSHOT #define USE_ESC_SENSOR #define USE_SMARTPORT_MASTER // no internal current sensor, enable SMARTPORT_MASTER so external ones can be used + +#define USE_DSHOT_DMAR