-
Notifications
You must be signed in to change notification settings - Fork 191
Add SPEEDYBEEF435AIOELRS #895
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
WalkthroughAdds a new Betaflight board config header for SPEEDYBEEF435AIOELRS: declares MCU/board IDs, enables sensors/peripherals (ICM42688P, DPS310, W25Q128FV), maps SPI/I2C/UART/ADC/timer pins, and sets blackbox, DSHOT, ADC/current/voltage defaults. Changes
Sequence Diagram(s)(omitted — changes are a static hardware configuration header; no runtime control-flow change) Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Pre-merge checks (2 passed, 1 warning)❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
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.
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. 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. Comment |
There was a problem hiding this 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/SPEEDYBEEF435AIOELRS/config.h (1)
54-56
: I2C2 on PH2/PH3: check alternate-function overlap with UART4.AT32F435 often supports UART4 on PH2/PH3; your config uses them for I2C2, which is fine but precludes UART4 on those pins. Consider adding a note to prevent later conflicts.
Apply:
#define I2C2_SCL_PIN PH2 #define I2C2_SDA_PIN PH3 +// NOTE: PH2/PH3 are used for I2C2; on AT32F435 these pins can also map to UART4. +// This target reserves them for I2C; UART4 on PH2/PH3 is not available.
📜 Review details
Configuration used: Path: .coderabbit.yaml
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.
📒 Files selected for processing (1)
configs/SPEEDYBEEF435AIOELRS/config.h
(1 hunks)
🧰 Additional context used
🧠 Learnings (11)
📓 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: 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.
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#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#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: 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#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.
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.
📚 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/SPEEDYBEEF435AIOELRS/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/SPEEDYBEEF435AIOELRS/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/SPEEDYBEEF435AIOELRS/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/SPEEDYBEEF435AIOELRS/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/SPEEDYBEEF435AIOELRS/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/SPEEDYBEEF435AIOELRS/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/SPEEDYBEEF435AIOELRS/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/SPEEDYBEEF435AIOELRS/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/SPEEDYBEEF435AIOELRS/config.h
📚 Learning: 2025-08-26T14:26:11.863Z
Learnt from: haslinghuis
PR: betaflight/config#883
File: configs/HGLRCF435_AIO/config.h:50-58
Timestamp: 2025-08-26T14:26:11.863Z
Learning: For AT32F435 in Betaflight, UART4 supports multiple pin options including PH2 (UART4_RX) and PH3 (UART4_TX) with GPIO_MUX_8, as confirmed in the official Betaflight codebase at src/platform/AT32/serial_uart_at32f43x.c. The AT32 platform has broader pin support than initially apparent from basic searches.
Applied to files:
configs/SPEEDYBEEF435AIOELRS/config.h
🔇 Additional comments (12)
configs/SPEEDYBEEF435AIOELRS/config.h (12)
26-28
: BOARD_NAME and MANUFACTURER_ID look correct.
- BOARD_NAME matches directory.
- MANUFACTURER_ID is 4 chars (SPBE).
29-37
: Confirm barometer presence (DPS310).Many AIO ELRS boards ship without a baro. If DPS310 isn’t physically present, drop USE_BARO/USE_BARO_DPS310 to avoid probing overhead.
39-43
: Motor pad pins: verify timer suitability.PB6/PB7/PB0/PB1 are plausible, but please confirm their timer channels align with TIMER_PIN_MAPPING entries below for proper DSHOT+DMA.
57-63
: SPI1 + gyro lines look standard; verify PA15 for EXTI.PA15 as GYRO_1_EXTI_PIN is common; just confirm the INT line is indeed on PA15 on production boards.
64-68
: Flash on SPI2 with CS=PC13: confirm electrical suitability.PC13 (low-drive, slower slew on many MCUs) is usually OK for CS, but please confirm signal integrity with W25Q128 at your SPI clock.
69-74
: ADC/VBAT/current and beeper/LED pins: LGTM.PA0/PA1 for ADCs and beeper inversion match common designs.
89-94
: I2C instances and gyro/flash instances: LGTM.I2CDEV_2 for BARO/MAG and SPI1/SPI2 instances are consistent with the pin defines.
95-101
: Defaults: blackbox/DSHOT/meter sources look fine; confirm current scale.800 is plausible but board-specific. Please confirm shunt value and amplifier gain.
102-103
: SERIALRX_UART port mapping verified
UART5_RX_PIN is PB8 and UART5_TX_PIN is PB9, matching SERIALRX_UART = SERIAL_PORT_UART5.
44-53
: Verify AT32F43x UART pin assignments
- UART1 (PA9/PA10) is standard.
- UART2 RX-only on PA3 – ensure this is intentional.
- UART5 (PB9/PB8) and UART7 (PB4/PB3) – confirm these pairs are supported by the AT32F43x UART implementation (
src/platform/AT32/serial_uart_at32f43x.c
in the main Betaflight repo).- Verify that SERIAL_PORT_UART5 and SERIAL_PORT_UART7 identifiers exist in the
serial_port_identifier_e
enum (src/main/io/serial.h
in the main Betaflight repo).
84-87
: Verify ADC1_DMA_OPT mapping
I couldn’t locate the DMA option lookup table in this repository; please confirm that setting ADC1_DMA_OPT to 11 is valid for ADC1 on the AT32F435 per the Betaflight DMA reference.
75-83
: Verify timer channels, DMA resources and GYRO_1_CLKIN mapping (manual check required)Could not locate AT32 timer/DMA hardware tables in the repo to fully verify; manual confirmation required:
- Confirm MOTOR1–4 assignments in configs/SPEEDYBEEF435AIOELRS/config.h (TIMER_PIN_MAP around lines 75–83) — motors use timer indices 1 and 2. Ensure those timer/DMA streams do not conflict with LED_STRIP (TIMER_PIN_MAP entry for LED_STRIP_PIN -> timer 1 ch6) or SPI2 (SPI2_SCK PB13 / SPI2_SDI PB14) DMA usage.
- Confirm LED_STRIP timer/channel choice uses a DMA stream separate from SPI2/blackbox SPI so LED updates won’t steal SPI DMA.
- Confirm GYRO_1_CLKIN_PIN (PA2, defined in the same config) is mapped to a timer channel that supports external clock / input-capture on the target AT32 MCU.
If you want automated validation, point me to the platform timer table (timer_*.c or src/platform/AT32/ timer files) and I will re-run checks.
691f662
to
1203f06
Compare
#define DEFAULT_CURRENT_METER_SCALE 215 | ||
#define DEFAULT_CURRENT_METER_OFFSET -12390 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, these values do not make sense based on the schematic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I confirmed the schematic with our hardware, and the load resistor values differ from those during the review. The value changed from 75K to 100K, and we are using 100K in our production version. So I delete DEFAULT_CURRENT_METER_OFFSET and change DEFAULT_CURRENT_METER_SCALE to 250.
Below is our calculation process:
INA139NA Output Voltage (V_out):
- R_shunt = 0.25 mΩ = 0.00025 Ω (two 0.5 mΩ resistors in parallel equal 0.25 mΩ)
- INA139NA gain G = R34 / 1 kΩ = 100 kΩ / 1 kΩ = 100
- V_shunt = I_sense × R_shunt = I_sense × 0.00025
- V_out = G × V_shunt = 100 × (I_sense × 0.00025) = 0.025× I_sense (unit: V, if I_sense is in A)
Betaflight Current Calculation Formula:
Current(Amps) = (ADC (mV) / amperage_meter_scale * 10) + (amperage_meter_offset / 1000)
When amperage_meter_offset = 0:
Current(Amps) = ADC (mV) / amperage_meter_scale * 10
Therefore,
amperage_meter_scale = (ADC (mV) * 10) / Current(Amps)
Relationship between ADC Value and V_out:
ADC (mV) = V_out × 1000 = 0.025× I_sense × 1000 = 25 × I_sense (mV)
Substitute into the formula:
amperage_meter_scale = (ADC (mV) * 10) / Current(Amps)
= (25 × I_sense) * 10 / I_sense
= 250
@kedeng PC15 is defined as |
The original design was to switch to external ELRS through PC15. But the updated version has removed external ELRS support, therefore this pin is no longer used. |
…SCALE to match the theoretical value
Summary by CodeRabbit