BetaFlight统一硬件AOCODARC H7DUAL配置文件讨论

BetaFlight统一硬件AOCODARC H7DUAL配置文件讨论

  • 1. 源由
  • 2. Review配置
  • 3. 分析整理
    • 3.1 生产商信息
    • 3.2 磁力计
    • 3.3 气压计
    • 3.4 陀螺仪
    • 3.5 串口RxTx
    • 3.6 板载Flash
    • 3.7 模拟OSD MAX7456
    • 3.8 PPM接收机
    • 3.9 伺服器
    • 3.10 LED灯带
    • 3.11 蜂鸣器
    • 3.12 电机 X8
    • 3.13 ADC(电压/电流/RSSI信号强度/空速计)
    • 3.14 LED指示灯
    • 3.15 pinio设置
    • 3.16 RC链路
    • 3.17 USB OTG功能
    • 3.18 其他问题
  • 4. 问题汇总
  • 5. 参考资料
  • 6. 补充视频

1. 源由

手边正好有一块AOCODARC H7DUAL的板子,后续也许可以派上用处。

鉴于BetaFlight统一硬件配置文件研读有了一个大概的了解,针对上述板子做一个简单review,并记录澄清一些问题。

BetaFlight统一硬件AOCODARC H7DUAL配置文件讨论_第1张图片
BetaFlight统一硬件AOCODARC H7DUAL配置文件讨论_第2张图片

2. Review配置

详见:AOCODARC H7DUAL

进行讨论的配置文件版本:

#define USE_ACCGYRO_BMI270
#define USE_BARO_DPS310
#define USE_FLASH_W25N01G
#define USE_MAX7456

board_name AOCODARCH7DUAL
manufacturer_id SJET

# resources
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
resource ESCSERIAL 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

# 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)

# dma
dma ADC 1 8
# ADC 1: DMA2 Stream 0 Request 9
dma ADC 3 9
# ADC 3: DMA2 Stream 1 Request 115
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
feature RX_SERIAL
feature TELEMETRY
feature OSD

# serial
serial 0 64 115200 57600 0 115200

# master
set gyro_to_use = BOTH
set mag_bustype = I2C
set mag_i2c_device = 1
set baro_bustype = I2C
set baro_i2c_device = 2
set blackbox_device = SPIFLASH
set current_meter = ADC
set battery_meter = ADC
set ibata_scale = 500
set beeper_inversion = ON
set beeper_od = OFF
set max7456_spi_bus = 2
set pinio_config = 129,1,1,1
set pinio_box = 39,40,255,255
set flash_spi_bus = 3
set gyro_1_bustype = SPI
set gyro_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

3. 分析整理

3.1 生产商信息

board_name AOCODARCH7DUAL
manufacturer_id SJET

3.2 磁力计

//板载无磁力计,但是总线还是申明了【兼容,挺好的方法;实用】
set mag_bustype = I2C
set mag_i2c_device = 1

resource I2C_SCL 1 B06
resource I2C_SDA 1 B07

3.3 气压计

#define USE_BARO_DPS310
set baro_bustype = I2C
set baro_i2c_device = 2

resource I2C_SCL 2 B10
resource I2C_SDA 2 B11

3.4 陀螺仪

#define USE_ACCGYRO_BMI270
set gyro_to_use = BOTH

set gyro_1_bustype = SPI
set gyro_1_spibus = 1
resource SPI_SCK 1 A05
resource SPI_MISO 1 A06
resource SPI_MOSI 1 D07

resource GYRO_EXTI 1 B02
resource GYRO_CS 1 C15

set gyro_1_sensor_align = CW90
set gyro_1_align_yaw = 900

//问题1:为什么没有配置gyro_2_bustype?
set gyro_2_spibus = 4
resource SPI_SCK 4 E12
resource SPI_MISO 4 E13
resource SPI_MOSI 4 E14

resource GYRO_EXTI 2 E15
resource GYRO_CS 2 E11

set gyro_2_sensor_align = CW180
set gyro_2_align_yaw = 1800

3.5 串口RxTx

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 ESCSERIAL 1 C07

//问题2:serial 0配置主要目的是什么,不能默认让用户进行配置吗?
serial 0 64 115200 57600 0 115200

3.6 板载Flash

#define USE_FLASH_W25N01G

set blackbox_device = SPIFLASH
set flash_spi_bus = 3
resource SPI_SCK 3 B03
resource SPI_MISO 3 B04
resource SPI_MOSI 3 B05

resource FLASH_CS 1 D03

3.7 模拟OSD MAX7456

#define USE_MAX7456
feature OSD

set max7456_spi_bus = 2
resource SPI_SCK 2 B13
resource SPI_MISO 2 B14
resource SPI_MOSI 2 B15

resource OSD_CS 1 B12

3.8 PPM接收机

resource PPM 1 A10

timer A10 AF1
# pin A10: TIM1 CH3 (AF1)

dma pin A10 0
# pin A10: DMA1 Stream 0 Request 13

3.9 伺服器

resource SERVO 1 E05
resource SERVO 2 E06

timer E05 AF4
# pin E05: TIM15 CH1 (AF4)
timer E06 AF4
# pin E06: TIM15 CH2 (AF4)

dma pin E05 0
# pin E05: DMA1 Stream 0 Request 105

//问题3:为什么伺服器SERVO 1分配了DMA资源,但是SERVO 2没有分配?

3.10 LED灯带

resource LED_STRIP 1 A08

timer A08 AF1
# pin A08: TIM1 CH1 (AF1)

dma pin A08 14
# pin A08: DMA2 Stream 6 Request 11

3.11 蜂鸣器

resource BEEPER 1 A15

set beeper_inversion = ON
set beeper_od = OFF

3.12 电机 X8

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

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)

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

3.13 ADC(电压/电流/RSSI信号强度/空速计)

resource ADC_BATT 1 C00
resource ADC_RSSI 1 C05
resource ADC_CURR 1 C01
resource ADC_EXT 1 C04

dma ADC 1 8
# ADC 1: DMA2 Stream 0 Request 9
dma ADC 3 9
# ADC 3: DMA2 Stream 1 Request 115

set current_meter = ADC
set battery_meter = ADC

set ibata_scale = 500

注:电流传感器校准参数

3.14 LED指示灯

resource LED 1 E03
resource LED 2 E04

注:FCs should implement at least one LED to indicate activity. The second is preferable, and the third optional.

3.15 pinio设置

resource PINIO 1 D10
resource PINIO 2 D11

set pinio_config = 129,1,1,1
set pinio_box = 39,40,255,255

3.16 RC链路

feature RX_SERIAL
feature TELEMETRY

注:这个其实厂家也可以不配置,在BetaFlight Configurator的UI界面是可以配置的。

BetaFlight统一硬件AOCODARC H7DUAL配置文件讨论_第3张图片

3.17 USB OTG功能

//问题3:USB_DETECT有什么特殊用途吗?

resource USB_DETECT 1 E02

3.18 其他问题

//问题4:板子配置文件中dma TIMUP配置主要用途是什么?

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


//问题5:D14和D15的用途是什么?

timer D14 AF2
# pin D14: TIM4 CH3 (AF2)
timer D15 AF2
# pin D15: TIM4 CH4 (AF2)

dma pin D14 12
# pin D14: DMA2 Stream 4 Request 31

4. 问题汇总

  • 问题1:为什么没有配置gyro_2_bustype?

已反馈生厂商或研读代码,待继续跟进。

  • 问题2:serial 0配置主要目的是什么,不能默认让用户进行配置吗?

已反馈生厂商或研读代码,待继续跟进。

  • 问题3:USB_DETECT有什么特殊用途吗?

a) 目前BetaFlight上没有用到这个引脚的功能。
b) 从精简的角度考虑,可以删除(已经与厂商确认)。
c) 个人认为这个引脚不配置,还可以做其他用途。不知道板子是否引出到GPIO口子上,估计没有。

  • 问题4:板子配置文件中dma TIMUP配置主要用途是什么?

已反馈生厂商或研读代码,待继续跟进。

  • 问题5:D14和D15的用途是什么?

厂家反馈:S9(D14)和S10(D15)分别对应电机#9和电机#10
但是电机相关的resource/timer/dma相关定义又不全

上述问题汇总,希望大家能指正/纠错,让博主和读者更加了解这些配置项。如有更新信息,会尽快将问题的答案更新上来,请感兴趣的朋友持续关注!

5. 参考资料

【1】BetaFlight开源代码框架简介
【2】BetaFlight统一硬件资源简单配置修改
【3】BetaFlight统一硬件配置文件研读
【4】BetaFlight Manufacturer Section

6. 补充视频

Understanding hwdef.dat

你可能感兴趣的:(xFlight,BetaFlight,STM32,嵌入式,AOCODARC,H7DUAL)