diff --git a/Tools/AP_Bootloader/board_types.txt b/Tools/AP_Bootloader/board_types.txt index 16eda3f59e8dc9..e93e686b2d01e9 100644 --- a/Tools/AP_Bootloader/board_types.txt +++ b/Tools/AP_Bootloader/board_types.txt @@ -416,7 +416,7 @@ AP_HW_CUAV-7-NANO 7000 AP_HW_VUAV-V7pro 7100 # please fill gaps in the above ranges rather than adding past ID #7109 - +AP_HW_F4BY_F427 1530 # OpenDroneID enabled boards. Use 10000 + the base board ID AP_HW_CubeOrange_ODID 10140 diff --git a/Tools/bootloaders/F4BY_F427_bl.bin b/Tools/bootloaders/F4BY_F427_bl.bin new file mode 100755 index 00000000000000..92ed4fbdb6564e Binary files /dev/null and b/Tools/bootloaders/F4BY_F427_bl.bin differ diff --git a/libraries/AP_HAL_ChibiOS/hwdef/F4BY_F427/README.md b/libraries/AP_HAL_ChibiOS/hwdef/F4BY_F427/README.md new file mode 100644 index 00000000000000..534e86b0c0600f --- /dev/null +++ b/libraries/AP_HAL_ChibiOS/hwdef/F4BY_F427/README.md @@ -0,0 +1,17 @@ +# F4BY Flight Controller MCU upgrade + + +## Howto +replace old MCU STM32F407VGT (1MB Flash) with STM32F427VET rev3 or above (2MB Flash) + +## Features + + - Full Ardupilot features support (exclude LUA Script) + + +## Loading Firmware + +Initial firmware load can be done with DFU by plugging in USB with the +boot solder pads connected. Then you should load the "with_bl.hex" +firmware, using your favourite DFU loading tool. + diff --git a/libraries/AP_HAL_ChibiOS/hwdef/F4BY_F427/defaults.parm b/libraries/AP_HAL_ChibiOS/hwdef/F4BY_F427/defaults.parm new file mode 100644 index 00000000000000..f592805319c118 --- /dev/null +++ b/libraries/AP_HAL_ChibiOS/hwdef/F4BY_F427/defaults.parm @@ -0,0 +1,7 @@ +BATT_AMP_OFFSET 2.316 +BATT_AMP_PERVLT 100 +BATT_CURR_PIN 12 +BATT_MONITOR 4 +BATT_VLT_OFFSET 0 +BATT_VOLT_MULT 16.04981 +BATT_VOLT_PIN 13 \ No newline at end of file diff --git a/libraries/AP_HAL_ChibiOS/hwdef/F4BY_F427/hwdef-bl.dat b/libraries/AP_HAL_ChibiOS/hwdef/F4BY_F427/hwdef-bl.dat new file mode 100644 index 00000000000000..60889f42de5ab6 --- /dev/null +++ b/libraries/AP_HAL_ChibiOS/hwdef/F4BY_F427/hwdef-bl.dat @@ -0,0 +1,42 @@ +# hw definition file for processing by chibios_hwdef.py +# for f4by bootloader + +MCU STM32F4xx STM32F427xx + +APJ_BOARD_ID AP_HW_F4BY_F427 + +OSCILLATOR_HZ 8000000 + +STM32_ST_USE_TIMER 5 + +# flash size +FLASH_SIZE_KB 2048 + +# order of UARTs (and USB) +SERIAL_ORDER OTG1 USART2 + +PE3 LED_BOOTLOADER OUTPUT +PE2 LED_ACTIVITY OUTPUT +define HAL_LED_ON 1 + +PA9 VBUS INPUT + +PA11 OTG_FS_DM OTG1 +PA12 OTG_FS_DP OTG1 + +PA13 JTMS-SWDIO SWD +PA14 JTCK-SWCLK SWD + +PD5 USART2_TX USART2 +PD6 USART2_RX USART2 + +FLASH_USE_MAX_KB 16 +FLASH_RESERVE_START_KB 0 + +# location of application code +FLASH_BOOTLOADER_LOAD_KB 16 + +# Add CS pins to ensure they are high in bootloader +PA4 MPU_CS CS +PB12 FRAM_CS CS SPEED_VERYLOW +PE15 FLASH_CS CS diff --git a/libraries/AP_HAL_ChibiOS/hwdef/F4BY_F427/hwdef.dat b/libraries/AP_HAL_ChibiOS/hwdef/F4BY_F427/hwdef.dat new file mode 100644 index 00000000000000..35b1655515f123 --- /dev/null +++ b/libraries/AP_HAL_ChibiOS/hwdef/F4BY_F427/hwdef.dat @@ -0,0 +1,169 @@ +# hw definition file for processing by chibios_hwdef.py +# for F4BY v2.1.5 board description http://swift-flyer.com/?page_id=83 + +# MCU class and specific type +MCU STM32F4xx STM32F427xx + +# board ID for firmware load +APJ_BOARD_ID AP_HW_F4BY_F427 + +# USB setup +USB_VENDOR 0x27AC # Swift-Flyer +USB_PRODUCT 0x0201 # fmu usb driver +USB_STRING_MANUFACTURER "Swift-Flyer" +PA11 OTG_FS_DM OTG1 +PA12 OTG_FS_DP OTG1 +# this is the pin that senses USB being connected. It is an input pin +# setup as OPENDRAIN +PA9 VBUS INPUT OPENDRAIN + + +FLASH_SIZE_KB 2048 +FLASH_RESERVE_START_KB 16 +define HAL_STORAGE_SIZE 16384 +env OPTIMIZE -O2 + +# crystal frequency +OSCILLATOR_HZ 8000000 + +# ChibiOS system timer +STM32_ST_USE_TIMER 5 + + + +PA13 JTMS-SWDIO SWD +PA14 JTCK-SWCLK SWD + +# the normal usage of this ordering is: +# 1) SERIAL0: console (primary mavlink, usually USB) +# 2) SERIAL3: primary GPS +# 3) SERIAL1: telem1 +# 4) SERIAL2: telem2 +# 5) SERIAL4: GPS2 +# 6) SERIAL5: extra UART (usually RTOS debug console) + +# use UART for stdout, so no STDOUT_SERIAL +#STDOUT_SERIAL SD5 +#STDOUT_BAUDRATE 57600 + + + +SERIAL_ORDER OTG1 USART2 USART1 USART3 UART4 UART5 + +# UART1 as board 2.1.5 for serial 3 gps +PB6 USART1_TX USART1 +PB7 USART1_RX USART1 + +# USART2 serial2 telem2 +PD5 USART2_TX USART2 NODMA +PD6 USART2_RX USART2 + +# USART3 serial3 telem1 +PD8 USART3_TX USART3 NODMA +PD9 USART3_RX USART3 + +PC10 UART4_TX UART4 NODMA +PC11 UART4_RX UART4 + +# SHARE dma with I2C2_TX +PC12 UART5_TX UART5 NODMA +PD2 UART5_RX UART5 NODMA + + +#SPI1 for MPU +PA5 SPI1_SCK SPI1 +PA6 SPI1_MISO SPI1 +PA7 SPI1_MOSI SPI1 +PA4 MPU_CS CS + +# spi bus for dataflash AND SD +PB13 SPI2_SCK SPI2 +PB14 SPI2_MISO SPI2 +PB15 SPI2_MOSI SPI2 + + +PB12 FRAM_CS CS SPEED_VERYLOW +PE15 FLASH_CS CS + +SPIDEV mpu6000 SPI1 DEVID1 MPU_CS MODE3 1*MHZ 8*MHZ +SPIDEV ramtron SPI2 DEVID2 FRAM_CS MODE3 8*MHZ 8*MHZ +SPIDEV sdcard SPI2 DEVID3 FLASH_CS MODE0 400*KHZ 25*MHZ + +# one IMU +IMU Invensense SPI:mpu6000 ROTATION_NONE + +# one baro, check both addresses +BARO MS56XX I2C:0:0x76 +BARO MS56XX I2C:0:0x77 + +# enable RAMTROM parameter storage +define HAL_WITH_RAMTRON 1 +# enable FAT filesystem support +define HAL_OS_FATFS_IO 1 + +# this defines the default maximum clock on I2C devices. +define HAL_I2C_MAX_CLOCK 100000 +I2C_ORDER I2C2 I2C1 +PB8 I2C1_SCL I2C1 +PB9 I2C1_SDA I2C1 +PB10 I2C2_SCL I2C2 +PB11 I2C2_SDA I2C2 + +# look for I2C compass +COMPASS HMC5843 I2C:0:0x1E false ROTATION_YAW_270 +define HAL_PROBE_EXTERNAL_I2C_COMPASSES + +# PWM out pins +PA0 TIM2_CH1 TIM2 PWM(1) GPIO(50) +PA1 TIM2_CH2 TIM2 PWM(2) GPIO(51) +PA2 TIM2_CH3 TIM2 PWM(3) GPIO(52) +PA3 TIM2_CH4 TIM2 PWM(4) GPIO(53) +PE9 TIM1_CH1 TIM1 PWM(5) GPIO(54) +PE11 TIM1_CH2 TIM1 PWM(6) GPIO(55) +PE13 TIM1_CH3 TIM1 PWM(7) GPIO(56) +PE14 TIM1_CH4 TIM1 PWM(8) GPIO(57) + +PD13 TIM4_CH2 TIM4 PWM(9) GPIO(58) +PD12 TIM4_CH1 TIM4 PWM(10) GPIO(59) +PD15 TIM4_CH4 TIM4 PWM(11) GPIO(60) +PD14 TIM4_CH3 TIM4 PWM(12) GPIO(61) + +# also USART6_RX for unidirectional RC,including PPM +PC7 TIM8_CH2 TIM8 RCININT PULLDOWN LOW DMA_CH0 +# PC6 TIM8_CH1 TIM8 RCININT PULLDOWN LOW DMA_CH0 + + +# New style Pixracer LED configuration for master repo +define AP_NOTIFY_GPIO_LED_RGB_ENABLED 1 + +PE3 LED_RED OUTPUT GPIO(10) +PE2 LED_GREEN OUTPUT GPIO(11) +PE1 LED_BLUE OUTPUT GPIO(12) +PE0 LED_YELOW OUTPUT GPIO(13) + +define AP_NOTIFY_GPIO_LED_RGB_RED_PIN 10 +define AP_NOTIFY_GPIO_LED_RGB_GREEN_PIN 11 +define AP_NOTIFY_GPIO_LED_RGB_BLUE_PIN 12 + + + +PC0 PRESSURE_SENS ADC1 SCALE(1) +PC1 RSSI_IN ADC1 +PC2 BATT_CURRENT_SENS ADC1 SCALE(2) +PC3 BATT_VOLTAGE_SENS ADC1 SCALE(2) +PC4 VDD_5V_SENS ADC1 SCALE(2) +PC5 FMU_SERVORAIL_VCC_SENS ADC1 SCALE(2) + + +PE5 TIM9_CH1 TIM9 ALARM +PC14 EXTERN_GPIO1 OUTPUT GPIO(1) +PC13 EXTERN_GPIO2 OUTPUT GPIO(2) +PE4 EXTERN_GPIO3 OUTPUT GPIO(3) +PE6 EXTERN_GPIO4 OUTPUT GPIO(4) +PC9 EXTERN_GPIO5 OUTPUT GPIO(5) + +# IRQ for MPU6000 +PB0 EXTI_MPU6000 INPUT PULLUP +PB1 DRDY_HMC5883 INPUT PULLUP + +