Skip to content

Conversation

ot0tot
Copy link
Contributor

@ot0tot ot0tot commented Mar 19, 2025

Summary by CodeRabbit

  • New Features
    • Added support for the CRAZYBEE473 flight controller (STM32G47x).
    • Enables ICM42688P accelerometer/gyro, on-screen display, and onboard flash for Blackbox logging.
    • Preconfigured SmartAudio VTX control and CRSF as the default receiver protocol.
    • ADC-based voltage/current sensing with preset scales; I2C enabled for barometer/magnetometer.
    • Predefined motor/LED/camera mappings, inverted beeper, and DShot defaults optimized for the board.

Copy link
Member

@sugaarK sugaarK left a comment

Choose a reason for hiding this comment

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

can you adjust the voltage divider to 113? this in testing of the real hardware is what was needed to get the battery voltage to display correctly. the default of 110 produces very low readings

@githubDLG
Copy link

@ot0tot Hey man , please help to adjust voltage divider to 113 as @sugaarK said. Thanks!

Copy link
Contributor

coderabbitai bot commented Aug 13, 2025

Walkthrough

Adds a new Betaflight board configuration header for CRAZYBEE473 defining MCU (STM32G47X), board/manufacturer IDs, enabled peripherals (ICM42688P accel/gyro, M25P16 flash, MAX7456 OSD), comprehensive pin/timer mappings, bus instances, defaults (CRSF, SmartAudio, DShot, ADC meters) and gyro alignment.

Changes

Cohort / File(s) Summary of changes
New board config: CRAZYBEE473
configs/CRAZYBEE473/config.h
Introduces CRAZYBEE473 profile: sets FC_TARGET_MCU=STM32G47X, BOARD_NAME, MANUFACTURER_ID; enables USE_ACC/USE_GYRO with USE_ACC_SPI_ICM42688P/USE_GYRO_SPI_ICM42688P; enables USE_FLASH/USE_FLASH_M25P16, USE_MAX7456; defines beeper, motor, LED, camera, UART1–4, I2C1, SPI1/2/3, ADC, EXTI and CS pins; adds TIMER_PIN_MAPPING (6 entries) and ADC1_DMA_OPT=0; maps FLASH_SPI_INSTANCE=SPI1, MAX7456_SPI_INSTANCE=SPI2, GYRO_1_SPI_INSTANCE=SPI3, GYRO_1_ALIGN=CW180_DEG; configures VTX_SMARTAUDIO_UART=SERIAL_PORT_UART4, SERIALRX_UART=SERIAL_PORT_USART3, SERIALRX_PROVIDER=SERIALRX_CRSF, BARO_I2C_INSTANCE/MAG_I2C_INSTANCE=I2CDEV_1; sets DEFAULT_BLACKBOX_DEVICE=BLACKBOX_DEVICE_FLASH, DEFAULT_DSHOT_BURST=DSHOT_DMAR_OFF, DEFAULT_DSHOT_BITBANG=DSHOT_BITBANG_ON, DEFAULT_CURRENT_METER_SOURCE=CURRENT_METER_ADC, DEFAULT_VOLTAGE_METER_SOURCE=VOLTAGE_METER_ADC, meter scales 235/113, BEEPER_INVERTED, and SYSTEM_HSE_MHZ=8.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • Add SPEDIXG473 #719 — Adds a similar STM32G47X board profile with ICM42688P, M25P16 flash, MAX7456 OSD and comparable pin/timer and SPI instance mappings.
  • Add BROTHERHOBBYH743 #753 — Adds another board header with the same sensor/peripheral macros, SPI/UART/timer mappings and defaults.
  • add HDZERO_AIO15 #784 — Introduces a STM32G47X board config mirroring the same macros (ICM42688P over SPI, flash, MAX7456, DShot/ADC defaults).

Suggested reviewers

  • sugaarK
  • nerdCopter

Pre-merge checks (2 passed, 1 inconclusive)

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Description Check ❓ Inconclusive The PR description is minimal and only states the intent to add the CRAZYBEE473 target without the repository's required template fields, implementation details, test results, hardware tested, or justification for configuration values (for example the VBAT divider/scale discussion seen in comments is not captured in the PR body). Because no description_template was supplied for comparison and the current description is vague and incomplete, I cannot confirm it meets the repository's description requirements. Please update the PR body to follow the repository's description template and include a concise summary of changes, list of modified files (e.g., configs/CRAZYBEE473/config.h), hardware tested (unit counts and test methods), the VBAT divider/scale chosen and how it was measured, test steps and observed behavior, and any known issues or reviewer-requested deviations; attach logs or measurement artifacts if available before requesting final review.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title "Add CRAZYBEE473 target" is concise and directly reflects the primary change in the changeset (adding the CRAZYBEE473 board configuration and related macros/files), making the intent clear for reviewers and for history scanning.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.

Poem

I twitch my ears at G47X’s tune,
New pads and pins beneath the moon.
Gyro set to spin CW180,
Flash keeps tales of every flight.
Tiny CrazyBee, take to night. 🐇✨

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.

✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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 haslinghuis requested a review from sugaarK August 13, 2025 18:21
@ot0tot
Copy link
Contributor Author

ot0tot commented Aug 14, 2025

The difference between 110 and 113 is very small, and depends on the tolerance of the resistors used for the Vbat voltage divider. Let's check a few more FCs and see what the average value is.

@ot0tot ot0tot marked this pull request as ready for review August 31, 2025 03:56
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 (3)
configs/CRAZYBEE473/config.h (3)

65-71: ADC/Gyro lines look plausible; double-check EXTI and CS wiring

PB0/PB1 for VBAT/CURR and PA8 as GYRO_1_EXTI are typical. Ensure PC13 is actually the gyro CS on the PCB and that EXTI on PA8 is wired to the gyro INT pin.

If available, drop a brief comment indicating the gyro INT polarity (active-high/low) observed on this board.


89-94: DSHOT defaults and meter scales

  • DSHOT_DMAR_OFF and BITBANG_ON: OK for small G4 AIOs; verify CPU load at 48k/96k with OSD+logging.
  • DEFAULT_VOLTAGE_METER_SCALE 113 matches reviewer guidance; thanks for aligning.
  • CURRENT_METER_SCALE 235 is plausible; confirm with a sample board.

If you have 2–3 sample boards, consider providing average + variance for VBAT and current scales in the PR description for future maintainers.


100-100: Verify gyro alignment CW180_DEG against the physical orientation

Please confirm the silkscreen/arrow orientation vs Betaflight frame axes on the shipped board. A mismatch here is user-visible and painful.

Add a one-line comment noting the sensor’s top-mark/arrow orientation to justify CW180_DEG.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 0f78778 and 37fd172.

📒 Files selected for processing (1)
  • configs/CRAZYBEE473/config.h (1 hunks)
🧰 Additional context used
🧠 Learnings (12)
📓 Common learnings
Learnt from: haslinghuis
PR: betaflight/config#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.
Learnt from: ot0tot
PR: betaflight/config#872
File: configs/HGLRCH743/config.h:82-83
Timestamp: 2025-08-20T02:54:58.596Z
Learning: For Betaflight board configuration reviews, the definitive source for validating UART pin assignments is the serial_uart_{platform}.c file in the Betaflight codebase (e.g., serial_uart_stm32h7xx.c for STM32H7xx platforms), not generic MCU datasheets. These files contain the exact pin mappings that Betaflight supports for each UART peripheral.
Learnt from: ot0tot
PR: betaflight/config#0
File: :0-0
Timestamp: 2025-07-03T04:33:57.480Z
Learning: Always verify that the BOARD_NAME define in each config.h matches the directory name it resides in (e.g., configs/AXISFLYINGF7AIO/config.h must have #define BOARD_NAME AXISFLYINGF7AIO). This check is required for all Betaflight board configuration reviews.
Learnt from: haslinghuis
PR: betaflight/config#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: ot0tot
PR: betaflight/config#0
File: :0-0
Timestamp: 2025-07-03T04:33:57.480Z
Learning: Always verify that the `BOARD_NAME` define in config.h files exactly matches the directory name where the config file is located. For example, if the config file is in configs/AXISFLYINGF7AIO/config.h, then the BOARD_NAME should be defined as "AXISFLYINGF7AIO". This ensures proper board identification and configuration loading in Betaflight.
Learnt from: haslinghuis
PR: betaflight/config#822
File: configs/AXISFLYINGH7MINI/config.h:29-37
Timestamp: 2025-06-23T18:43:31.746Z
Learning: In Betaflight configuration files, feature enablement macros like USE_MAG are build options that can be controlled at compile time, while hardware instance definitions like MAG_I2C_INSTANCE are predefined in board configurations to assist with hardware mapping when those features are enabled at build time.
Learnt from: haslinghuis
PR: betaflight/config#879
File: configs/AIRBOTSUPERF4V2/config.h:42-45
Timestamp: 2025-08-22T17:08:23.283Z
Learning: In Betaflight board configurations, OSD feature flags like USE_OSD_SD (analog/MAX7456) and USE_OSD_HD (digital/MSP DisplayPort) are typically defined at build time by the build system, not in the individual board config.h files. Board configs can conditionally define OSD-related settings based on these build-time flags.
Learnt from: haslinghuis
PR: betaflight/config#835
File: configs/HDZERO_HALO_MPU6000/config.h:29-35
Timestamp: 2025-07-14T16:16:50.628Z
Learning: CW0_DEG is not a universal default gyro alignment setting in Betaflight configurations. Different boards use different gyro alignments (CW0_DEG, CW90_DEG, CW180_DEG, CW270_DEG, CW0_DEG_FLIP, etc.) based on their physical sensor mounting orientation.
Learnt from: haslinghuis
PR: betaflight/config#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.
Learnt from: ot0tot
PR: betaflight/config#681
File: configs/NYX405V1/config.h:26-28
Timestamp: 2025-07-14T15:47:16.394Z
Learning: In Betaflight configuration files, MANUFACTURER_ID values must be exactly 4 ASCII characters long, not 3 characters. All manufacturer IDs in the codebase consistently use 4-character identifiers like AIRB, FOSS, SPBE, MTKS, NERC, etc.
📚 Learning: 2025-07-14T16:16:56.822Z
Learnt from: haslinghuis
PR: betaflight/config#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/CRAZYBEE473/config.h
📚 Learning: 2025-07-03T04:33:57.480Z
Learnt from: ot0tot
PR: betaflight/config#0
File: :0-0
Timestamp: 2025-07-03T04:33:57.480Z
Learning: Always verify that the BOARD_NAME define in each config.h matches the directory name it resides in (e.g., configs/AXISFLYINGF7AIO/config.h must have #define BOARD_NAME AXISFLYINGF7AIO). This check is required for all Betaflight board configuration reviews.

Applied to files:

  • configs/CRAZYBEE473/config.h
📚 Learning: 2025-07-03T04:33:57.480Z
Learnt from: ot0tot
PR: betaflight/config#0
File: :0-0
Timestamp: 2025-07-03T04:33:57.480Z
Learning: Always verify that the `BOARD_NAME` define in config.h files exactly matches the directory name where the config file is located. For example, if the config file is in configs/AXISFLYINGF7AIO/config.h, then the BOARD_NAME should be defined as "AXISFLYINGF7AIO". This ensures proper board identification and configuration loading in Betaflight.

Applied to files:

  • configs/CRAZYBEE473/config.h
📚 Learning: 2025-06-23T18:43:31.746Z
Learnt from: haslinghuis
PR: betaflight/config#822
File: configs/AXISFLYINGH7MINI/config.h:29-37
Timestamp: 2025-06-23T18:43:31.746Z
Learning: In Betaflight configuration files, feature enablement macros like USE_MAG are build options that can be controlled at compile time, while hardware instance definitions like MAG_I2C_INSTANCE are predefined in board configurations to assist with hardware mapping when those features are enabled at build time.

Applied to files:

  • configs/CRAZYBEE473/config.h
📚 Learning: 2025-08-22T17:08:23.283Z
Learnt from: haslinghuis
PR: betaflight/config#879
File: configs/AIRBOTSUPERF4V2/config.h:42-45
Timestamp: 2025-08-22T17:08:23.283Z
Learning: In Betaflight board configurations, OSD feature flags like USE_OSD_SD (analog/MAX7456) and USE_OSD_HD (digital/MSP DisplayPort) are typically defined at build time by the build system, not in the individual board config.h files. Board configs can conditionally define OSD-related settings based on these build-time flags.

Applied to files:

  • configs/CRAZYBEE473/config.h
📚 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/CRAZYBEE473/config.h
📚 Learning: 2025-08-20T02:54:58.596Z
Learnt from: ot0tot
PR: betaflight/config#872
File: configs/HGLRCH743/config.h:82-83
Timestamp: 2025-08-20T02:54:58.596Z
Learning: For Betaflight board configuration reviews, the definitive source for validating UART pin assignments is the serial_uart_{platform}.c file in the Betaflight codebase (e.g., serial_uart_stm32h7xx.c for STM32H7xx platforms), not generic MCU datasheets. These files contain the exact pin mappings that Betaflight supports for each UART peripheral.

Applied to files:

  • configs/CRAZYBEE473/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/CRAZYBEE473/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/CRAZYBEE473/config.h
📚 Learning: 2025-07-23T13:43:50.456Z
Learnt from: ot0tot
PR: betaflight/config#0
File: :0-0
Timestamp: 2025-07-23T13:43:50.456Z
Learning: For Betaflight board configuration reviews, always verify that serial port defines (like ESC_SENSOR_UART, MSP_UART, GPS_UART, etc.) use valid SERIAL_PORT identifiers that match those defined in the Betaflight codebase at src/main/io/serial.h. Common valid identifiers include SERIAL_PORT_USART1, SERIAL_PORT_USART2, SERIAL_PORT_USART3, SERIAL_PORT_UART4, SERIAL_PORT_UART5, etc. Invalid identifiers like SERIAL_PORT_UART3 (should be SERIAL_PORT_USART3) will cause build failures.

Applied to files:

  • configs/CRAZYBEE473/config.h
📚 Learning: 2025-07-23T13:43:50.456Z
Learnt from: ot0tot
PR: betaflight/config#0
File: :0-0
Timestamp: 2025-07-23T13:43:50.456Z
Learning: For Betaflight board configuration reviews, always verify that serial port defines use valid identifiers from the serialPortIdentifier_e enum in src/main/io/serial.h. Valid identifiers include: SERIAL_PORT_USB_VCP (20), SERIAL_PORT_SOFTSERIAL1 (30), SERIAL_PORT_SOFTSERIAL2 (31), SERIAL_PORT_LPUART1 (40), SERIAL_PORT_UART0 (50, if SERIAL_UART_FIRST_INDEX == 0), SERIAL_PORT_USART1 (51 or 50), SERIAL_PORT_USART2, SERIAL_PORT_USART3, SERIAL_PORT_UART4, SERIAL_PORT_UART5, SERIAL_PORT_USART6, SERIAL_PORT_USART7, SERIAL_PORT_USART8, SERIAL_PORT_UART9, SERIAL_PORT_USART10. While some aliases exist (like SERIAL_PORT_UART3 = SERIAL_PORT_USART3), prefer using the primary identifiers as referenced in the serialPortIdentifiers array to avoid build failures.

Applied to files:

  • configs/CRAZYBEE473/config.h
🔇 Additional comments (8)
configs/CRAZYBEE473/config.h (8)

26-28: Board name and manufacturer ID look correct

BOARD_NAME matches the directory and MANUFACTURER_ID is 4 ASCII chars. LGTM.


29-36: Driver feature set looks consistent with the hardware

USE_{ACC,GYRO} with ICM42688P, FLASH M25P16, and MAX7456 is a sensible baseline. No issues from me.


82-84: Serial defaults: identifiers look valid

VTX on SERIAL_PORT_UART4 and RX on SERIAL_PORT_USART3 match Betaflight’s identifiers. Looks good.

If the VTX is SmartAudio 2.1+, confirm UART inversion not required on this board’s level shifter.


85-88: I2C instance placeholders are fine even if baro/mag are build-time optional

This aligns with guidance that hardware instance defines can exist without enabling the feature in this file.


95-100: Misc: Beeper invert, HSE=8 MHz, and SPI instances

All three are standard choices. No action needed.


44-51: Confirm USART2 PA14/PA15 mapping and SWD trade-off
PA14/PA15 map to USART2 in Betaflight’s STM32G4 driver but disable SWD (PA14=SWCLK). Ensure DFU-only USB flashing is acceptable or select alternate USART2 pins as defined in serial_uart_stm32g4xx.c.


72-79: Correct TIMER_PIN_MAPPING entries

  • Motors: PA1 is TIM2_CH2 (channel 2) and PA0 is TIM2_CH1 (channel 1), not vice versa.
  • LED strip on PB9 cannot use TIM3; valid mappings are TIM8_CH3 (timer index 7, channel 3) or TIM17_CH1 (index 10, channel 1).
  • Camera control on PB2 cannot use TIM2; choose TIM5_CH1 (index 4, channel 1) or TIM20_CH1 (index 11, channel 1) and update the mapping.
⛔ Skipped due to learnings
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: 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#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#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
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.

56-64: SPI3 PB3/PB4/PB5 — AF mapping verified

Confirmed: src/platform/common/stm32/bus_spi_pinconfig.c lists PB3/PB4/PB5 as valid SPI3 SCK/MISO/MOSI entries (GPIO_AF6_SPI3 / GPIO_MUX_6). They overlap JTAG on some packages—verify JTAG usage on this board before shipping.

@ot0tot
Copy link
Contributor Author

ot0tot commented Aug 31, 2025

My FC tests with a voltage scale closer to 135, but the response is non-linear and seems quite slow. Will follow-up in the manufacturer channel.

@sugaarK
Copy link
Member

sugaarK commented Aug 31, 2025

@ot0tot Hey man , please help to adjust voltage divider to 113 as @sugaarK said. Thanks!

Did you check a few others? It was way off on my example

@ot0tot
Copy link
Contributor Author

ot0tot commented Aug 31, 2025

I only have one FC.

@haslinghuis
Copy link
Member

@coderabbitai full review

Copy link
Contributor

coderabbitai bot commented Sep 11, 2025

✅ Actions performed

Full review triggered.

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/CRAZYBEE473/config.h (1)

89-91: DSHOT defaults are conservative.

DMAR off + bitbang on is safe; revisit after timer/DMA confirmation.

If no DMA conflicts are found, enabling DSHOT DMA can reduce CPU usage.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0f78778 and 37fd172.

📒 Files selected for processing (1)
  • configs/CRAZYBEE473/config.h (1 hunks)
🧰 Additional context used
🧠 Learnings (12)
📓 Common learnings
Learnt from: haslinghuis
PR: betaflight/config#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.
Learnt from: ot0tot
PR: betaflight/config#872
File: configs/HGLRCH743/config.h:82-83
Timestamp: 2025-08-20T02:54:58.596Z
Learning: For Betaflight board configuration reviews, the definitive source for validating UART pin assignments is the serial_uart_{platform}.c file in the Betaflight codebase (e.g., serial_uart_stm32h7xx.c for STM32H7xx platforms), not generic MCU datasheets. These files contain the exact pin mappings that Betaflight supports for each UART peripheral.
Learnt from: ot0tot
PR: betaflight/config#0
File: :0-0
Timestamp: 2025-07-03T04:33:57.480Z
Learning: Always verify that the BOARD_NAME define in each config.h matches the directory name it resides in (e.g., configs/AXISFLYINGF7AIO/config.h must have #define BOARD_NAME AXISFLYINGF7AIO). This check is required for all Betaflight board configuration reviews.
Learnt from: haslinghuis
PR: betaflight/config#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
PR: betaflight/config#879
File: configs/AIRBOTSUPERF4V2/config.h:42-45
Timestamp: 2025-08-22T17:08:23.283Z
Learning: In Betaflight board configurations, OSD feature flags like USE_OSD_SD (analog/MAX7456) and USE_OSD_HD (digital/MSP DisplayPort) are typically defined at build time by the build system, not in the individual board config.h files. Board configs can conditionally define OSD-related settings based on these build-time flags.
Learnt from: ot0tot
PR: betaflight/config#0
File: :0-0
Timestamp: 2025-07-03T04:33:57.480Z
Learning: Always verify that the `BOARD_NAME` define in config.h files exactly matches the directory name where the config file is located. For example, if the config file is in configs/AXISFLYINGF7AIO/config.h, then the BOARD_NAME should be defined as "AXISFLYINGF7AIO". This ensures proper board identification and configuration loading in Betaflight.
Learnt from: haslinghuis
PR: betaflight/config#822
File: configs/AXISFLYINGH7MINI/config.h:29-37
Timestamp: 2025-06-23T18:43:31.746Z
Learning: In Betaflight configuration files, feature enablement macros like USE_MAG are build options that can be controlled at compile time, while hardware instance definitions like MAG_I2C_INSTANCE are predefined in board configurations to assist with hardware mapping when those features are enabled at build time.
Learnt from: haslinghuis
PR: betaflight/config#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.
Learnt from: haslinghuis
PR: betaflight/config#835
File: configs/HDZERO_HALO_MPU6000/config.h:29-35
Timestamp: 2025-07-14T16:16:50.628Z
Learning: CW0_DEG is not a universal default gyro alignment setting in Betaflight configurations. Different boards use different gyro alignments (CW0_DEG, CW90_DEG, CW180_DEG, CW270_DEG, CW0_DEG_FLIP, etc.) based on their physical sensor mounting orientation.
Learnt from: haslinghuis
PR: betaflight/config#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.
📚 Learning: 2025-07-14T16:16:56.822Z
Learnt from: haslinghuis
PR: betaflight/config#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/CRAZYBEE473/config.h
📚 Learning: 2025-07-03T04:33:57.480Z
Learnt from: ot0tot
PR: betaflight/config#0
File: :0-0
Timestamp: 2025-07-03T04:33:57.480Z
Learning: Always verify that the BOARD_NAME define in each config.h matches the directory name it resides in (e.g., configs/AXISFLYINGF7AIO/config.h must have #define BOARD_NAME AXISFLYINGF7AIO). This check is required for all Betaflight board configuration reviews.

Applied to files:

  • configs/CRAZYBEE473/config.h
📚 Learning: 2025-07-03T04:33:57.480Z
Learnt from: ot0tot
PR: betaflight/config#0
File: :0-0
Timestamp: 2025-07-03T04:33:57.480Z
Learning: Always verify that the `BOARD_NAME` define in config.h files exactly matches the directory name where the config file is located. For example, if the config file is in configs/AXISFLYINGF7AIO/config.h, then the BOARD_NAME should be defined as "AXISFLYINGF7AIO". This ensures proper board identification and configuration loading in Betaflight.

Applied to files:

  • configs/CRAZYBEE473/config.h
📚 Learning: 2025-06-23T18:43:31.746Z
Learnt from: haslinghuis
PR: betaflight/config#822
File: configs/AXISFLYINGH7MINI/config.h:29-37
Timestamp: 2025-06-23T18:43:31.746Z
Learning: In Betaflight configuration files, feature enablement macros like USE_MAG are build options that can be controlled at compile time, while hardware instance definitions like MAG_I2C_INSTANCE are predefined in board configurations to assist with hardware mapping when those features are enabled at build time.

Applied to files:

  • configs/CRAZYBEE473/config.h
📚 Learning: 2025-08-22T17:08:23.283Z
Learnt from: haslinghuis
PR: betaflight/config#879
File: configs/AIRBOTSUPERF4V2/config.h:42-45
Timestamp: 2025-08-22T17:08:23.283Z
Learning: In Betaflight board configurations, OSD feature flags like USE_OSD_SD (analog/MAX7456) and USE_OSD_HD (digital/MSP DisplayPort) are typically defined at build time by the build system, not in the individual board config.h files. Board configs can conditionally define OSD-related settings based on these build-time flags.

Applied to files:

  • configs/CRAZYBEE473/config.h
📚 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/CRAZYBEE473/config.h
📚 Learning: 2025-08-20T02:54:58.596Z
Learnt from: ot0tot
PR: betaflight/config#872
File: configs/HGLRCH743/config.h:82-83
Timestamp: 2025-08-20T02:54:58.596Z
Learning: For Betaflight board configuration reviews, the definitive source for validating UART pin assignments is the serial_uart_{platform}.c file in the Betaflight codebase (e.g., serial_uart_stm32h7xx.c for STM32H7xx platforms), not generic MCU datasheets. These files contain the exact pin mappings that Betaflight supports for each UART peripheral.

Applied to files:

  • configs/CRAZYBEE473/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/CRAZYBEE473/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/CRAZYBEE473/config.h
📚 Learning: 2025-07-23T13:43:50.456Z
Learnt from: ot0tot
PR: betaflight/config#0
File: :0-0
Timestamp: 2025-07-23T13:43:50.456Z
Learning: For Betaflight board configuration reviews, always verify that serial port defines (like ESC_SENSOR_UART, MSP_UART, GPS_UART, etc.) use valid SERIAL_PORT identifiers that match those defined in the Betaflight codebase at src/main/io/serial.h. Common valid identifiers include SERIAL_PORT_USART1, SERIAL_PORT_USART2, SERIAL_PORT_USART3, SERIAL_PORT_UART4, SERIAL_PORT_UART5, etc. Invalid identifiers like SERIAL_PORT_UART3 (should be SERIAL_PORT_USART3) will cause build failures.

Applied to files:

  • configs/CRAZYBEE473/config.h
📚 Learning: 2025-07-23T13:43:50.456Z
Learnt from: ot0tot
PR: betaflight/config#0
File: :0-0
Timestamp: 2025-07-23T13:43:50.456Z
Learning: For Betaflight board configuration reviews, always verify that serial port defines use valid identifiers from the serialPortIdentifier_e enum in src/main/io/serial.h. Valid identifiers include: SERIAL_PORT_USB_VCP (20), SERIAL_PORT_SOFTSERIAL1 (30), SERIAL_PORT_SOFTSERIAL2 (31), SERIAL_PORT_LPUART1 (40), SERIAL_PORT_UART0 (50, if SERIAL_UART_FIRST_INDEX == 0), SERIAL_PORT_USART1 (51 or 50), SERIAL_PORT_USART2, SERIAL_PORT_USART3, SERIAL_PORT_UART4, SERIAL_PORT_UART5, SERIAL_PORT_USART6, SERIAL_PORT_USART7, SERIAL_PORT_USART8, SERIAL_PORT_UART9, SERIAL_PORT_USART10. While some aliases exist (like SERIAL_PORT_UART3 = SERIAL_PORT_USART3), prefer using the primary identifiers as referenced in the serialPortIdentifiers array to avoid build failures.

Applied to files:

  • configs/CRAZYBEE473/config.h
🔇 Additional comments (15)
configs/CRAZYBEE473/config.h (15)

26-27: BOARD_NAME matches directory — good.

BOARD_NAME=CRAZYBEE473 matches configs/CRAZYBEE473/.


24-24: MCU family selection looks correct.

STM32G47X aligns with a G473 target.


29-36: Sensor/flash/OSD feature set is reasonable.

ICM42688P over SPI plus M25P16 and MAX7456 are consistent.


56-64: SPI bus/pins are standard.

SPI1 (Flash) PA5/6/7, SPI2 (MAX7456) PB13/14/15, SPI3 (Gyro) PB3/4/5 look correct.


65-67: ADC pins OK.

VBAT=PB0, CURR=PB1 are conventional on G4.


68-71: Gyro INT/CS and MAX7456 CS plausible.

PA8 as EXTI and PC13 as CS are commonly used; just ensure EXTI routing is wired as in hardware.

Can you confirm the gyro INT is physically on PA8 and that PC13 drive strength is sufficient for CS on this board?


82-84: Serial port identifiers are valid.

SERIAL_PORT_UART4 and SERIAL_PORT_USART3 align with serial.h identifiers.


85-88: I2C instances defined without forcing features — OK.

BARO/MAG instances are harmless defaults and only used when features are enabled at build time.


93-94: VBAT/CURR scales: VBAT=113 aligns with reviewer request.

This matches the requested divider; current scale 235 is a reasonable starting point.

Please confirm with a multimeter under load; tweak via CLI if needed.


96-96: Confirm HSE frequency.

Ensure the board actually uses an 8 MHz crystal; 16 MHz is also common on G4. A mismatch skews all clocks.

If uncertain, please check the BOM/schematic or measure HSE with an oscilloscope.


97-100: SPI instance selections make sense.

MAX7456 on SPI2, Flash on SPI1, Gyro on SPI3 minimize bus contention.


100-100: Verify gyro alignment.

CW180_DEG must match the sensor’s physical orientation.

A quick hover test (axis sanity and level mode) can confirm; adjust if axes are inverted/rotated.


27-27: Manufacturer ID OK — consistent with other Crazybee/Happymodel boards.

HAMO is used in configs/CRAZYBEE473/config.h and multiple other Crazybee configs and is a valid 4-character MANUFACTURER_ID; no change required.


72-79: Validate TIMER_PIN_MAPPING against STM32G4 timer sources (manual check required).

  • Script couldn't find the G4 timer mapping file in src (only configs were returned). Manually confirm PA0..PA3 → TIM2 CH1–CH4 and that the indices in configs/CRAZYBEE473/config.h (lines 72–79) match the platform timer definitions (e.g. src/platform/STM32/timer_stm32g4xx.c or equivalent).
  • Verify PB9 and PB2 timer/channel assignments and whether those timers/DMA conflict with SPI/DSHOT (LED_STRIP vs blackbox). If they conflict, reassign pins/timers or keep/adjust DSHOT DMA accordingly.

44-51: ```shell
#!/bin/bash
set -euo pipefail

echo "PWD: $(pwd)"
echo "Top-level entries:"
ls -la

echo
echo "Find files with 'serial_uart' in the name:"
fd --hidden --no-ignore -g 'serial_uart*' || true

echo
echo "Search for any occurrences of 'serial_uart' (files + lines):"
rg -n --hidden --no-ignore -S 'serial_uart' || true

echo
echo "Search repo for USART2 / UART2 / PA14 / PA15 / PB3 / SWCLK / SWD / JTAG / JTDO / SWO (with context):"
rg -n --hidden --no-ignore -S -C3 '\bUSART2\b|\bUART2\b|PA14|PA15|PB3|SWCLK|SWD|JTAG|JTDO|SWO' || true

echo
echo "Show matches for PA14 or PA15 specifically:"
rg -n --hidden --no-ignore -S -C3 '\bPA14\b|\bPA15\b' || true

echo
echo "If present, list STM32 platform folder contents:"
if [ -d src/platform/STM32 ]; then
ls -la src/platform/STM32 || true
fi

echo
echo "Done."


</blockquote></details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->

@haslinghuis haslinghuis merged commit 09e80da into betaflight:master Sep 12, 2025
2 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Sep 16, 2025
@ot0tot ot0tot deleted the HMG473 branch September 16, 2025 19:13
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.

5 participants