-
Notifications
You must be signed in to change notification settings - Fork 256
Add GD32H757VSTART FC board config file support #1104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,160 @@ | ||||||||||||||||||||||
| /* | ||||||||||||||||||||||
| * 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 GD32H757VI | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| #define BOARD_NAME GD32H757V1START | ||||||||||||||||||||||
| #define MANUFACTURER_ID GD32MCU | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| #define USE_GYRO | ||||||||||||||||||||||
| #define USE_GYRO_SPI_MPU6000 | ||||||||||||||||||||||
| #define USE_GYRO_SPI_ICM42688P | ||||||||||||||||||||||
| #define USE_ACC | ||||||||||||||||||||||
| #define USE_ACC_SPI_MPU6000 | ||||||||||||||||||||||
| #define USE_ACC_SPI_ICM42688P | ||||||||||||||||||||||
| #define USE_BARO | ||||||||||||||||||||||
| #define USE_BARO_DPS310 | ||||||||||||||||||||||
| #define USE_BARO_BMP280 | ||||||||||||||||||||||
| #define USE_BARO_MS5611 | ||||||||||||||||||||||
| #define USE_BARO_GDY112X | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| #define USE_FLASH | ||||||||||||||||||||||
| #define USE_FLASH_W25Q128FV | ||||||||||||||||||||||
| #define USE_MAX7456 | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| // #define USE_MAG | ||||||||||||||||||||||
| // #define USE_MAG_QMC5883 | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| #define BEEPER_PIN PD3 | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| #define MOTOR1_PIN PE9 | ||||||||||||||||||||||
| #define MOTOR2_PIN PE11 | ||||||||||||||||||||||
| #define MOTOR3_PIN PE13 | ||||||||||||||||||||||
| #define MOTOR4_PIN PE14 | ||||||||||||||||||||||
| #define MOTOR5_PIN PC6 | ||||||||||||||||||||||
| #define MOTOR6_PIN PC7 | ||||||||||||||||||||||
| #define MOTOR7_PIN PC8 | ||||||||||||||||||||||
| #define MOTOR8_PIN PC9 | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| // #define SERVO1_PIN PE5 | ||||||||||||||||||||||
| // #define SERVO2_PIN PE6 | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| #define RX_PPM_PIN PA10 | ||||||||||||||||||||||
| #define LED_STRIP_PIN PB1 | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| #define UART0_TX_PIN PA9 | ||||||||||||||||||||||
| #define UART1_TX_PIN PD5 | ||||||||||||||||||||||
| #define UART2_TX_PIN PD8 | ||||||||||||||||||||||
| #define UART3_TX_PIN PB8 | ||||||||||||||||||||||
| #define UART4_TX_PIN PC12 | ||||||||||||||||||||||
| #define UART6_TX_PIN PE8 | ||||||||||||||||||||||
| #define UART7_TX_PIN PE1 | ||||||||||||||||||||||
| #define UART0_RX_PIN PA10 | ||||||||||||||||||||||
| #define UART1_RX_PIN PD6 | ||||||||||||||||||||||
| #define UART2_RX_PIN PD9 | ||||||||||||||||||||||
| #define UART3_RX_PIN PB9 | ||||||||||||||||||||||
| #define UART4_RX_PIN PD2 | ||||||||||||||||||||||
| #define UART6_RX_PIN PE7 | ||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Search for similar PE7 dual-assignment patterns in other board configs
rg -n 'UART6_RX_PIN.*PE7' --type=c -A2 -B2
rg -n 'ESCSERIAL_PIN.*PE7' --type=c -A2 -B2Repository: betaflight/config Length of output: 659 🏁 Script executed: # Search for ESCSERIAL_PIN definitions in all board configs to see if pin sharing is common
rg -n 'ESCSERIAL_PIN' --type=c | head -20
# Check for configuration guards around UART6_RX_PIN and ESCSERIAL_PIN
rg -B5 -A5 'UART6_RX_PIN|ESCSERIAL_PIN' configs/GD32H757VSTART_V02/config.hRepository: betaflight/config Length of output: 1838 🏁 Script executed: # Search across all board configs for UART6_RX_PIN to see if this pattern appears elsewhere
find configs -name "config.h" -exec grep -l "UART6_RX_PIN" {} \;
find configs -name "config.h" -exec grep -l "ESCSERIAL_PIN" {} \;Repository: betaflight/config Length of output: 14257 🏁 Script executed: # Check if there are any conditional definitions or comments indicating mutual exclusivity
rg -B10 'UART6_RX_PIN.*PE7|ESCSERIAL_PIN.*PE7' configs/GD32H757VSTART_V02/config.hRepository: betaflight/config Length of output: 595 🏁 Script executed: # Search for any configuration guards or conditional definitions around PE7
rg -B20 'UART6_RX_PIN.*PE7' configs/GD32H757VSTART_V02/config.h | head -40
# Check if there are any comments explaining ESCSERIAL usage
rg -B5 'ESCSERIAL_PIN' configs/GD32H757VSTART_V02/config.h
# Search for any `#ifdef` or feature guards related to ESCSERIAL or UART6
rg '`#ifdef`.*ESCSERIAL|`#ifdef`.*UART6' --type=cRepository: betaflight/config Length of output: 669 🏁 Script executed: # Check if there's any other board with the same pin sharing pattern
rg 'UART6_RX_PIN' --type=c -A50 | rg -B50 'ESCSERIAL_PIN.*PE' | grep -E 'configs/|UART6_RX_PIN|ESCSERIAL_PIN'Repository: betaflight/config Length of output: 6142 Fix PE7 pin conflict: UART6_RX_PIN and ESCSERIAL_PIN both defined as PE7. This board is the only one in the codebase where UART6_RX_PIN and ESCSERIAL_PIN share the same pin (PE7). All other boards use distinct pins for these functions. Without conditional guards or runtime configuration to disable one, this creates a hardware conflict. Reassign one of these pins to an available GPIO. 🤖 Prompt for AI Agents |
||||||||||||||||||||||
| #define UART7_RX_PIN PE0 | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| #define I2C0_SCL_PIN PB6 | ||||||||||||||||||||||
| #define I2C0_SDA_PIN PB7 | ||||||||||||||||||||||
| #define I2C1_SCL_PIN PB10 | ||||||||||||||||||||||
| #define I2C1_SDA_PIN PB11 | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| #define LED0_PIN PE3 | ||||||||||||||||||||||
| #define LED1_PIN PE1 | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| #define SPI0_SCK_PIN PA5 | ||||||||||||||||||||||
| #define SPI1_SCK_PIN PB13 | ||||||||||||||||||||||
| #define SPI2_SCK_PIN PB3 | ||||||||||||||||||||||
| #define SPI3_SCK_PIN PE2 | ||||||||||||||||||||||
| #define SPI0_SDI_PIN PA6 | ||||||||||||||||||||||
| #define SPI1_SDI_PIN PB14 | ||||||||||||||||||||||
| #define SPI2_SDI_PIN PB4 | ||||||||||||||||||||||
| #define SPI3_SDI_PIN PE5 | ||||||||||||||||||||||
| #define SPI0_SDO_PIN PA7 | ||||||||||||||||||||||
| #define SPI1_SDO_PIN PB15 | ||||||||||||||||||||||
| #define SPI2_SDO_PIN PB5 | ||||||||||||||||||||||
| #define SPI3_SDO_PIN PE6 | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| #define ESCSERIAL_PIN PE7 | ||||||||||||||||||||||
| #define ADC_VBAT_PIN PC0 | ||||||||||||||||||||||
| #define ADC_CURR_PIN PC1 | ||||||||||||||||||||||
| #define ADC_RSSI_PIN PC2 | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| #define FLASH_CS_PIN PA15 | ||||||||||||||||||||||
| #define MAX7456_SPI_CS_PIN PB12 | ||||||||||||||||||||||
| #define GYRO_1_EXTI_PIN PE15 | ||||||||||||||||||||||
| #define GYRO_1_CS_PIN PA4 | ||||||||||||||||||||||
| #define GYRO_2_EXTI_PIN PC13 | ||||||||||||||||||||||
| #define GYRO_2_CS_PIN PE4 | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| #define USB_DETECT_PIN PC15 | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| // #define PINIO1_PIN PD10 | ||||||||||||||||||||||
| // #define PINIO2_PIN PD11 | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| #define TIMER_PIN_MAPPING \ | ||||||||||||||||||||||
| TIMER_PIN_MAP( 0, PB1, 2, 8) \ | ||||||||||||||||||||||
| TIMER_PIN_MAP( 1, PE9, 1, 0) \ | ||||||||||||||||||||||
| TIMER_PIN_MAP( 2, PE11, 1, 0) \ | ||||||||||||||||||||||
| TIMER_PIN_MAP( 3, PE13, 1, 0) \ | ||||||||||||||||||||||
| TIMER_PIN_MAP( 4, PE14, 1, 0) \ | ||||||||||||||||||||||
| TIMER_PIN_MAP( 5, PC6, 2, 0) \ | ||||||||||||||||||||||
| TIMER_PIN_MAP( 6, PC7, 3, 0) \ | ||||||||||||||||||||||
| TIMER_PIN_MAP( 7, PC8, 2, 0) \ | ||||||||||||||||||||||
| TIMER_PIN_MAP( 8, PC9, 2, 0) \ | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| #define ADC0_DMA_OPT 0 | ||||||||||||||||||||||
| #define ADC2_DMA_OPT 1 | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| #define GPS_UART SERIAL_PORT_USART1 | ||||||||||||||||||||||
| #define SERIALRX_UART SERIAL_PORT_USART2 | ||||||||||||||||||||||
| #define MSP_UART SERIAL_PORT_UART4 | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| #define MAG_I2C_INSTANCE I2CDEV_1 | ||||||||||||||||||||||
| #define BARO_I2C_INSTANCE I2CDEV_0 | ||||||||||||||||||||||
| #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 206 | ||||||||||||||||||||||
| #define BEEPER_INVERTED | ||||||||||||||||||||||
| #define MAX7456_SPI_INSTANCE SPI1 | ||||||||||||||||||||||
| #define PINIO1_BOX 40 | ||||||||||||||||||||||
| #define PINIO2_BOX 41 | ||||||||||||||||||||||
| #define PINIO3_BOX 42 | ||||||||||||||||||||||
| #define PINIO1_CONFIG 129 | ||||||||||||||||||||||
| #define PINIO2_CONFIG 129 | ||||||||||||||||||||||
|
Comment on lines
+150
to
+154
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Inconsistent PINIO configuration: boxes and configs defined but pins are commented out. Lines 150-154 define Based on learnings, config.h should only define settings that differ from defaults. If PINIO functionality is not being used (pins commented), the box and config macros should also be removed or commented out. 🔧 Recommended fixEither uncomment the PINIO pins if the functionality is intended: -// `#define` PINIO1_PIN PD10
-// `#define` PINIO2_PIN PD11
+#define PINIO1_PIN PD10
+#define PINIO2_PIN PD11
+#define PINIO3_PIN <appropriate_pin> // Add if PINIO3 is needed
+#define PINIO3_CONFIG 129 // Add if PINIO3 is neededOr remove/comment out the unused PINIO configuration: -#define PINIO1_BOX 40
-#define PINIO2_BOX 41
-#define PINIO3_BOX 42
-#define PINIO1_CONFIG 129
-#define PINIO2_CONFIG 129
+// `#define` PINIO1_BOX 40
+// `#define` PINIO2_BOX 41
+// `#define` PINIO3_BOX 42
+// `#define` PINIO1_CONFIG 129
+// `#define` PINIO2_CONFIG 129📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||
| #define FLASH_SPI_INSTANCE SPI2 | ||||||||||||||||||||||
| #define SERIALRX_PROVIDER SERIALRX_CRSF | ||||||||||||||||||||||
| #define GYRO_1_SPI_INSTANCE SPI0 | ||||||||||||||||||||||
| #define GYRO_1_ALIGN CW90_DEG | ||||||||||||||||||||||
| #define GYRO_2_SPI_INSTANCE SPI3 | ||||||||||||||||||||||
| #define GYRO_2_ALIGN CW90_DEG | ||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Critical pin conflict: PE1 assigned to both UART7_TX and LED1.
Line 72 defines
UART7_TX_PINas PE1, and line 87 definesLED1_PINas PE1. The same GPIO pin cannot serve two simultaneous functions. This will cause hardware configuration errors and unpredictable behavior.🔧 Verify hardware schematic and correct the conflict
Please check the board schematic to determine:
Then update one of these definitions accordingly.
Also applies to: 87-87
🤖 Prompt for AI Agents