Skip to content

Conversation

@haslinghuis
Copy link
Member

@haslinghuis haslinghuis commented Oct 22, 2025

Summary by CodeRabbit

  • Chores
    • Streamlined timer pin mapping for TMOTORH743, reducing and reordering available pin entries to match supported hardware.
    • Introduced new DMA option values for several timer-up channels to enable additional DMA configurations.

@haslinghuis haslinghuis self-assigned this Oct 22, 2025
@haslinghuis haslinghuis added the Bugfix Fixes a problem label Oct 22, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 22, 2025

Walkthrough

TIMER_PIN_MAPPING in configs/TMOTORH743/config.h was reduced and reordered to nine active entries (indices 0–8). TIMUPx DMA option macros were updated: TIMUP2_DMA_OPT=10, TIMUP3_DMA_OPT=11, TIMUP8_DMA_OPT=12. Commented placeholders added for higher indices.

Changes

Cohort / File(s) Change Summary
TMOTORH743 board config
configs/TMOTORH743/config.h
Replaced previous 14-entry TIMER_PIN_MAPPING with 9 active entries (indices 0–8): PA0, PA1, PA2, PA3, PB0, PB1, PC8, PC9, PA8; removed/commented higher-index entries. Added/updated DMA option macros: TIMUP2_DMA_OPT=10, TIMUP3_DMA_OPT=11, TIMUP8_DMA_OPT=12 (previous placeholders removed).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • nerdCopter

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The pull request description is minimal and largely incomplete compared to the provided template requirements. The description consists of a single line referencing an issue without explaining the specific configuration problems, how the timer map changes resolve them, or any testing performed. While the reference to issue #14724 is on-topic and directly related to the PR objectives, the description lacks substantive detail about the nature of the fix and its impact, which would be expected even for bugfix PRs to aid reviewers in understanding the changes.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The pull request title "Fix timer map for TMOTORH743" directly corresponds to the main change in the changeset. The raw summary confirms that the modifications involve redefined TIMER_PIN_MAPPING entries and updated TIMUPx_DMA_OPT macros for the TMOTORH743 configuration file. The title is concise, specific, and clearly indicates the primary fix without unnecessary verbosity or vague language.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch haslinghuis-patch-3

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2937d5f and 44ee16c.

📒 Files selected for processing (1)
  • configs/TMOTORH743/config.h (1 hunks)
🧰 Additional context used
🧠 Learnings (6)
📓 Common learnings
Learnt from: haslinghuis
PR: betaflight/config#0
File: :0-0
Timestamp: 2025-06-02T16:16:20.197Z
Learning: In STM32F405-based flight controller configurations, timer pin mappings must be carefully analyzed for DMA stream conflicts, especially between motor timers, LED strip timers, and SPI DMA assignments. Changes to TIMER_PIN_MAPPING should include verification that all required peripherals (motors, LED strip, blackbox SPI) can coexist without DMA conflicts.
📚 Learning: 2025-06-02T16:16:20.197Z
Learnt from: haslinghuis
PR: betaflight/config#0
File: :0-0
Timestamp: 2025-06-02T16:16:20.197Z
Learning: In STM32F405-based flight controller configurations, timer pin mappings must be carefully analyzed for DMA stream conflicts, especially between motor timers, LED strip timers, and SPI DMA assignments. Changes to TIMER_PIN_MAPPING should include verification that all required peripherals (motors, LED strip, blackbox SPI) can coexist without DMA conflicts.

Applied to files:

  • configs/TMOTORH743/config.h
📚 Learning: 2025-08-28T20:45:36.652Z
Learnt from: haslinghuis
PR: betaflight/config#888
File: configs/ZEX_ATHENA_MINI/config.h:0-0
Timestamp: 2025-08-28T20:45:36.652Z
Learning: In STM32H743 Betaflight configurations, PA15 maps to TIM2_CH1 (timer index 2) as defined in timer_stm32h7xx.c. When used for GYRO_CLKIN functionality, it's recommended to use the macro name GYRO_1_CLKIN_PIN in TIMER_PIN_MAPPING for consistency with other pin definitions.

Applied to files:

  • configs/TMOTORH743/config.h
📚 Learning: 2025-05-31T17:01:39.423Z
Learnt from: haslinghuis
PR: betaflight/config#798
File: configs/FURYF4OSD/config.h:88-88
Timestamp: 2025-05-31T17:01:39.423Z
Learning: For STM32F4xx platforms, PB1 pin timer definitions are:
1 = DEF_TIM(TIM1, CH3N, PB1, 0, 0)
2 = DEF_TIM(TIM3, CH4, PB1, 0, 0) 
3 = DEF_TIM(TIM8, CH3N, PB1, 0, 0)
Timer instance 2 (TIM3, CH4) is the correct mapping for PB1 motor control on STM32F4xx platforms as defined in src/platform/STM32/timer_stm32f4xx.c

Applied to files:

  • configs/TMOTORH743/config.h
📚 Learning: 2025-07-14T15:41:14.364Z
Learnt from: ot0tot
PR: betaflight/config#834
File: configs/RADIOLINKF405/config.h:79-88
Timestamp: 2025-07-14T15:41:14.364Z
Learning: In STM32F405 configurations, PB1 typically maps to TIM3_CH4 and PC9 typically maps to TIM8_CH4. These are different timers and do not share DMA resources, so there is no conflict when both pins are used simultaneously (e.g., PB1 for LED_STRIP and PC9 for MOTOR4).

Applied to files:

  • configs/TMOTORH743/config.h
📚 Learning: 2025-08-28T20:45:36.652Z
Learnt from: haslinghuis
PR: betaflight/config#888
File: configs/ZEX_ATHENA_MINI/config.h:0-0
Timestamp: 2025-08-28T20:45:36.652Z
Learning: In STM32H743 Betaflight configurations, PB0 can use multiple timer options including TIM1_CH2N, TIM3_CH3, and TIM8_CH2N as defined in timer_stm32h7xx.c. For CAMERA_CONTROL_PIN assignments, TIM3_CH3 (timer index 3) is the appropriate choice.

Applied to files:

  • configs/TMOTORH743/config.h
🔇 Additional comments (3)
configs/TMOTORH743/config.h (3)

106-121: Request functional testing to confirm magnetometer detection fix.

The timer mapping and DMA option changes are intended to resolve the magnetometer detection issue (issue #14724). Please verify:

  1. Magnetometer detection: Confirm mag is now detected on I2C1 with the new configuration in 2025.12.0-RC2/Beta
  2. Motor outputs: Test all 8 motor outputs function correctly
  3. LED strip: Verify LED strip on PA8 operates normally
  4. Other I2C devices: Confirm barometer on I2C2 (PB10/PB11) remains functional

Testing with the actual hardware (TMOTORH743 + Foxeer M10Q 250 V2 GPS) is essential to validate this fix, as the support ID c4e0d1aa-ce7d-45a6-94f3-89b9bae15071 from issue #14724 indicates this is a real-world deployment scenario.


106-114: Verify timer index assignments and DMA channel allocations against STM32H743 hardware definitions.

The TIMER_PIN_MAPPING indices (1 for PA0-PA3/PA8, and 2 for PB0-PB1/PC8-PC9) must correspond to valid timer definitions in the target hardware configuration. While I2C1 pins (PB6/PB7) are correctly isolated and SPI6 pins (PB3/PB4/PB5) are properly removed, timer hardware definitions are required to confirm that the index assignments match the target's available timers and that DMA channels don't conflict with I2C1 peripherals (which is critical since the PR addresses magnetometer detection).

Confirm:

  • Timer indices 1 and 2 map to appropriate STM32H743 timers
  • DMA assignments for TIMUP2/3/8 don't overlap with I2C1_RX/TX channels
  • Motor output functionality is preserved

119-121: Verify TIMUPx_DMA_OPT values against I2C1 DMA stream assignments for STM32H743.

The sequential DMA_OPT allocation (ADC1=8, ADC3=9, TIMUP2/3/8=10/11/12) suggests intentional conflict avoidance, and similar H743 boards (e.g., SAKURAH743) use this exact pattern. However, the repository lacks explicit mapping documentation between DMA_OPT indices and physical H743 DMA streams, making it impossible to verify these values don't conflict with I2C1 (mag_i2c_device=1, PB6/PB7) without consulting the STM32H743 datasheet or HAL implementation.

Confirm:

  • DMA_OPT values 10, 11, 12 map to DMA streams that don't conflict with I2C1's Rx/Tx allocations
  • Why TIMUP1 lacks a DMA_OPT definition (unlike TIMUP2/3/8)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
configs/TMOTORH743/config.h (1)

116-118: Clarify or remove commented-out timer mappings.

These pins are designated for SPI6 (PB3=SCK, PB4=SDI, PB5=SDO) and should not have timer functionality. Consider either:

  1. Removing these lines entirely if they serve no purpose
  2. Adding a comment explaining why they're preserved (e.g., "Reserved for SPI6, do not enable timer functionality")

Apply this diff to remove the unnecessary commented lines:

 #define TIMER_PIN_MAPPING               TIMER_PIN_MAP( 0, PA0, 1,  0 ) \
                                         TIMER_PIN_MAP( 1, PA1, 1,  1 ) \
                                         TIMER_PIN_MAP( 2, PA2, 1,  2 ) \
                                         TIMER_PIN_MAP( 3, PA3, 1,  3 ) \
                                         TIMER_PIN_MAP( 4, PB0, 2,  4 ) \
                                         TIMER_PIN_MAP( 5, PB1, 2,  5 ) \
                                         TIMER_PIN_MAP( 6, PC8, 2,  6 ) \
                                         TIMER_PIN_MAP( 7, PC9, 2,  7 ) \
                                         TIMER_PIN_MAP( 8, PA8, 1, 14 )
-
-//                                        TIMER_PIN_MAP( 9, PB3, 1,  0 ) \
-//                                        TIMER_PIN_MAP(10, PB4, 1,  0 ) \
-//                                        TIMER_PIN_MAP(11, PB5, 1,  0 )
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 085f14c and 2937d5f.

📒 Files selected for processing (1)
  • configs/TMOTORH743/config.h (1 hunks)
🧰 Additional context used
🧠 Learnings (6)
📓 Common learnings
Learnt from: haslinghuis
PR: betaflight/config#0
File: :0-0
Timestamp: 2025-06-02T16:16:20.197Z
Learning: In STM32F405-based flight controller configurations, timer pin mappings must be carefully analyzed for DMA stream conflicts, especially between motor timers, LED strip timers, and SPI DMA assignments. Changes to TIMER_PIN_MAPPING should include verification that all required peripherals (motors, LED strip, blackbox SPI) can coexist without DMA conflicts.
Learnt from: haslinghuis
PR: betaflight/config#798
File: configs/FURYF4OSD/config.h:88-88
Timestamp: 2025-05-31T17:01:39.423Z
Learning: For STM32F4xx platforms, PB1 pin timer definitions are:
1 = DEF_TIM(TIM1, CH3N, PB1, 0, 0)
2 = DEF_TIM(TIM3, CH4, PB1, 0, 0) 
3 = DEF_TIM(TIM8, CH3N, PB1, 0, 0)
Timer instance 2 (TIM3, CH4) is the correct mapping for PB1 motor control on STM32F4xx platforms as defined in src/platform/STM32/timer_stm32f4xx.c
Learnt from: haslinghuis
PR: betaflight/config#888
File: configs/ZEX_ATHENA_MINI/config.h:0-0
Timestamp: 2025-08-28T20:45:36.652Z
Learning: In STM32H743 Betaflight configurations, PA15 maps to TIM2_CH1 (timer index 2) as defined in timer_stm32h7xx.c. When used for GYRO_CLKIN functionality, it's recommended to use the macro name GYRO_1_CLKIN_PIN in TIMER_PIN_MAPPING for consistency with other pin definitions.
Learnt from: ot0tot
PR: betaflight/config#834
File: configs/RADIOLINKF405/config.h:79-88
Timestamp: 2025-07-14T15:41:14.364Z
Learning: In STM32F405 configurations, PB1 typically maps to TIM3_CH4 and PC9 typically maps to TIM8_CH4. These are different timers and do not share DMA resources, so there is no conflict when both pins are used simultaneously (e.g., PB1 for LED_STRIP and PC9 for MOTOR4).
Learnt from: haslinghuis
PR: betaflight/config#888
File: configs/ZEX_ATHENA_MINI/config.h:0-0
Timestamp: 2025-08-28T20:45:36.652Z
Learning: In STM32H743 Betaflight configurations, PB0 can use multiple timer options including TIM1_CH2N, TIM3_CH3, and TIM8_CH2N as defined in timer_stm32h7xx.c. For CAMERA_CONTROL_PIN assignments, TIM3_CH3 (timer index 3) is the appropriate choice.
📚 Learning: 2025-06-02T16:16:20.197Z
Learnt from: haslinghuis
PR: betaflight/config#0
File: :0-0
Timestamp: 2025-06-02T16:16:20.197Z
Learning: In STM32F405-based flight controller configurations, timer pin mappings must be carefully analyzed for DMA stream conflicts, especially between motor timers, LED strip timers, and SPI DMA assignments. Changes to TIMER_PIN_MAPPING should include verification that all required peripherals (motors, LED strip, blackbox SPI) can coexist without DMA conflicts.

Applied to files:

  • configs/TMOTORH743/config.h
📚 Learning: 2025-08-28T20:45:36.652Z
Learnt from: haslinghuis
PR: betaflight/config#888
File: configs/ZEX_ATHENA_MINI/config.h:0-0
Timestamp: 2025-08-28T20:45:36.652Z
Learning: In STM32H743 Betaflight configurations, PA15 maps to TIM2_CH1 (timer index 2) as defined in timer_stm32h7xx.c. When used for GYRO_CLKIN functionality, it's recommended to use the macro name GYRO_1_CLKIN_PIN in TIMER_PIN_MAPPING for consistency with other pin definitions.

Applied to files:

  • configs/TMOTORH743/config.h
📚 Learning: 2025-05-31T17:01:39.423Z
Learnt from: haslinghuis
PR: betaflight/config#798
File: configs/FURYF4OSD/config.h:88-88
Timestamp: 2025-05-31T17:01:39.423Z
Learning: For STM32F4xx platforms, PB1 pin timer definitions are:
1 = DEF_TIM(TIM1, CH3N, PB1, 0, 0)
2 = DEF_TIM(TIM3, CH4, PB1, 0, 0) 
3 = DEF_TIM(TIM8, CH3N, PB1, 0, 0)
Timer instance 2 (TIM3, CH4) is the correct mapping for PB1 motor control on STM32F4xx platforms as defined in src/platform/STM32/timer_stm32f4xx.c

Applied to files:

  • configs/TMOTORH743/config.h
📚 Learning: 2025-07-14T15:41:14.364Z
Learnt from: ot0tot
PR: betaflight/config#834
File: configs/RADIOLINKF405/config.h:79-88
Timestamp: 2025-07-14T15:41:14.364Z
Learning: In STM32F405 configurations, PB1 typically maps to TIM3_CH4 and PC9 typically maps to TIM8_CH4. These are different timers and do not share DMA resources, so there is no conflict when both pins are used simultaneously (e.g., PB1 for LED_STRIP and PC9 for MOTOR4).

Applied to files:

  • configs/TMOTORH743/config.h
📚 Learning: 2025-08-28T20:45:36.652Z
Learnt from: haslinghuis
PR: betaflight/config#888
File: configs/ZEX_ATHENA_MINI/config.h:0-0
Timestamp: 2025-08-28T20:45:36.652Z
Learning: In STM32H743 Betaflight configurations, PB0 can use multiple timer options including TIM1_CH2N, TIM3_CH3, and TIM8_CH2N as defined in timer_stm32h7xx.c. For CAMERA_CONTROL_PIN assignments, TIM3_CH3 (timer index 3) is the appropriate choice.

Applied to files:

  • configs/TMOTORH743/config.h
🔇 Additional comments (1)
configs/TMOTORH743/config.h (1)

106-114: Correctly fixes magnetometer detection by removing I2C pins from timer mapping.

This change directly resolves issue #14724 by eliminating the resource conflict between timer and I2C peripherals. PB6 and PB7 are configured as I2C1_SCL and I2C1_SDA pins, and I2C1 is used for the magnetometer (MAG_I2C_INSTANCE). Having these pins in the timer mapping prevented proper I2C initialization, causing the "Not detected or disabled" error.

The new mapping correctly includes all required timer outputs:

  • 8 motor outputs (PA0-PA3, PB0-PB1, PC8-PC9)
  • 1 LED strip output (PA8)

Additionally, removing SPI6 pins (PB3-PB5) prevents similar peripheral conflicts.

@haslinghuis
Copy link
Member Author

@ot0tot feel free to make other changes

Copy link
Member

@nerdCopter nerdCopter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • approving untested

@haslinghuis haslinghuis merged commit 805524c into master Oct 24, 2025
2 checks passed
@haslinghuis haslinghuis deleted the haslinghuis-patch-3 branch October 24, 2025 10:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bugfix Fixes a problem

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants