Skip to content

Conversation

@haslinghuis
Copy link
Member

@haslinghuis haslinghuis commented Jan 10, 2026

  • Added BEEPER_INVERSED, MOTOR_PROTOCOL and updated TIMER_PIN_MAPPING.
  • Probable LED_STRIP and MOTOR8 will haves issue.
#define MOTOR1_PIN PB1 TIM3_CH4
#define MOTOR2_PIN PB0 TIM3_CH3
#define MOTOR3_PIN PA3 1=TIM2_CH4 2=TIM5_CH4 3=TIM9_CH2
#define MOTOR4_PIN PA2 1=TIM2_CH3 2=TIM5_CH3 3=TIM9_CH1
#define MOTOR5_PIN PB9 1=TIM4_CH4 2=TIM11_CH1
#define MOTOR6_PIN PB4 TIM3_CH1
#define MOTOR7_PIN PB5 TIM3_CH2
#define MOTOR8_PIN PC9 1=TIM3_CH4 2=TIM8_CH4
#define RX_PPM_PIN PA15 TIM2_CH1
#define LED_STRIP_PIN PC8 1=TIM3_CH3 2=TIM8_CH3

New timer and dma assignments (RX_PPM not added)

#define TIMER_PIN_MAPPING \
    TIMER_PIN_MAP( 0, PB1 , 1,  1 ) \ // TIM3_CH4
    TIMER_PIN_MAP( 1, PB0 , 1,  0 ) \ // TIM3_CH3
    TIMER_PIN_MAP( 2, PA3 , 2,  0 ) \ // TIM5_CH4
    TIMER_PIN_MAP( 3, PA2 , 2,  0 ) \ // TIM5_CH3
    TIMER_PIN_MAP( 4, PB9 , 1, -1 ) \ // TIM4_CH4
    TIMER_PIN_MAP( 5, PB4 , 1,  0 ) \ // TIM3_CH1
    TIMER_PIN_MAP( 6, PB5 , 1,  0 ) \ // TIM3_CH2
    TIMER_PIN_MAP( 7, PC9 , 2,  0 ) \ // TIM8_CH4
    TIMER_PIN_MAP( 8, PC8 , 2,  0 ) \ // TIM8_CH3
    TIMER_PIN_MAP( 8, PA15, 1, -1 )  // TIM2_CH1

Summary by CodeRabbit

  • Configuration Updates
    • Motor control protocol updated to DSHOT300
    • Beeper polarity configuration option added
    • SPI gyroscope support removed
    • Hardware timing adjustments applied

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 10, 2026

Walkthrough

Adjusted BRAHMA_F405 board configuration: updated several TIMER_PIN_MAPPING entries (PA3, PA2, PC9, PC8 switched from timer 1→2), added MOTOR_PWM_PROTOCOL = DSHOT300 and BEEPER_INVERTED, and removed USE_SPI_GYRO.

Changes

Cohort / File(s) Summary
Board configuration updates
configs/BRAHMA_F405/config.h
Updated TIMER_PIN_MAPPING entries for PA3/PA2/PC9/PC8 (timer index 1 → 2), added MOTOR_PWM_PROTOCOL = DSHOT300 and BEEPER_INVERTED, removed USE_SPI_GYRO

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

Bugfix

Suggested reviewers

  • ot0tot
  • nerdCopter
🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Description check ⚠️ Warning No pull request description was provided; the template requires mandatory information including hardware compliance, checklist items, and clarification of changes made. Add a complete pull request description following the template, including hardware compliance requirements, a filled checklist, and explanation of the configuration changes and their justification.
Title check ❓ Inconclusive The title is generic and vague, lacking specific details about the configuration changes made to the BRAHMA_F405 board. Provide a more descriptive title that specifies the key changes, such as 'Update BRAHMA_F405 timer pin mappings and board configuration' or similar.
✅ Passed checks (1 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

📜 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 dcc29a1 and 3b7b9c6.

📒 Files selected for processing (1)
  • configs/BRAHMA_F405/config.h
🧰 Additional context used
🧠 Learnings (25)
📓 Common learnings
Learnt from: haslinghuis
Repo: betaflight/config PR: 0
File: :0-0
Timestamp: 2025-12-30T20:09:11.644Z
Learning: For Betaflight board configuration reviews, F411 MCU, SPI-based RX, and BMI270 gyro are deprecated platforms as of September 16, 2024. New target submissions using these should be flagged.
Learnt from: osirisinferi
Repo: betaflight/config PR: 0
File: :0-0
Timestamp: 2025-12-27T17:15:05.111Z
Learning: For Betaflight board configuration reviews, when analyzing TIMER_PIN_MAPPING definitions in config.h files, perform a comprehensive verification by: (1) Clone or access the betaflight/betaflight repository and look up each pin's timer definitions from the appropriate timer_stm32*.c file (e.g., timer_stm32h7xx.c for STM32H743, timer_stm32f4xx.c for STM32F405, etc.). (2) For each TIMER_PIN_MAP entry, verify that the timer occurrence index specified actually exists in the timer definition file for that pin. Non-existent occurrences will cause build or runtime errors. (3) Check if any timer occurrence being used is a complementary channel (ending in "N" like TIM1_CH2N, TIM8_CH3N). Complementary channels are not suitable for motor/servo control and must not be actively selected. (4) Verify that each timer channel uses a unique DMA index on MCUs with DMAMUX (like STM32H7). For MCUs without DMAMUX (like STM32F4/F7), verify non-conflicting DMA stream requests according to the appropriate DMA r...
Learnt from: haslinghuis
Repo: betaflight/config PR: 0
File: :0-0
Timestamp: 2025-12-30T20:09:11.644Z
Learning: For Betaflight board configuration reviews, maintainer information must be included in target submissions according to the Requirements for Submission of New and Updated Targets.
Learnt from: osirisinferi
Repo: betaflight/config PR: 0
File: :0-0
Timestamp: 2025-12-30T21:01:01.473Z
Learning: For Betaflight board configuration reviews, when blocking issues are identified after an initial approval, immediately dismiss/withdraw the approval by using `gh pr review <PR_NUMBER> --repo betaflight/config --request-changes --body "<reason>"` to change the review state to CHANGES_REQUESTED. This actively manages approval status to ensure it accurately reflects the current mergability state of the PR.
Learnt from: haslinghuis
Repo: betaflight/config PR: 0
File: :0-0
Timestamp: 2025-12-30T20:09:11.644Z
Learning: For Betaflight board configuration reviews, STM32 F4 and F7 based designs with more than 4 motor outputs are not accepted for new submissions after December 3, 2024. This is an official timeline restriction from the Config Target Guidance.
Learnt from: osirisinferi
Repo: betaflight/config PR: 972
File: configs/AXISFLYING_H743PRO/config.h:0-0
Timestamp: 2025-12-03T20:45:27.890Z
Learning: In Betaflight board configurations, always verify that TIMER_PIN_MAP entries do not use the same pin macro name multiple times. Each physical pin should appear only once in the TIMER_PIN_MAP definitions. For example, GYRO_1_CLKIN_PIN and GYRO_2_CLKIN_PIN should each appear exactly once, not have GYRO_1_CLKIN_PIN appear twice. This is a blocking issue that must be resolved before approval.
Learnt from: haslinghuis
Repo: betaflight/config PR: 0
File: :0-0
Timestamp: 2025-12-30T20:23:04.046Z
Learning: For Betaflight board configuration reviews, motor channels must be prioritized above all other peripherals when assigning timers/DMA according to section 3.2 of the Manufacturer Design Guidelines. Designs that cannot allocate sufficient timer/DMA resources for motors/DShot will be rejected.
Learnt from: osirisinferi
Repo: betaflight/config PR: 0
File: :0-0
Timestamp: 2025-12-30T21:03:53.169Z
Learning: For Betaflight board configuration reviews, schematics are mandatory for the overall review process according to the Config Target Guidance, but they do NOT need to be provided publicly in the GitHub PR itself. Schematics review is conducted through a separate/private channel. Do not flag "missing schematics in PR" as a blocking issue.
Learnt from: haslinghuis
Repo: betaflight/config PR: 0
File: :0-0
Timestamp: 2025-12-30T20:09:11.644Z
Learning: For Betaflight board configuration reviews, schematics are mandatory for all new target submissions. Submissions without schematics for review should be rejected according to the Config Target Guidance.
Learnt from: haslinghuis
Repo: betaflight/config PR: 0
File: :0-0
Timestamp: 2026-01-10T18:17:06.209Z
Learning: In Betaflight board configurations, removing a define from a board-specific config.h file does not necessarily remove that feature. If the define is already present at the platform target level, the board will inherit that platform-level definition. Removing board-level defines that duplicate platform defaults is a cleanup action, not a feature removal.
Learnt from: haslinghuis
Repo: betaflight/config PR: 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
Repo: betaflight/config PR: 0
File: :0-0
Timestamp: 2025-12-30T20:23:04.046Z
Learning: For Betaflight board configuration reviews on STM32F4, prefer PWM-based DShot by default due to DMA2/SPI1 limitations and errata. Bitbanged DShot uses DMA2 and TIM1/TIM8 which conflicts with SPI1 (gyro) DMA. Avoid using TIM1/TIM8 for other functions on F4 if bitbanged DShot is needed.
Learnt from: osirisinferi
Repo: betaflight/config PR: 0
File: :0-0
Timestamp: 2025-12-27T16:50:57.069Z
Learning: In Betaflight board configurations, when GYRO_1_CLKIN_PIN (or GYRO_2_CLKIN_PIN) is defined, it must be included in the TIMER_PIN_MAPPING with appropriate timer and DMA settings, typically with DMA index -1. Check similar boards from the same manufacturer for the correct pattern.
Learnt from: haslinghuis
Repo: betaflight/config PR: 0
File: :0-0
Timestamp: 2025-12-30T20:23:04.046Z
Learning: For Betaflight board configuration reviews on STM32F7/H7/G4/AT32F435 MCUs, bitbanged DShot is preferred because DMAMUX avoids many DMA conflicts. Bitbanged DShot always uses TIM1 and/or TIM8, so at least one of those timers must be available for motor control.
Learnt from: haslinghuis
Repo: betaflight/config PR: 0
File: :0-0
Timestamp: 2025-12-30T20:23:04.046Z
Learning: For Betaflight board configuration reviews, TIM1 and TIM8 are "advanced" timers used by DShot bitbang and can drive any GPIO in bitbang mode. Do not assign TIM1/TIM8 to other critical functions when bitbanged DShot is expected, as this will create resource conflicts.
📚 Learning: 2025-12-27T17:15:05.111Z
Learnt from: osirisinferi
Repo: betaflight/config PR: 0
File: :0-0
Timestamp: 2025-12-27T17:15:05.111Z
Learning: For Betaflight board configuration reviews, when analyzing TIMER_PIN_MAPPING definitions in config.h files, perform a comprehensive verification by: (1) Clone or access the betaflight/betaflight repository and look up each pin's timer definitions from the appropriate timer_stm32*.c file (e.g., timer_stm32h7xx.c for STM32H743, timer_stm32f4xx.c for STM32F405, etc.). (2) For each TIMER_PIN_MAP entry, verify that the timer occurrence index specified actually exists in the timer definition file for that pin. Non-existent occurrences will cause build or runtime errors. (3) Check if any timer occurrence being used is a complementary channel (ending in "N" like TIM1_CH2N, TIM8_CH3N). Complementary channels are not suitable for motor/servo control and must not be actively selected. (4) Verify that each timer channel uses a unique DMA index on MCUs with DMAMUX (like STM32H7). For MCUs without DMAMUX (like STM32F4/F7), verify non-conflicting DMA stream requests according to the appropriate DMA r...

Applied to files:

  • configs/BRAHMA_F405/config.h
📚 Learning: 2025-06-02T16:16:20.197Z
Learnt from: haslinghuis
Repo: betaflight/config PR: 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/BRAHMA_F405/config.h
📚 Learning: 2025-12-03T20:45:27.890Z
Learnt from: osirisinferi
Repo: betaflight/config PR: 972
File: configs/AXISFLYING_H743PRO/config.h:0-0
Timestamp: 2025-12-03T20:45:27.890Z
Learning: In Betaflight board configurations, always verify that TIMER_PIN_MAP entries do not use the same pin macro name multiple times. Each physical pin should appear only once in the TIMER_PIN_MAP definitions. For example, GYRO_1_CLKIN_PIN and GYRO_2_CLKIN_PIN should each appear exactly once, not have GYRO_1_CLKIN_PIN appear twice. This is a blocking issue that must be resolved before approval.

Applied to files:

  • configs/BRAHMA_F405/config.h
📚 Learning: 2025-12-27T16:50:57.069Z
Learnt from: osirisinferi
Repo: betaflight/config PR: 0
File: :0-0
Timestamp: 2025-12-27T16:50:57.069Z
Learning: In TIMER_PIN_MAPPING definitions, each timer channel must have a unique DMA index. Multiple entries using the same timer (e.g., timer 1 or timer 2) with the same DMA index (e.g., 0) will cause DMA conflicts. Proper configurations use sequential or varied DMA indices to avoid resource conflicts between motors, servos, and other peripherals.

Applied to files:

  • configs/BRAHMA_F405/config.h
📚 Learning: 2025-12-30T20:23:04.046Z
Learnt from: haslinghuis
Repo: betaflight/config PR: 0
File: :0-0
Timestamp: 2025-12-30T20:23:04.046Z
Learning: For Betaflight board configuration reviews, motor channels must be prioritized above all other peripherals when assigning timers/DMA according to section 3.2 of the Manufacturer Design Guidelines. Designs that cannot allocate sufficient timer/DMA resources for motors/DShot will be rejected.

Applied to files:

  • configs/BRAHMA_F405/config.h
📚 Learning: 2025-08-28T20:45:36.652Z
Learnt from: haslinghuis
Repo: betaflight/config PR: 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/BRAHMA_F405/config.h
📚 Learning: 2025-12-27T16:50:57.069Z
Learnt from: osirisinferi
Repo: betaflight/config PR: 0
File: :0-0
Timestamp: 2025-12-27T16:50:57.069Z
Learning: In Betaflight board configurations, when GYRO_1_CLKIN_PIN (or GYRO_2_CLKIN_PIN) is defined, it must be included in the TIMER_PIN_MAPPING with appropriate timer and DMA settings, typically with DMA index -1. Check similar boards from the same manufacturer for the correct pattern.

Applied to files:

  • configs/BRAHMA_F405/config.h
📚 Learning: 2025-12-30T20:23:04.046Z
Learnt from: haslinghuis
Repo: betaflight/config PR: 0
File: :0-0
Timestamp: 2025-12-30T20:23:04.046Z
Learning: For Betaflight board configuration reviews, TIM1 and TIM8 are "advanced" timers used by DShot bitbang and can drive any GPIO in bitbang mode. Do not assign TIM1/TIM8 to other critical functions when bitbanged DShot is expected, as this will create resource conflicts.

Applied to files:

  • configs/BRAHMA_F405/config.h
📚 Learning: 2025-07-14T16:16:56.822Z
Learnt from: haslinghuis
Repo: betaflight/config PR: 835
File: configs/HDZERO_HALO_MPU6000/config.h:44-56
Timestamp: 2025-07-14T16:16:56.822Z
Learning: For Betaflight board configurations of boards already in production, pin assignments in config.h files reflect the actual hardware design and cannot be changed, even if they present potential conflicts with debug interfaces. The configuration must match the physical board layout, not ideal software design preferences.

Applied to files:

  • configs/BRAHMA_F405/config.h
📚 Learning: 2025-12-27T16:56:51.341Z
Learnt from: osirisinferi
Repo: betaflight/config PR: 0
File: :0-0
Timestamp: 2025-12-27T16:56:51.341Z
Learning: In TIMER_PIN_MAPPING definitions for STM32H743, even though the chip has DMAMUX, each timer channel must still use a unique DMA index to avoid resource conflicts. Using the same DMA index (e.g., 0) for multiple timer channels will cause DMA conflicts. Proper H743 configurations use sequential or varied DMA indices (e.g., 0, 1, 2, 3, 4, 5, 6, 7, etc.) with -1 reserved for special pins without DMA like camera control or gyro clock input.

Applied to files:

  • configs/BRAHMA_F405/config.h
📚 Learning: 2025-05-31T17:01:39.423Z
Learnt from: haslinghuis
Repo: betaflight/config PR: 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/BRAHMA_F405/config.h
📚 Learning: 2025-07-14T15:41:14.364Z
Learnt from: ot0tot
Repo: betaflight/config PR: 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/BRAHMA_F405/config.h
📚 Learning: 2025-12-27T16:56:51.341Z
Learnt from: osirisinferi
Repo: betaflight/config PR: 0
File: :0-0
Timestamp: 2025-12-27T16:56:51.341Z
Learning: When defining TIMER_PIN_MAPPING entries, specifying a timer occurrence index that doesn't exist for a given pin will cause build or runtime errors. For example, on STM32H743, pins PD12-PD15 map to TIM4 channels (occurrence 1 only), so using occurrence 2 or 3 is invalid. Always verify the correct timer occurrence index by checking similar board configurations or the timer definition file (timer_stm32h7xx.c) for the specific MCU platform.

Applied to files:

  • configs/BRAHMA_F405/config.h
📚 Learning: 2025-12-27T17:04:49.273Z
Learnt from: osirisinferi
Repo: betaflight/config PR: 0
File: :0-0
Timestamp: 2025-12-27T17:04:49.273Z
Learning: For STM32H743 and other MCUs with DMAMUX in Betaflight, LED_STRIP_PIN must have a valid DMA index in TIMER_PIN_MAPPING (not -1) because WS2812/addressable LEDs require DMA for precise timing control. Using DMA -1 for LED strip will cause the feature to be non-functional.

Applied to files:

  • configs/BRAHMA_F405/config.h
📚 Learning: 2025-07-03T15:17:30.040Z
Learnt from: haslinghuis
Repo: betaflight/config PR: 0
File: :0-0
Timestamp: 2025-07-03T15:17:30.040Z
Learning: In Betaflight configurations, when a target name suggests dual IMUs (like JHEF7DUAL) but specific hardware variants only have one gyro available, the preferred solution is to use DEFAULT_GYRO_TO_USE macro to specify which gyro to use by default rather than pruning gyro defines or creating redundant configurations. This approach maintains compatibility when the same target is used by multiple hardware variants from the same manufacturer.

Applied to files:

  • configs/BRAHMA_F405/config.h
📚 Learning: 2025-12-30T20:23:04.046Z
Learnt from: haslinghuis
Repo: betaflight/config PR: 0
File: :0-0
Timestamp: 2025-12-30T20:23:04.046Z
Learning: For Betaflight board configuration reviews, avoid sharing blocking SPI devices (e.g., MAX7456 OSD, blackbox flash) on the same SPI bus used by the gyro, as blocking operations degrade flight performance. Place the gyro on a dedicated or reliable SPI bus. On STM32F4, avoid enabling DMA on the same DMA controller when using bitbanged motors.

Applied to files:

  • configs/BRAHMA_F405/config.h
📚 Learning: 2025-05-28T15:42:05.402Z
Learnt from: haslinghuis
Repo: betaflight/config PR: 792
File: configs/BEEROTORF4/config.h:30-30
Timestamp: 2025-05-28T15:42:05.402Z
Learning: The DEFAULT_GYRO_ENABLED macro with both gyros enabled (GYRO_MASK(0) | GYRO_MASK(1)) should only be added to board configurations that have DEFAULT_GYRO_TO_USE set to GYRO_CONFIG_USE_GYRO_BOTH. Boards without this setting should only get the GYRO_COUNT definition to specify the number of available gyros.

Applied to files:

  • configs/BRAHMA_F405/config.h
📚 Learning: 2025-05-28T15:42:05.402Z
Learnt from: haslinghuis
Repo: betaflight/config PR: 792
File: configs/BEEROTORF4/config.h:30-30
Timestamp: 2025-05-28T15:42:05.402Z
Learning: The DEFAULT_GYRO_ENABLED macro with both gyros enabled (GYRO_MASK(0) | GYRO_MASK(1)) should only be added to board configurations that have DEFAULT_GYRO_TO_USE set to GYRO_CONFIG_USE_GYRO_BOTH. Boards without this setting should only get the GYRO_COUNT definition.

Applied to files:

  • configs/BRAHMA_F405/config.h
📚 Learning: 2025-08-05T16:56:44.200Z
Learnt from: haslinghuis
Repo: betaflight/config PR: 757
File: configs/HAKRCH743/config.h:134-134
Timestamp: 2025-08-05T16:56:44.200Z
Learning: In Betaflight board configurations, when DEFAULT_GYRO_TO_USE is set to GYRO_CONFIG_USE_GYRO_BOTH, the firmware automatically establishes GYRO_COUNT during initialization for backwards compatibility. Therefore, explicit GYRO_COUNT definitions are not needed in board config files when using DEFAULT_GYRO_TO_USE.

Applied to files:

  • configs/BRAHMA_F405/config.h
📚 Learning: 2025-07-25T20:06:07.492Z
Learnt from: haslinghuis
Repo: betaflight/config PR: 719
File: configs/SPEDIXG473/config.h:29-38
Timestamp: 2025-07-25T20:06:07.492Z
Learning: BMP280 and DPS310 barometer drivers in Betaflight do not require USE_I2C to be explicitly defined in board configurations. Many existing boards successfully use USE_BARO_BMP280 and USE_BARO_DPS310 without defining USE_I2C, indicating that the I2C dependency is handled automatically by the build system or these sensors support alternative communication methods.

Applied to files:

  • configs/BRAHMA_F405/config.h
📚 Learning: 2025-07-25T20:06:07.492Z
Learnt from: haslinghuis
Repo: betaflight/config PR: 719
File: configs/SPEDIXG473/config.h:29-38
Timestamp: 2025-07-25T20:06:07.492Z
Learning: BMP280 and DPS310 barometer drivers in Betaflight do not require USE_I2C to be explicitly defined in board configurations. Out of 264 boards using these drivers, 259 (98%) work without USE_I2C defined, indicating that the I2C dependency is handled automatically by the build system.

Applied to files:

  • configs/BRAHMA_F405/config.h
📚 Learning: 2025-12-30T20:23:04.046Z
Learnt from: haslinghuis
Repo: betaflight/config PR: 0
File: :0-0
Timestamp: 2025-12-30T20:23:04.046Z
Learning: For Betaflight board configuration reviews on STM32F4, prefer PWM-based DShot by default due to DMA2/SPI1 limitations and errata. Bitbanged DShot uses DMA2 and TIM1/TIM8 which conflicts with SPI1 (gyro) DMA. Avoid using TIM1/TIM8 for other functions on F4 if bitbanged DShot is needed.

Applied to files:

  • configs/BRAHMA_F405/config.h
📚 Learning: 2025-07-14T16:16:50.628Z
Learnt from: haslinghuis
Repo: betaflight/config PR: 835
File: configs/HDZERO_HALO_MPU6000/config.h:29-35
Timestamp: 2025-07-14T16:16:50.628Z
Learning: GYRO_1_SPI_CLOCK_DIVIDER is not used in any Betaflight target configuration files. SPI clock frequency settings are not commonly configured at the target level.

Applied to files:

  • configs/BRAHMA_F405/config.h
📚 Learning: 2025-12-30T20:23:04.046Z
Learnt from: haslinghuis
Repo: betaflight/config PR: 0
File: :0-0
Timestamp: 2025-12-30T20:23:04.046Z
Learning: For Betaflight board configuration reviews on STM32F7/H7/G4/AT32F435 MCUs, bitbanged DShot is preferred because DMAMUX avoids many DMA conflicts. Bitbanged DShot always uses TIM1 and/or TIM8, so at least one of those timers must be available for motor control.

Applied to files:

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

97-97: LGTM: DSHOT300 is appropriate for this F405 board.

Setting DSHOT300 as the default motor protocol is suitable, especially with DEFAULT_DSHOT_BURST = DSHOT_DMAR_ON configured. This uses PWM-based DShot, which is the preferred approach for STM32F4 to avoid DMA2/SPI1 conflicts.


101-101: LGTM: Beeper inversion flag added.

The BEEPER_INVERTED define correctly configures the beeper for inverted (active-low) logic, matching the hardware design.


82-83: Timer occurrence 2 is invalid for PC8 and PC9; fix required.

Lines 87–88 specify timer occurrence index 2 for PC8 and PC9 (MOTOR8 and LED_STRIP_PIN), but these pins only support occurrences 0–1 in the STM32F405 timer definitions:

  • PC8: TIM3_CH3 (occurrence 0), TIM8_CH3 (occurrence 1)
  • PC9: TIM3_CH4 (occurrence 0), TIM8_CH4 (occurrence 1)

Using occurrence 2 will cause a build or runtime error. Correct to occurrence 0 or 1.

Lines 82–83 (PA3 and PA2 with occurrence 2) are valid and map correctly to TIM9 channels.

⛔ Skipped due to learnings
Learnt from: osirisinferi
Repo: betaflight/config PR: 0
File: :0-0
Timestamp: 2025-12-27T17:15:05.111Z
Learning: For Betaflight board configuration reviews, when analyzing TIMER_PIN_MAPPING definitions in config.h files, perform a comprehensive verification by: (1) Clone or access the betaflight/betaflight repository and look up each pin's timer definitions from the appropriate timer_stm32*.c file (e.g., timer_stm32h7xx.c for STM32H743, timer_stm32f4xx.c for STM32F405, etc.). (2) For each TIMER_PIN_MAP entry, verify that the timer occurrence index specified actually exists in the timer definition file for that pin. Non-existent occurrences will cause build or runtime errors. (3) Check if any timer occurrence being used is a complementary channel (ending in "N" like TIM1_CH2N, TIM8_CH3N). Complementary channels are not suitable for motor/servo control and must not be actively selected. (4) Verify that each timer channel uses a unique DMA index on MCUs with DMAMUX (like STM32H7). For MCUs without DMAMUX (like STM32F4/F7), verify non-conflicting DMA stream requests according to the appropriate DMA request mapping for that platform. Use sequential indices (0,1,2,3,4,5,6,7...) with -1 reserved only for pins that don't require DMA. (5) Verify that LED_STRIP_PIN has a valid DMA index (not -1) on platforms with DMAMUX, because WS2812/addressable LEDs require DMA for timing-critical operations. (6) Check that all defined CLKIN pins (like GYRO_1_CLKIN_PIN, GYRO_2_CLKIN_PIN) are included in the TIMER_PIN_MAPPING with appropriate timer occurrence and DMA -1. This systematic verification must be performed for all new or modified TIMER_PIN_MAPPING definitions before approval.
Learnt from: haslinghuis
Repo: betaflight/config PR: 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: osirisinferi
Repo: betaflight/config PR: 972
File: configs/AXISFLYING_H743PRO/config.h:0-0
Timestamp: 2025-12-03T20:45:27.890Z
Learning: In Betaflight board configurations, always verify that TIMER_PIN_MAP entries do not use the same pin macro name multiple times. Each physical pin should appear only once in the TIMER_PIN_MAP definitions. For example, GYRO_1_CLKIN_PIN and GYRO_2_CLKIN_PIN should each appear exactly once, not have GYRO_1_CLKIN_PIN appear twice. This is a blocking issue that must be resolved before approval.
Learnt from: haslinghuis
Repo: betaflight/config PR: 0
File: :0-0
Timestamp: 2025-12-30T20:23:04.046Z
Learning: For Betaflight board configuration reviews, motor channels must be prioritized above all other peripherals when assigning timers/DMA according to section 3.2 of the Manufacturer Design Guidelines. Designs that cannot allocate sufficient timer/DMA resources for motors/DShot will be rejected.
Learnt from: osirisinferi
Repo: betaflight/config PR: 0
File: :0-0
Timestamp: 2025-12-27T16:56:51.341Z
Learning: When defining TIMER_PIN_MAPPING entries, specifying a timer occurrence index that doesn't exist for a given pin will cause build or runtime errors. For example, on STM32H743, pins PD12-PD15 map to TIM4 channels (occurrence 1 only), so using occurrence 2 or 3 is invalid. Always verify the correct timer occurrence index by checking similar board configurations or the timer definition file (timer_stm32h7xx.c) for the specific MCU platform.
Learnt from: ot0tot
Repo: betaflight/config PR: 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: osirisinferi
Repo: betaflight/config PR: 0
File: :0-0
Timestamp: 2025-09-26T16:32:46.694Z
Learning: When reviewing hardware configuration files like Betaflight configs, always check for pin assignment conflicts by verifying that no physical pins (like PB10, PB11, etc.) are assigned to multiple peripheral functions simultaneously.
Learnt from: haslinghuis
Repo: betaflight/config PR: 0
File: :0-0
Timestamp: 2025-12-30T20:23:04.046Z
Learning: For Betaflight board configuration reviews, TIM1 and TIM8 are "advanced" timers used by DShot bitbang and can drive any GPIO in bitbang mode. Do not assign TIM1/TIM8 to other critical functions when bitbanged DShot is expected, as this will create resource conflicts.
Learnt from: osirisinferi
Repo: betaflight/config PR: 0
File: :0-0
Timestamp: 2025-12-27T16:50:57.069Z
Learning: In TIMER_PIN_MAPPING definitions, each timer channel must have a unique DMA index. Multiple entries using the same timer (e.g., timer 1 or timer 2) with the same DMA index (e.g., 0) will cause DMA conflicts. Proper configurations use sequential or varied DMA indices to avoid resource conflicts between motors, servos, and other peripherals.
Learnt from: osirisinferi
Repo: betaflight/config PR: 0
File: :0-0
Timestamp: 2025-12-27T16:56:51.341Z
Learning: In TIMER_PIN_MAPPING definitions for STM32H743, even though the chip has DMAMUX, each timer channel must still use a unique DMA index to avoid resource conflicts. Using the same DMA index (e.g., 0) for multiple timer channels will cause DMA conflicts. Proper H743 configurations use sequential or varied DMA indices (e.g., 0, 1, 2, 3, 4, 5, 6, 7, etc.) with -1 reserved for special pins without DMA like camera control or gyro clock input.
Learnt from: haslinghuis
Repo: betaflight/config PR: 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
Repo: betaflight/config PR: 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.
Learnt from: haslinghuis
Repo: betaflight/config PR: 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: osirisinferi
Repo: betaflight/config PR: 0
File: :0-0
Timestamp: 2025-12-27T16:50:57.069Z
Learning: In Betaflight board configurations, when GYRO_1_CLKIN_PIN (or GYRO_2_CLKIN_PIN) is defined, it must be included in the TIMER_PIN_MAPPING with appropriate timer and DMA settings, typically with DMA index -1. Check similar boards from the same manufacturer for the correct pattern.

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.

@haslinghuis
Copy link
Member Author

@coderabbitai you incorrectly state SPI gyroscope support removed - but this define is already defined at the platform target level.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 10, 2026

Tip

For best results, initiate chat on the files or code changes.

@haslinghuis, you're absolutely correct, and I apologize for the mischaracterization. The removal of USE_SPI_GYRO from the board-specific config doesn't remove SPI gyroscope support at all - since the define is already present at the platform target level, the board simply inherits that definition. This is actually a cleanup that removes redundant board-level definitions when the platform default is already appropriate.

Thank you for the clarification on how the configuration hierarchy works in Betaflight.


✏️ Learnings added
Learnt from: haslinghuis
URL: https://github.com/betaflight/config/pull/1010

Timestamp: 2026-01-10T18:17:06.209Z
Learning: In Betaflight board configurations, removing a define from a board-specific config.h file does not necessarily remove that feature. If the define is already present at the platform target level, the board will inherit that platform-level definition. Removing board-level defines that duplicate platform defaults is a cleanup action, not a feature removal.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.


🧠 Learnings used
Learnt from: haslinghuis
Repo: betaflight/config PR: 792
File: configs/FLYWOOF411/config.h:33-33
Timestamp: 2025-05-28T15:48:18.449Z
Learning: The FLYWOOF411 board does not actually use dual gyros despite having GYRO_2_SPI_INSTANCE defined in its configuration. It was incorrectly targeted for GYRO_COUNT and dual gyro support.

Learnt from: haslinghuis
Repo: betaflight/config PR: 792
File: configs/MERAKRCF722/config.h:32-32
Timestamp: 2025-05-28T15:45:15.608Z
Learning: The presence of GYRO_2_SPI_INSTANCE definition in a board config does not necessarily mean the board uses dual gyros. Some boards have GYRO_2_SPI_INSTANCE defined but it's not actually used, so they should not receive GYRO_COUNT or other dual-gyro related definitions. Only boards that actually utilize dual gyros should get these definitions.

Learnt from: haslinghuis
Repo: betaflight/config PR: 814
File: configs/JHEF405PRO/config.h:109-109
Timestamp: 2025-06-08T22:02:28.961Z
Learning: The JHEF405PRO board does not actually use dual gyros despite having GYRO_2_SPI_INSTANCE defined in its configuration. It should not receive GYRO_COUNT or other dual-gyro related definitions since only the first gyro is supported.

Learnt from: haslinghuis
Repo: betaflight/config PR: 0
File: :0-0
Timestamp: 2025-12-30T20:09:11.644Z
Learning: For Betaflight board configuration reviews, F411 MCU, SPI-based RX, and BMI270 gyro are deprecated platforms as of September 16, 2024. New target submissions using these should be flagged.

Learnt from: haslinghuis
Repo: betaflight/config PR: 835
File: configs/HDZERO_HALO_MPU6000/config.h:29-35
Timestamp: 2025-07-14T16:16:50.628Z
Learning: GYRO_1_SPI_CLOCK_DIVIDER is not used in any Betaflight target configuration files. SPI clock frequency settings are not commonly configured at the target level.

Learnt from: haslinghuis
Repo: betaflight/config PR: 0
File: :0-0
Timestamp: 2025-07-03T15:17:30.040Z
Learning: In Betaflight configurations, when a target name suggests dual IMUs (like JHEF7DUAL) but specific hardware variants only have one gyro available, the preferred solution is to use DEFAULT_GYRO_TO_USE macro to specify which gyro to use by default rather than pruning gyro defines or creating redundant configurations. This approach maintains compatibility when the same target is used by multiple hardware variants from the same manufacturer.

Learnt from: haslinghuis
Repo: betaflight/config PR: 792
File: configs/BEEROTORF4/config.h:30-30
Timestamp: 2025-05-28T15:42:05.402Z
Learning: The DEFAULT_GYRO_ENABLED macro with both gyros enabled (GYRO_MASK(0) | GYRO_MASK(1)) should only be added to board configurations that have DEFAULT_GYRO_TO_USE set to GYRO_CONFIG_USE_GYRO_BOTH. Boards without this setting should only get the GYRO_COUNT definition.

Learnt from: haslinghuis
Repo: betaflight/config PR: 792
File: configs/BEEROTORF4/config.h:30-30
Timestamp: 2025-05-28T15:42:05.402Z
Learning: The DEFAULT_GYRO_ENABLED macro with both gyros enabled (GYRO_MASK(0) | GYRO_MASK(1)) should only be added to board configurations that have DEFAULT_GYRO_TO_USE set to GYRO_CONFIG_USE_GYRO_BOTH. Boards without this setting should only get the GYRO_COUNT definition to specify the number of available gyros.

Learnt from: haslinghuis
Repo: betaflight/config PR: 656
File: configs/IFLIGHT_F745_AIO/config.h:31-35
Timestamp: 2025-07-28T16:44:59.686Z
Learning: In Betaflight board configurations, when a board design uses the same physical gyro socket but different sensor variants across production batches (e.g., MPU6000 in older batches, ICM42688P in newer batches), the correct approach is to enable both sensor drivers (USE_GYRO_SPI_MPU6000 and USE_GYRO_SPI_ICM42688P) in the same configuration. This allows runtime auto-detection of which sensor is actually present without requiring separate board configurations for each hardware variant.

Learnt from: haslinghuis
Repo: betaflight/config PR: 0
File: :0-0
Timestamp: 2025-12-30T20:09:11.644Z
Learning: For Betaflight board configuration reviews, maintainer information must be included in target submissions according to the Requirements for Submission of New and Updated Targets.

Learnt from: haslinghuis
Repo: betaflight/config PR: 0
File: :0-0
Timestamp: 2025-12-30T20:09:11.644Z
Learning: For Betaflight board configuration reviews, STM32 F4 and F7 based designs with more than 4 motor outputs are not accepted for new submissions after December 3, 2024. This is an official timeline restriction from the Config Target Guidance.

Learnt from: osirisinferi
Repo: betaflight/config PR: 0
File: :0-0
Timestamp: 2025-12-30T21:01:01.473Z
Learning: For Betaflight board configuration reviews, when blocking issues are identified after an initial approval, immediately dismiss/withdraw the approval by using `gh pr review <PR_NUMBER> --repo betaflight/config --request-changes --body "<reason>"` to change the review state to CHANGES_REQUESTED. This actively manages approval status to ensure it accurately reflects the current mergability state of the PR.

Learnt from: haslinghuis
Repo: betaflight/config PR: 0
File: :0-0
Timestamp: 2025-12-30T20:09:11.644Z
Learning: For Betaflight board configuration reviews, the manufacturer must be registered in the Manufacturers.md file. Always verify that the MANUFACTURER_ID in config.h has a corresponding entry in Manufacturers.md.

Learnt from: osirisinferi
Repo: betaflight/config PR: 0
File: :0-0
Timestamp: 2025-12-30T21:03:53.169Z
Learning: For Betaflight board configuration reviews, schematics are mandatory for the overall review process according to the Config Target Guidance, but they do NOT need to be provided publicly in the GitHub PR itself. Schematics review is conducted through a separate/private channel. Do not flag "missing schematics in PR" as a blocking issue.

Learnt from: haslinghuis
Repo: betaflight/config PR: 0
File: :0-0
Timestamp: 2025-12-30T20:09:11.644Z
Learning: For Betaflight board configuration reviews, schematics are mandatory for all new target submissions. Submissions without schematics for review should be rejected according to the Config Target Guidance.

@haslinghuis haslinghuis requested a review from ot0tot January 10, 2026 22:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants