From f61c337654339f37604c41df93e668adf6d50b89 Mon Sep 17 00:00:00 2001 From: kedeng Date: Fri, 5 Sep 2025 15:14:36 +0800 Subject: [PATCH 1/6] Add SPEEDYBEEF435AIOELRS --- configs/SPEEDYBEEF435AIOELRS/config.h | 103 ++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 configs/SPEEDYBEEF435AIOELRS/config.h diff --git a/configs/SPEEDYBEEF435AIOELRS/config.h b/configs/SPEEDYBEEF435AIOELRS/config.h new file mode 100644 index 000000000..18baf2a8a --- /dev/null +++ b/configs/SPEEDYBEEF435AIOELRS/config.h @@ -0,0 +1,103 @@ +/* + * 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 SPEEDYBEEF435AIOELRS +#define MANUFACTURER_ID SPBE + +#define USE_ACC +#define USE_GYRO +#define USE_ACC_SPI_ICM42688P +#define USE_GYRO_SPI_ICM42688P +#define USE_FLASH +#define USE_FLASH_W25Q128FV +#define USE_BARO +#define USE_BARO_DPS310 +#define USE_GYRO_CLKIN + +#define MOTOR1_PIN PB6 +#define MOTOR2_PIN PB7 +#define MOTOR3_PIN PB0 +#define MOTOR4_PIN PB1 + +#define UART1_TX_PIN PA9 +#define UART1_RX_PIN PA10 +#define UART2_RX_PIN PA3 +#define UART3_TX_PIN PB10 +#define UART3_RX_PIN PB11 +#define UART5_TX_PIN PB9 +#define UART5_RX_PIN PB8 +#define UART7_TX_PIN PB4 +#define UART7_RX_PIN PB3 + +#define I2C2_SCL_PIN PH2 +#define I2C2_SDA_PIN PH3 + +#define SPI1_SCK_PIN PA5 +#define SPI1_SDI_PIN PA6 +#define SPI1_SDO_PIN PA7 +#define GYRO_1_CS_PIN PA4 +#define GYRO_1_EXTI_PIN PA15 +#define GYRO_1_CLKIN_PIN PA2 + +#define SPI2_SCK_PIN PB13 +#define SPI2_SDI_PIN PB14 +#define SPI2_SDO_PIN PB15 +#define FLASH_CS_PIN PC13 + +#define ADC_CURR_PIN PA1 +#define ADC_VBAT_PIN PA0 +#define LED0_PIN PA8 +#define BEEPER_PIN PB5 +#define LED_STRIP_PIN PB12 + +#define TIMER_PIN_MAPPING \ + TIMER_PIN_MAP(0, MOTOR1_PIN, 1, 3) \ + TIMER_PIN_MAP(1, MOTOR2_PIN, 1, 4) \ + TIMER_PIN_MAP(2, MOTOR3_PIN, 2, 7) \ + TIMER_PIN_MAP(3, MOTOR4_PIN, 2, 5) \ + TIMER_PIN_MAP(4, BEEPER_PIN, 1, -1) \ + TIMER_PIN_MAP(5, LED_STRIP_PIN, 1, 6) \ + TIMER_PIN_MAP(6, GYRO_1_CLKIN_PIN, 1, -1) + +#define ADC_INSTANCE ADC1 +#define ADC1_DMA_OPT 11 +#define BEEPER_INVERTED +#define SYSTEM_HSE_MHZ 8 + +#define BARO_I2C_INSTANCE I2CDEV_2 +#define MAG_I2C_INSTANCE I2CDEV_2 +#define GYRO_1_ALIGN CW90_DEG +#define GYRO_1_SPI_INSTANCE SPI1 +#define FLASH_SPI_INSTANCE SPI2 + +#define DEFAULT_BLACKBOX_DEVICE BLACKBOX_DEVICE_FLASH +#define DEFAULT_DSHOT_BURST DSHOT_DMAR_AUTO +#define DEFAULT_DSHOT_TELEMETRY DSHOT_TELEMETRY_ON +#define DEFAULT_CURRENT_METER_SOURCE CURRENT_METER_ADC +#define DEFAULT_VOLTAGE_METER_SOURCE VOLTAGE_METER_ADC +#define DEFAULT_CURRENT_METER_SCALE 800 + +#define MSP_UART SERIAL_PORT_USART1 +#define SERIALRX_UART SERIAL_PORT_UART5 From 1203f066119db7beaa7e75a87ea5262af4c16901 Mon Sep 17 00:00:00 2001 From: kedeng Date: Sat, 6 Sep 2025 22:53:38 +0800 Subject: [PATCH 2/6] Update the current meter scale and offset --- configs/SPEEDYBEEF435AIOELRS/config.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/configs/SPEEDYBEEF435AIOELRS/config.h b/configs/SPEEDYBEEF435AIOELRS/config.h index 18baf2a8a..6f8d9e617 100644 --- a/configs/SPEEDYBEEF435AIOELRS/config.h +++ b/configs/SPEEDYBEEF435AIOELRS/config.h @@ -97,7 +97,8 @@ #define DEFAULT_DSHOT_TELEMETRY DSHOT_TELEMETRY_ON #define DEFAULT_CURRENT_METER_SOURCE CURRENT_METER_ADC #define DEFAULT_VOLTAGE_METER_SOURCE VOLTAGE_METER_ADC -#define DEFAULT_CURRENT_METER_SCALE 800 +#define DEFAULT_CURRENT_METER_SCALE 215 +#define DEFAULT_CURRENT_METER_OFFSET -12390 #define MSP_UART SERIAL_PORT_USART1 #define SERIALRX_UART SERIAL_PORT_UART5 From bb23513632958a16c319b3876b2d4d2855c15c9c Mon Sep 17 00:00:00 2001 From: kedeng Date: Tue, 9 Sep 2025 09:29:28 +0800 Subject: [PATCH 3/6] Optimize timer channel allocation --- configs/SPEEDYBEEF435AIOELRS/config.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/configs/SPEEDYBEEF435AIOELRS/config.h b/configs/SPEEDYBEEF435AIOELRS/config.h index 6f8d9e617..6ca2f6a73 100644 --- a/configs/SPEEDYBEEF435AIOELRS/config.h +++ b/configs/SPEEDYBEEF435AIOELRS/config.h @@ -73,12 +73,12 @@ #define LED_STRIP_PIN PB12 #define TIMER_PIN_MAPPING \ - TIMER_PIN_MAP(0, MOTOR1_PIN, 1, 3) \ - TIMER_PIN_MAP(1, MOTOR2_PIN, 1, 4) \ - TIMER_PIN_MAP(2, MOTOR3_PIN, 2, 7) \ - TIMER_PIN_MAP(3, MOTOR4_PIN, 2, 5) \ + TIMER_PIN_MAP(0, MOTOR1_PIN, 1, 1) \ + TIMER_PIN_MAP(1, MOTOR2_PIN, 1, 2) \ + TIMER_PIN_MAP(2, MOTOR3_PIN, 2, 3) \ + TIMER_PIN_MAP(3, MOTOR4_PIN, 2, 4) \ TIMER_PIN_MAP(4, BEEPER_PIN, 1, -1) \ - TIMER_PIN_MAP(5, LED_STRIP_PIN, 1, 6) \ + TIMER_PIN_MAP(5, LED_STRIP_PIN, 1, 0) \ TIMER_PIN_MAP(6, GYRO_1_CLKIN_PIN, 1, -1) #define ADC_INSTANCE ADC1 From fc30ac43c8a2d4bd6ba6d664a76ef021e481957a Mon Sep 17 00:00:00 2001 From: kedeng Date: Wed, 10 Sep 2025 10:39:58 +0800 Subject: [PATCH 4/6] Set dshot bitbang default on --- configs/SPEEDYBEEF435AIOELRS/config.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/SPEEDYBEEF435AIOELRS/config.h b/configs/SPEEDYBEEF435AIOELRS/config.h index 6ca2f6a73..d66a17603 100644 --- a/configs/SPEEDYBEEF435AIOELRS/config.h +++ b/configs/SPEEDYBEEF435AIOELRS/config.h @@ -93,7 +93,7 @@ #define FLASH_SPI_INSTANCE SPI2 #define DEFAULT_BLACKBOX_DEVICE BLACKBOX_DEVICE_FLASH -#define DEFAULT_DSHOT_BURST DSHOT_DMAR_AUTO +#define DEFAULT_DSHOT_BITBANG DSHOT_BITBANG_ON #define DEFAULT_DSHOT_TELEMETRY DSHOT_TELEMETRY_ON #define DEFAULT_CURRENT_METER_SOURCE CURRENT_METER_ADC #define DEFAULT_VOLTAGE_METER_SOURCE VOLTAGE_METER_ADC From d4c53877102ae21f53d4e5c6a92281cd8bba87fc Mon Sep 17 00:00:00 2001 From: kedeng Date: Tue, 16 Sep 2025 18:07:29 +0800 Subject: [PATCH 5/6] Remove beep pin timer --- configs/SPEEDYBEEF435AIOELRS/config.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/configs/SPEEDYBEEF435AIOELRS/config.h b/configs/SPEEDYBEEF435AIOELRS/config.h index d66a17603..7f0560e02 100644 --- a/configs/SPEEDYBEEF435AIOELRS/config.h +++ b/configs/SPEEDYBEEF435AIOELRS/config.h @@ -77,9 +77,8 @@ TIMER_PIN_MAP(1, MOTOR2_PIN, 1, 2) \ TIMER_PIN_MAP(2, MOTOR3_PIN, 2, 3) \ TIMER_PIN_MAP(3, MOTOR4_PIN, 2, 4) \ - TIMER_PIN_MAP(4, BEEPER_PIN, 1, -1) \ - TIMER_PIN_MAP(5, LED_STRIP_PIN, 1, 0) \ - TIMER_PIN_MAP(6, GYRO_1_CLKIN_PIN, 1, -1) + TIMER_PIN_MAP(4, LED_STRIP_PIN, 1, 0) \ + TIMER_PIN_MAP(5, GYRO_1_CLKIN_PIN, 1, -1) #define ADC_INSTANCE ADC1 #define ADC1_DMA_OPT 11 From 0311c161cc7e950eb13dd06a2b4990cc1e3cb74b Mon Sep 17 00:00:00 2001 From: kedeng Date: Sun, 21 Sep 2025 00:13:41 +0800 Subject: [PATCH 6/6] Remove DEFAULT_CURRENT_METER_OFFSET and change DEFAULT_CURRENT_METER_SCALE to match the theoretical value --- configs/SPEEDYBEEF435AIOELRS/config.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/configs/SPEEDYBEEF435AIOELRS/config.h b/configs/SPEEDYBEEF435AIOELRS/config.h index 7f0560e02..6baa3ebd4 100644 --- a/configs/SPEEDYBEEF435AIOELRS/config.h +++ b/configs/SPEEDYBEEF435AIOELRS/config.h @@ -96,8 +96,7 @@ #define DEFAULT_DSHOT_TELEMETRY DSHOT_TELEMETRY_ON #define DEFAULT_CURRENT_METER_SOURCE CURRENT_METER_ADC #define DEFAULT_VOLTAGE_METER_SOURCE VOLTAGE_METER_ADC -#define DEFAULT_CURRENT_METER_SCALE 215 -#define DEFAULT_CURRENT_METER_OFFSET -12390 +#define DEFAULT_CURRENT_METER_SCALE 250 #define MSP_UART SERIAL_PORT_USART1 #define SERIALRX_UART SERIAL_PORT_UART5