BetaFlight飞控AOCODAF435V2MPU6500固件编译
- 1. 源由
- 2. 准备
- 2.1 板子
- 2.2 代码
- 2.3 工具
- 3. 配置修改
- 4. 编译
- 4.1 获取代码
- 4.2 获取配置
- 4.3 编译固件
- 4.4 DFU烧录
- 4.5 版本核对
- 5. 总结
1. 源由
刚拿到一块Aocoda F405V2 (MPU6500) + AT32F435飞控板(替换主控芯片)。
- Aocoda-RC F405V2 FC(STM32F405RGT6 v.s. AT32F435RGT7) IO Definitions
- STM32F405RGT6 v.s. AT32F435RGT7 Comparison for Flight Controller
准备尝鲜使用github最新betaflight代码,应该是4.5的了。
2. 准备
2.1 板子
默认已经烧录了atbetaflight固件 v4.3.2,硬件IMU/Baro/MAX7456都已经找到。
2.2 代码
本次代码版本,详见下面git log -n 1
。
betaflight 最新代码
commit eee0cb54677aaf4daae28fd7068460abbffa53c8 (HEAD -> master, origin/master, origin/HEAD)
Author: Steve Evans <SteveCEvans@users.noreply.github.com>
Date: Sat Oct 21 23:40:46 2023 +0100
Fix buffer overflow in JETIEXBUS character reception (#13130)
* Fix buffer overflow in jetiexbus character reception
* Update src/main/rx/jetiexbus.c
Co-authored-by: Mark Haslinghuis <mark@numloq.nl>
---------
Co-authored-by: Mark Haslinghuis <mark@numloq.nl>
config 最新配置
commit 6fa050144d5e6bccf0f50ac67d014491ddb10a71 (HEAD -> master, origin/master, origin/HEAD)
Author: Steve Evans <SteveCEvans@users.noreply.github.com>
Date: Thu Oct 19 19:17:18 2023 +0100
Add ICM42688P to SKYSTARSF405 (#193)
2.3 工具
Betaflight Configurator需要升级到10.10版本或者之后。
注:之前的版本无法识别AT32芯片。
Root cause:Artery AT32F435/7 DFU and VCP support #3259
注:首先要确保AT32 DFU驱动正确识别硬件。上图是10.9版本,DFU识别芯片,但是配置工具枚举失败。
3. 配置修改
鉴于该板子整体采用了简单替换。根据之前的一些经验,基于AOCODAF405V2MPU6500修改,新增目标AOCODAF435V2MPU6500。
- Betaflight飞控之4.5版本配置文件调整
- BetaFlight统一硬件AOCODARC H7DUAL配置文件讨论
- BetaFlight统一硬件资源简单配置修改
注:以下配置只是现抄版本,确保固件编译正常。可能存在部分IO功能异常问题,需要后续试飞调试确认。
/*
* This file is part of Betaflight.
*
* Betaflight is free software. You can redistribute this software
* and/or modify this software under the terms of the GNU General
* Public License as published by the Free Software Foundation,
* either version 3 of the License, or (at your option) any later
* version.
*
* Betaflight is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this software.
*
* If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#define FC_TARGET_MCU AT32F435G
#define BOARD_NAME AOCODAF435V2MPU6500
#define MANUFACTURER_ID SJET
#define USE_GYRO
#define USE_GYRO_SPI_MPU6500
#define USE_ACC
#define USE_ACC_SPI_MPU6500
#define USE_BARO_BMP280
#define USE_BARO_DPS310
#define USE_FLASH
#define USE_FLASH_W25Q128FV
#define USE_MAX7456
#define BEEPER_PIN PB8
#define MOTOR1_PIN PC6
#define MOTOR2_PIN PC7
#define MOTOR3_PIN PC8
#define MOTOR4_PIN PC9
#define MOTOR5_PIN PA15
#define MOTOR6_PIN PA8
#define MOTOR7_PIN PB10
#define MOTOR8_PIN PB11
#define RX_PPM_PIN PA3
#define LED_STRIP_PIN PB1
#define UART1_TX_PIN PA9
#define UART2_TX_PIN PA2
#define UART3_TX_PIN PC10
#define UART4_TX_PIN PA0
#define UART5_TX_PIN PC12
#define UART1_RX_PIN PA10
#define UART2_RX_PIN PA3
#define UART3_RX_PIN PC11
#define UART4_RX_PIN PA1
#define UART5_RX_PIN PD2
#define I2C1_SCL_PIN PB6
#define I2C1_SDA_PIN PB7
#define LED0_PIN PC13
#define SPI1_SCK_PIN PA5
#define SPI2_SCK_PIN PB13
#define SPI3_SCK_PIN PB3
#define SPI1_SDI_PIN PA6
#define SPI2_SDI_PIN PB14
#define SPI3_SDI_PIN PB4
#define SPI1_SDO_PIN PA7
#define SPI2_SDO_PIN PB15
#define SPI3_SDO_PIN PB5
#define ESCSERIAL_PIN PC11
#define ADC_VBAT_PIN PC2
#define ADC_RSSI_PIN PC3
#define ADC_CURR_PIN PC1
#define FLASH_CS_PIN PC0
#define MAX7456_SPI_CS_PIN PA13
#define GYRO_1_EXTI_PIN PC4
#define GYRO_1_CS_PIN PA4
#define USB_DETECT_PIN PB12
#define TIMER_PIN_MAPPING \
TIMER_PIN_MAP( 0, RX_PPM_PIN , 2, 0) \
TIMER_PIN_MAP( 1, MOTOR1_PIN , 2, 1) \
TIMER_PIN_MAP( 2, MOTOR2_PIN , 2, 1) \
TIMER_PIN_MAP( 3, MOTOR3_PIN , 2, 1) \
TIMER_PIN_MAP( 4, MOTOR4_PIN , 2, 0) \
TIMER_PIN_MAP( 5, MOTOR5_PIN , 1, 0) \
TIMER_PIN_MAP( 6, MOTOR6_PIN , 1, 1) \
TIMER_PIN_MAP( 7, MOTOR7_PIN , 1, 0) \
TIMER_PIN_MAP( 8, MOTOR8_PIN , 1, 0) \
TIMER_PIN_MAP( 9, LED_STRIP_PIN , 2, 0)
#define ADC_INSTANCE ADC3
#define ADC3_DMA_OPT 1
#define MAG_I2C_INSTANCE (I2CDEV_1)
#define USE_BARO
#define BARO_I2C_INSTANCE (I2CDEV_1)
#define DEFAULT_BLACKBOX_DEVICE BLACKBOX_DEVICE_FLASH
#define DEFAULT_DSHOT_BURST DSHOT_DMAR_OFF
#define DEFAULT_DSHOT_BITBANG DSHOT_BITBANG_OFF
#define DEFAULT_CURRENT_METER_SOURCE CURRENT_METER_ADC
#define DEFAULT_VOLTAGE_METER_SOURCE VOLTAGE_METER_ADC
#define DEFAULT_CURRENT_METER_SCALE 500
#define BEEPER_INVERTED
#define SYSTEM_HSE_MHZ 8
#define MAX7456_SPI_INSTANCE SPI2
#define FLASH_SPI_INSTANCE SPI3
#define USE_SPI_GYRO
#define GYRO_1_SPI_INSTANCE SPI1
4. 编译
4.1 获取代码
$ git clone git@github.com:betaflight/betaflight.git
$ cd betaflight
4.2 获取配置
$ cd src/
$ git clone git@github.com:betaflight/config.git
$ cd ..
4.3 编译固件
$ make AOCODAF435V2MPU6500
$ ls obj
betaflight_4.5.0_AT32F435G_AOCODAF435V2MPU6500.hex
4.4 DFU烧录
按住Reset按钮,通过USB给飞控上电,进入DFU模式。
4.5 版本核对
5. 总结
- betaflight固件版本、飞控配置 ==》 基本正常
- Gyro/Acc/Baro以及传感数据 ==》基本正常
- Gyro校准,Pitch/Roll/Yaw ==》基本正常
- OSD MAX7456 芯片 SPI已经发现 ==》基本正常
- 怀疑存在问题:芯片内部温度:
Core temp=-281degC
// 但atbetaflight是正常的