Betaflight flight control version 4.5 configuration file adjustment
- 1. Origin
- 2. Comparison
-
- 2.1 Manufacturer definition
- 2.2 Resource definition
-
- 2.2.1 CPU selection
- 2.2.2 Pin definition
- 2.2.3 IMU chip
- 2.2.4 Barometer chip
- 2.2.5 Memory chip
- 2.2.6 OSD chip
- 2.2.7 ADC DMA
- 2.2.8 Timer pin
- 2.3 Configuration definition
-
- 2.3.1 GYRO
- 2.3.2mag
- 2.3.3 baro
- 2.3.4 blackbox
- 2.3.5 ADC
- 2.3.6 beep
- 2.3.7 pinio
- 2.4 No corresponding definition
- 3. Predefined
-
- 3.1 Serial Configuration
- 3.2 Serial Receiver Provider
- 4. References
1. Origin
Since the concept of abstract hardware configuration files was introduced in BF4.0, there has been a long period of mixed existence of the target’s original target board configuration and abstract hardware configuration files.
After the AT32 chip is ported to BF code in 2022, the abstract hardware configuration file has undergone another update iteration (at the same time, the demand for ROM used by this method will be reduced).
After confirmation, the next BF4.5 version will use an iteratively updated abstract hardware configuration file method to describe the hardware.
- support AT32 unified-targets #1158
- How to Create a Flight Controller Configuration File for Betaflight 4.5
2. Comparison
This time we will conduct a comparative analysis on AOCODARC H7Dual and give differentiated explanations.
2.1 Manufacturer definition
- BF4.0 abstract unified configuration file
board_name AOCODARCH7DUAL manufacturer_id SJET
- BF4.5 abstract unified configuration file
#define BOARD_NAME AOCODARCH7DUAL #define MANUFACTURER_ID SJET
2.2 Resource Definition
2.2.1 CPU selection
- BF4.0 abstract unified configuration file
# Betaflight / STM32H743 (SH74) 4.3.0 Feb 1 2022 / 20:15:46 (3267f0417) MSP API: 1.44
- BF4.5 abstract unified configuration file
#define FC_TARGET_MCU STM32H743
2.2.2 Pin definition
- BF4.0 abstract unified configuration file
resource BEEPER 1 A15 resource MOTOR 1 B00 resource MOTOR 2 B01 resource MOTOR 3 A00 resource MOTOR 4 A01 resource MOTOR 5 A02 resource MOTOR 6 A03 resource MOTOR 7 D12 resource MOTOR 8 D13 resource SERVO 1 E05 resource SERVO 2 E06 resource PPM 1 A10 resource LED_STRIP 1 A08 resource SERIAL_TX 1 A09 resource SERIAL_TX 2 D05 resource SERIAL_TX 3 D08 resource SERIAL_TX 4 B09 resource SERIAL_TX 6 C06 resource SERIAL_TX 7 E08 resource SERIAL_TX 8 E01 resource SERIAL_RX 1 A10 resource SERIAL_RX 2 D06 resource SERIAL_RX 3 D09 resource SERIAL_RX 4 B08 resource SERIAL_RX 6 C07 resource SERIAL_RX 7 E07 resource SERIAL_RX 8 E00 resource I2C_SCL 1 B06 resource I2C_SCL 2 B10 resource I2C_SDA 1 B07 resource I2C_SDA 2 B11 resource LED 1 E03 resource LED 2 E04 resource SPI_SCK 1 A05 resource SPI_SCK 2 B13 resource SPI_SCK 3 B03 resource SPI_SCK 4 E12 resource SPI_MISO 1 A06 resource SPI_MISO 2 B14 resource SPI_MISO 3 B04 resource SPI_MISO 4 E13 resource SPI_MOSI 1 D07 resource SPI_MOSI 2 B15 resource SPI_MOSI 3 B05 resource SPI_MOSI 4 E14 resourceESCSERIAL 1 C07 resource ADC_BATT 1 C00 resource ADC_RSSI 1 C05 resource ADC_CURR 1 C01 resource ADC_EXT 1 C04 resource PINIO 1 D10 resource PINIO 2 D11 resource FLASH_CS 1 D03 resource OSD_CS 1 B12 resource GYRO_EXTI 1 B02 resource GYRO_EXTI 2 E15 resource GYRO_CS 1 C15 resource GYRO_CS 2 E11 resource USB_DETECT 1 E02
- BF4.5 abstract unified configuration file
#define BEEPER_PIN PA15 #define MOTOR1_PIN PB0 #define MOTOR2_PIN PB1 #define MOTOR3_PIN PA0 #define MOTOR4_PIN PA1 #define MOTOR5_PIN PA2 #define MOTOR6_PIN PA3 #define MOTOR7_PIN PD12 #define MOTOR8_PIN PD13 #define SERVO1_PIN PE5 #define SERVO2_PIN PE6 #define RX_PPM_PIN PA10 #define LED_STRIP_PIN PA8 #define UART1_TX_PIN PA9 #define UART2_TX_PIN PD5 #define UART3_TX_PIN PD8 #define UART4_TX_PIN PB9 #define UART6_TX_PIN PC6 #define UART7_TX_PIN PE8 #define UART8_TX_PIN PE1 #define UART1_RX_PIN PA10 #define UART2_RX_PIN PD6 #define UART3_RX_PIN PD9 #define UART4_RX_PIN PB8 #define UART6_RX_PIN PC7 #define UART7_RX_PIN PE7 #define UART8_RX_PIN PE0 #define I2C1_SCL_PIN PB6 #define I2C2_SCL_PIN PB10 #define I2C1_SDA_PIN PB7 #define I2C2_SDA_PIN PB11 #define LED0_PIN PE3 #define LED1_PIN PE4 #define SPI1_SCK_PIN PA5 #define SPI2_SCK_PIN PB13 #define SPI3_SCK_PIN PB3 #define SPI4_SCK_PIN PE12 #define SPI1_SDI_PIN PA6 #define SPI2_SDI_PIN PB14 #define SPI3_SDI_PIN PB4 #define SPI4_SDI_PIN PE13 #define SPI1_SDO_PIN PD7 #define SPI2_SDO_PIN PB15 #define SPI3_SDO_PIN PB5 #define SPI4_SDO_PIN PE14 #define ESCSERIAL_PIN PC7 #define ADC_VBAT_PIN PC0 #define ADC_RSSI_PIN PC5 #define ADC_CURR_PIN PC1 #define ADC_EXTERNAL1_PIN PC4 #define PINIO1_PIN PD10 #define PINIO2_PIN PD11 #define FLASH_CS_PIN PD3 #define MAX7456_SPI_CS_PIN PB12 #define GYRO_1_EXTI_PIN PB2 #define GYRO_2_EXTI_PIN PE15 #define GYRO_1_CS_PIN PC15 #define GYRO_2_CS_PIN PE11 #define USB_DETECT_PIN PE2
2.2.3 IMU chip
- BF4.0 abstract unified configuration file
#define USE_ACCGYRO_BMI270 set gyro_1_bustype = SPI setgyro_1_spibus = 1 set gyro_1_sensor_align = CW90 set gyro_1_align_yaw = 900 set gyro_2_spibus = 4 set gyro_2_sensor_align = CW180 set gyro_2_align_yaw = 1800
- BF4.5 abstract unified configuration file
#define USE_GYRO #defineUSE_ACC #define USE_ACC_SPI_MPU6000 #define USE_GYRO_SPI_MPU6000 #define USE_ACCGYRO_BMI270 #define USE_ACC_SPI_ICM42688P #define USE_GYRO_SPI_ICM42688P #define USE_SPI_GYRO #define GYRO_1_SPI_INSTANCE SPI1 #define GYRO_1_ALIGN CW90_DEG #define GYRO_1_ALIGN_YAW 900 #define GYRO_2_SPI_INSTANCE SPI4 #define GYRO_2_ALIGN CW180_DEG #define GYRO_2_ALIGN_YAW 1800
Note: Support for MPU6000/ICM42688P has been added to the configuration.
2.2.4 Barometer chip
- BF4.0 abstract unified configuration file
#define USE_BARO_DPS310
- BF4.5 abstract unified configuration file
#define USE_BARO #define USE_BARO_BMP280 #define USE_BARO_MS5611 #define USE_BARO_DPS310
Note: Support for BMP280/MS5611 has been added to the configuration.
2.2.5 Memory chip
- BF4.0 abstract unified configuration file
#define USE_FLASH_W25N01G set flash_spi_bus = 3
- BF4.5 abstract unified configuration file
#define USE_FLASH #define USE_FLASH_W25N01G #define FLASH_SPI_INSTANCE SPI3
2.2.6 OSD chip
- BF4.0 abstract unified configuration file
#define USE_MAX7456 set max7456_spi_bus = 2
- BF4.5 abstract unified configuration file
#define USE_MAX7456 #define MAX7456_SPI_INSTANCE SPI2
2.2.7 ADC DMA
- BF4.0 abstract unified configuration file
dma ADC 1 8 # ADC 1: DMA2 Stream 0 Request 9 dma ADC 3 9 # ADC 3: DMA2 Stream 1 Request 115
- BF4.5 abstract unified configuration file
#define ADC1_DMA_OPT 8 #define ADC3_DMA_OPT 9 #define TIMUP1_DMA_OPT 0 #define TIMUP3_DMA_OPT 2 #define TIMUP4_DMA_OPT 1 #define TIMUP5_DMA_OPT 0
2.2.8 Timer pin
- BF4.0 abstract unified configuration file
# timer timer A10 AF1 # pin A10: TIM1 CH3 (AF1) timer B00 AF2 # pin B00: TIM3 CH3 (AF2) timer B01 AF2 # pin B01: TIM3 CH4 (AF2) timer A00 AF2 # pin A00: TIM5 CH1 (AF2) timer A01 AF2 # pin A01: TIM5 CH2 (AF2) timer A02 AF2 # pin A02: TIM5 CH3 (AF2) timer A03 AF2 # pin A03: TIM5 CH4 (AF2) timer D12 AF2 # pin D12: TIM4 CH1 (AF2) timer D13 AF2 # pin D13: TIM4 CH2 (AF2) timer D14 AF2 # pin D14: TIM4 CH3 (AF2) timer D15 AF2 # pin D15: TIM4 CH4 (AF2) timer E05 AF4 # pin E05: TIM15 CH1 (AF4) timer E06 AF4 # pin E06: TIM15 CH2 (AF4) timer A08 AF1 # pin A08: TIM1 CH1 (AF1)
- BF4.5 abstract unified configuration file
#define TIMER_PIN_MAPPING \ TIMER_PIN_MAP( 0, PA10, 1, 0) \ TIMER_PIN_MAP( 1, PB0 , 2, 0) \ TIMER_PIN_MAP( 2, PB1 , 2, 1) \ TIMER_PIN_MAP( 3, PA0 , 2, 2) \ TIMER_PIN_MAP( 4, PA1 , 2, 3) \ TIMER_PIN_MAP( 5, PA2 , 2, 4) \ TIMER_PIN_MAP( 6, PA3 , 2, 5) \ TIMER_PIN_MAP( 7, PD12, 1, 6) \ TIMER_PIN_MAP(8, PD13, 1, 7) \ TIMER_PIN_MAP( 9, PD14, 1, 12) \ TIMER_PIN_MAP(10, PD15, 1, -1) \ TIMER_PIN_MAP(11, PE5, 1, 0) \ TIMER_PIN_MAP(12, PE6, 1, -1) \ TIMER_PIN_MAP(13, PA8, 1, 14)
2.3 Configuration Definition
2.3.1 GYRO
- BF4.0 abstract unified configuration file
set gyro_to_use = BOTH
- BF4.5 abstract unified configuration file
#define DEFAULT_GYRO_TO_USE GYRO_CONFIG_USE_GYRO_BOTH
2.3.2 mag
- BF4.0 abstract unified configuration file
set mag_bustype = I2C set mag_i2c_device = 1
- BF4.5 abstract unified configuration file
#define MAG_I2C_INSTANCE (I2CDEV_1)
2.3.3 baro
- BF4.0 abstract unified configuration file
set baro_bustype = I2C set baro_i2c_device = 2
- BF4.5 abstract unified configuration file
#define BARO_I2C_INSTANCE (I2CDEV_2)
2.3.4 blackbox
- BF4.0 abstract unified configuration file
set blackbox_device = SPIFLASH
- BF4.5 abstract unified configuration file
#define DEFAULT_BLACKBOX_DEVICE BLACKBOX_DEVICE_FLASH
2.3.5 ADC
- BF4.0 abstract unified configuration file
set current_meter = ADC set battery_meter = ADC setibata_scale = 500
- BF4.5 abstract unified configuration file
#define DEFAULT_CURRENT_METER_SOURCE CURRENT_METER_ADC #define DEFAULT_VOLTAGE_METER_SOURCE VOLTAGE_METER_ADC #define DEFAULT_CURRENT_METER_SCALE 500
2.3.6 beep
- BF4.0 abstract unified configuration file
set beeper_inversion = ON set beeper_od = OFF
- BF4.5 abstract unified configuration file
#define BEEPER_INVERTED
2.3.7 pinio
- BF4.0 abstract unified configuration file
set pinio_config = 129,1,1,1 set pinio_box = 39,40,255,255
- BF4.5 abstract unified configuration file
#define PINIO1_BOX 40 #definePINIO2_BOX 41
2.4 No corresponding definition
No corresponding item was found in the BF4.0 abstract unified configuration file:
# dma dma TIMUP 1 0 # TIMUP 1: DMA1 Stream 0 Request 15 dma TIMUP 3 2 # TIMUP 3: DMA1 Stream 2 Request 27 dma TIMUP 4 1 # TIMUP 4: DMA1 Stream 1 Request 32 dma TIMUP 5 0 # TIMUP 5: DMA1 Stream 0 Request 59 dma pin A10 0 # pin A10: DMA1 Stream 0 Request 13 dma pin B00 0 # pin B00: DMA1 Stream 0 Request 25 dma pin B01 1 # pin B01: DMA1 Stream 1 Request 26 dma pin A00 2 # pin A00: DMA1 Stream 2 Request 55 dma pin A01 3 # pin A01: DMA1 Stream 3 Request 56 dma pin A02 4 # pin A02: DMA1 Stream 4 Request 57 dma pin A03 5 # pin A03: DMA1 Stream 5 Request 58 dma pin D12 6 # pin D12: DMA1 Stream 6 Request 29 dma pin D13 7 # pin D13: DMA1 Stream 7 Request 30 dma pin D14 12 # pin D14: DMA2 Stream 4 Request 31 dma pin E05 0 # pin E05: DMA1 Stream 0 Request 105 dma pin A08 14 # pin A08: DMA2 Stream 6 Request 11 #feature featureRX_SERIAL feature TELEMETRY featureOSD # serial serial 0 64 115200 57600 0 115200
3. Predefined
Currently, the official documentation is still in the process of being compiled. For details, see: How to Create a Flight Controller Configuration File for Betaflight 4.5
Note: The following content will be added or deleted as soon as possible as official documents are added. For real-time conditions, you can refer to the code or the official guide above.
3.1 Serial Configuration
Value | Function define |
---|---|
1 | MSP_UART |
2 | GPS_UART |
64 | SERIALRX_UART |
32 | SBUS_TELEMETRY_UART |
1024 | ESC_SENSOR_UART |
2048 | VTX_SMARTAUDIO_UART |
8192 | VTX_TRAMP_UART |
131072 | VTX_MSP_UART |
131073 | MSP_DISPLAYPORT_UART |
for example:
#define SERIALRX_UART SERIAL_PORT_USART1 #define VTX_SMARTAUDIO_UART SERIAL_PORT_USART3 #define GPS_UART SERIAL_PORT_USART4
3.2 Serial Receiver Provider
for example:
#define SERIALRX_PROVIDER CRSF
4. Reference materials
【1】Introduction to BetaFlight open source code framework
【2】Simple configuration modification of BetaFlight unified hardware resources
【3】Resource command for studying BetaFlight unified hardware configuration file
【4】Timer command for studying BetaFlight unified hardware configuration file
【6】Serial command for studying BetaFlight unified hardware configuration file
【7】set command for studying BetaFlight unified hardware configuration file
【8】Feature command for BetaFlight unified hardware configuration file study
【9】dma command for studying BetaFlight unified hardware configuration file
【10】BetaFlight unified hardware AOCODARC H7DUAL configuration file discussion
【11】BetaFlight flight control AOCODARC-F7MINI firmware compilation