刚拿到一块Aocoda F405V2 (MPU6500) + AT32F435飞控板(替换主控芯片)。
准备尝鲜使用github最新betaflight代码,应该是4.5的了。
默认已经烧录了atbetaflight固件 v4.3.2,硬件IMU/Baro/MAX7456都已经找到。
本次代码版本,详见下面git log -n 1
。
betaflight 最新代码
commit eee0cb54677aaf4daae28fd7068460abbffa53c8 (HEAD -> master, origin/master, origin/HEAD)
Author: Steve Evans
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
---------
Co-authored-by: Mark Haslinghuis
config 最新配置
commit 6fa050144d5e6bccf0f50ac67d014491ddb10a71 (HEAD -> master, origin/master, origin/HEAD)
Author: Steve Evans
Date: Thu Oct 19 19:17:18 2023 +0100
Add ICM42688P to SKYSTARSF405 (#193)
Betaflight Configurator需要升级到10.10版本或者之后。
注:之前的版本无法识别AT32芯片。
Root cause:Artery AT32F435/7 DFU and VCP support #3259
注:首先要确保AT32 DFU驱动正确识别硬件。上图是10.9版本,DFU识别芯片,但是配置工具枚举失败。
鉴于该板子整体采用了简单替换。根据之前的一些经验,基于AOCODAF405V2MPU6500修改,新增目标AOCODAF435V2MPU6500。
注:以下配置只是现抄版本,确保固件编译正常。可能存在部分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 .
*/
#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
$ git clone [email protected]:betaflight/betaflight.git
$ cd betaflight
$ cd src/
$ git clone [email protected]:betaflight/config.git
$ cd ..
$ make AOCODAF435V2MPU6500
$ ls obj
betaflight_4.5.0_AT32F435G_AOCODAF435V2MPU6500.hex
注:可参考iNav飞控AOCODARC-F7MINI固件编译
按住Reset按钮,通过USB给飞控上电,进入DFU模式。
Vref=0. 0V, Core temp=-281degC
==》异常 //atbetaflight正常【1】 AT32F435 internal reference voltage issue “Vref=0. 0V” #13133
【2】 AT32F435 OSD_CS resouce allocate issue #13134
【3】How was the fourth parameter determined in TIMER_PIN_MAP? #13135
【4】 VCP hangs on AT32 while getting dma list of valid resource #13138
betaflight 4.5 基本正常工作:
# status
MCU AT32F435 Clock=288MHz, Vref=3.29V, Core temp=63degC
Stack size: 2048, Stack address: 0x2002fff0
Configuration: CONFIGURED, size: 4057, max available: 16384
Devices detected: SPI:1, I2C:1
Gyros detected: gyro 1 locked dma
GYRO=MPU6500, ACC=MPU6500, BARO=DPS310
OSD: MAX7456 (30 x 13)
System Uptime: 7 seconds, Current Time: 2023-10-24T06:02:28.061+00:00
CPU:20%, cycle time: 124, GYRO rate: 8064, RX rate: 15, System rate: 9
Voltage: 0 * 0.01V (0S battery - NOT PRESENT)
I2C Errors: 0
FLASH: JEDEC ID=0x00ef4018 16M
GPS: NOT ENABLED
Arming disable flags: RXLOSS ANGLE CLI MSP
# version
# Betaflight / AT32F435G (A435) 4.5.0 Oct 24 2023 / 13:58:02 (4f17fe0aa) MSP API: 1.46
# config rev: 6ab06df
# board: manufacturer_id: SJET, board_name: AOCODAF435V2MPU6500