Skip to content

ADD new target DAKEFPVF405 #30100

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Tools/AP_Bootloader/board_types.txt
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ AP_HW_3DRControlN1 1186
AP_HW_CORVON405V2_1 1187
AP_HW_NarinH5 1188
AP_HW_CORVON743V1 1189
AP_HW_DAKEFPVF405 1190
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should break this out as a separate PR to hold the bd id number while this goes thru review


AP_HW_JFB200 1200

Expand Down
Binary file added Tools/bootloaders/DAKEFPVF405_bl.bin
Binary file not shown.
893 changes: 893 additions & 0 deletions Tools/bootloaders/DAKEFPVF405_bl.hex

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
105 changes: 105 additions & 0 deletions libraries/AP_HAL_ChibiOS/hwdef/DAKEFPVF405/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# DAKEFPV F405 Flight Controller

The DAKEFPV F405 is a flight controller produced by [DAKEFPV](https://www.dakefpv.com/).

## Features

- MCU - STM32F405 32-bit processor. 1024Kbytes Flash
- IMU - Dual ICM42688
- Barometer - SPL06
- OSD - AT7456E
- Onboard Flash: 16MByte
- 8x UARTs
- 13x PWM Outputs (12 Motor Output, 1 LED)
- Battery input voltage: 4S-12S
- BEC 3.3V 0.5A
- BEC 5V 3A
- BEC 12V 3A for video, gpio controlled
- Dual switchable camera inputs

## Pinout

![DAKEFPV F405 Board Top](Top.jpg "DAKEFPV F405 Top")
![DAKEFPV F405 Board Bottom](Bottom.jpg "DAKEFPV F405 Bottom")

## DAKEFPV F405 Wiring Diagram

![DAKEFPV F405 Wiring Diagram Top]( WiringDiagramTop.jpg "DAKEFPV F405 Wiring Diagram Top")
![DAKEFPV F405 Wiring Diagram Bottom](WiringDiagramBottom.jpg "DAKEFPV F405 Wiring Diagram Bottom")

## UART Mapping

The UARTs are marked Rn and Tn in the above pinouts. The Rn pin is the
receive pin for UARTn. The Tn pin is the transmit pin for UARTn.

- SERIAL0 -> USB
- SERIAL1 -> UART1 (GPS, DMA-enabled)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GPS does not DMA, probably should mark it NODMA in the hwdef in case you want to try to get bi-dir DShot on some outputs

- SERIAL2 -> UART2 (ELRS)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- SERIAL2 -> UART2 (ELRS)
- SERIAL2 -> UART2 (RCin) RX DMA capable

RX DMA is required for a UART used for RCinput on CRSF/ELRS for reliability, so its good it has it

- SERIAL3 -> UART3 (ESC Telemetry)
- SERIAL4 -> UART4 (VTX)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- SERIAL4 -> UART4 (VTX)
- SERIAL4 -> UART4 (DisplayPort) TX DMA capable

Need to assign the protocol in the hwdef

- SERIAL5 -> UART5 (User)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where is this pinned out?

- SERIAL6 -> UART6 (User)

## RC Input

RC input is configured by default via the USART5 RX input. It supports all serial RC protocols except PPM.
Copy link
Contributor

@Hwurzburg Hwurzburg May 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont think SBUS works with this autopilot!....it needs external inversion....F405 cannot invert its UART inputs..you may want to consider a board change to take the HD VTX R2 pin and invert it to UART RX2 with a transistor....then it can be labelled as the SBUS input


Note: If the receiver is FPort the receiver must be tied to the USART5 TX pin , RSSI_TYPE set to 3,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Depending on what you decide to do, the RC section might need changes

and SERIAL5_OPTIONS must be set to 7 (invert TX/RX, half duplex). For full duplex like CRSF/ELRS use both
RX5 and TX5 and set RSSI_TYPE also to 3.

## FrSky Telemetry

FrSky Telemetry is supported using an unused UART, such as the T5 pin (UART5 transmit).
You need to set the following parameters to enable support for FrSky S.PORT:

- SERIAL5_PROTOCOL 10
- SERIAL5_OPTIONS 7

## PWM Output

The DAKEFPV F405 supports up to 6 PWM or DShot outputs. The pads for motor output
M1 to M6 are provided on both the motor connectors and on separate pads.

The PWM is in 3 groups:

- PWM 1-2 in group1
- PWM 3-4 in group2
- PWM 5-6 in group3

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should list PWM7 as led in group4, and its not setup by default as an LED...something you do in the defaults.parm


Channels within the same group need to use the same output rate. If
any channel in a group uses DShot then all channels in the group need
to use DShot. Channels 1-10 support bi-directional dshot.

## Battery Monitoring

The board has a built-in voltage sensor and external current sensor input. The current
sensor can read up to 130 Amps. The voltage sensor can handle up to 12S
LiPo batteries.

The correct battery setting parameters are:

- BATT_MONITOR 4
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these DO NOT agree with what is in the HWDEF

- BATT_VOLT_PIN 11
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be in this form:

Suggested change
- BATT_VOLT_PIN 11
- :ref:`BATT_VOLT_PIN <BATT_VOLT_PIN__AP_BattMonitor_Analog>` = 11

- BATT_CURR_PIN 13
- BATT_VOLT_MULT 11.1
- BATT_AMP_PERVLT 40

## Compass

The DAKEFPV F405 does not have a builtin compass, but you can attach an external compass using I2C on the SDA and SCL pads.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs VTX pwoer switch and an RSSI input pin section

## Camera control

GPIO 82 controls the camera output to the connectors marked "CAM1" and "CAM2". Setting this GPIO low switches the video output from CAM1 to CAM2. By default RELAY3 is configured to control this pin and sets the GPIO high.

## Loading Firmware
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## Loading Firmware
## Loading Firmware
Firmware for these boards can be found `here <https://firmware.ardupilot.org>`__ in sub-folders labeled "DAKEFPVF405".


Initial firmware load can be done with DFU by plugging in USB with the
bootloader button pressed. Then you should load the "with_bl.hex"
firmware, using your favourite DFU loading tool.

Once the initial firmware is loaded you can update the firmware using
any ArduPilot ground station software. Updates should be done with the
\*.apj firmware files.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions libraries/AP_HAL_ChibiOS/hwdef/DAKEFPVF405/defaults.parm
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# setup SERIAL2 for RCIN
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All protocols should be in hwdef not here

SERIAL2_PROTOCOL 23

# disable GPS on Serial 4
SERIAL4_PROTOCOL -1

# setup SERIAL1 for GPS
SERIAL1_PROTOCOL 5

# Onboard ELRS
RC2_REVERSED 1 # Prevent inverse pitch controls
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is discouraged since some TX normal output is reversed, although infrequent

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should set OSD_TYPE2 5 for DisplayPort in defaults
and RELAY_EN and the functions for RELAY2 and RELAY since just defining the pins hwdef no longer means they are activated....and not sure what GPIO70 does (RELAY2) since its also labeled as a camera switch in the hwdef...maybe its the 12V video supply switch??

44 changes: 44 additions & 0 deletions libraries/AP_HAL_ChibiOS/hwdef/DAKEFPVF405/hwdef-bl.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@

# hw definition file for processing by chibios_hwdef.py
# for AAAAF405 hardware.
# thanks to betaflight for pin information

# MCU class and specific type
MCU STM32F4xx STM32F405xx

# board ID for firmware load
APJ_BOARD_ID AP_HW_DAKEFPVF405

# crystal frequency, setup to use external oscillator
OSCILLATOR_HZ 8000000

FLASH_SIZE_KB 1024

# bootloader starts at zero offset
FLASH_RESERVE_START_KB 0

# the location where the bootloader will put the firmware
FLASH_BOOTLOADER_LOAD_KB 48

# order of UARTs (and USB)
SERIAL_ORDER OTG1

# PA10 IO-debug-console
PA11 OTG_FS_DM OTG1
PA12 OTG_FS_DP OTG1

PA13 JTMS-SWDIO SWD
PA14 JTCK-SWCLK SWD

# default to all pins low to avoid ESD issues
DEFAULTGPIO OUTPUT LOW PULLDOWN


# Chip select pins
PC13 BARO1_CS CS
PA15 FLASH1_CS CS
PB12 OSD1_CS CS
PA4 GYRO1_CS CS

PB3 LED_BOOTLOADER OUTPUT LOW
define HAL_LED_ON 0
163 changes: 163 additions & 0 deletions libraries/AP_HAL_ChibiOS/hwdef/DAKEFPVF405/hwdef.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@

# hw definition file for processing by chibios_hwdef.py
# for AAAAF405 hardware.
# thanks to betaflight for pin information

# MCU class and specific type
MCU STM32F4xx STM32F405xx

# board ID for firmware load
APJ_BOARD_ID AP_HW_DAKEFPVF405

# crystal frequency, setup to use external oscillator
OSCILLATOR_HZ 8000000

FLASH_SIZE_KB 1024

# bootloader takes first sector
FLASH_RESERVE_START_KB 48

define HAL_STORAGE_SIZE 16384
define STORAGE_FLASH_PAGE 1

STM32_ST_USE_TIMER 5

# SPI devices

# SPI1
PA5 SPI1_SCK SPI1
PA6 SPI1_MISO SPI1
PA7 SPI1_MOSI SPI1

# SPI2
PB13 SPI2_SCK SPI2
PB14 SPI2_MISO SPI2
PB15 SPI2_MOSI SPI2

# SPI3
PB5 SPI3_MOSI SPI3
PC10 SPI3_SCK SPI3
PC11 SPI3_MISO SPI3

# Chip select pins
PC13 BARO1_CS CS
PA15 FLASH1_CS CS
PB12 OSD1_CS CS
PA4 GYRO1_CS CS

SPIDEV dps310 SPI2 DEVID3 BARO1_CS MODE3 5*MHZ 5*MHZ

BARO SPL06 SPI:dps310
BARO BMP280 SPI:dps310

# Beeper
PC3 BUZZER OUTPUT GPIO(80) LOW
define HAL_BUZZER_PIN 80

# SERIAL ports
SERIAL_ORDER OTG1 USART1 USART2 USART3 UART4 UART5 USART6
# PA10 IO-debug-console
PA11 OTG_FS_DM OTG1
PA12 OTG_FS_DP OTG1

# USART1
PA10 USART1_RX USART1
PA9 USART1_TX USART1

# USART2
PA2 USART2_TX USART2
PA3 USART2_RX USART2

# USART3
PB10 USART3_TX USART3
PB11 USART3_RX USART3

# UART4
PA0 UART4_TX UART4
PA1 UART4_RX UART4

# UART5
PC12 UART5_TX UART5 NODMA
PD2 UART5_RX UART5 NODMA

# USART6
PC6 USART6_TX USART6 NODMA
PC7 USART6_RX USART6 NODMA

# I2C ports
I2C_ORDER I2C1
# I2C1
PB8 I2C1_SCL I2C1
PB9 I2C1_SDA I2C1

# Servos
PA8 CAMERA1 OUTPUT GPIO(70) LOW
define RELAY2_PIN_DEFAULT 70

# ADC ports

# ADC1
PC0 BATT_CURRENT_SENS ADC1 SCALE(1)
define HAL_BATT_CURR_PIN 10
define HAL_BATT_CURR_SCALE 83.3
PC1 BATT_VOLTAGE_SENS ADC1 SCALE(1)
define HAL_BATT_VOLT_PIN 11
define HAL_BATT_VOLT_SCALE 11.0
PC2 RSSI_ADC ADC1
define BOARD_RSSI_ANA_PIN 12
define HAL_BATT_MONITOR_DEFAULT 4

# MOTORS
PC8 TIM8_CH3 TIM8 PWM(1) GPIO(50) # M1
PC9 TIM8_CH4 TIM8 PWM(2) GPIO(51) # M2
PB6 TIM4_CH1 TIM4 PWM(3) GPIO(52) # M3
PB7 TIM4_CH2 TIM4 PWM(4) GPIO(53) # M4
PB0 TIM3_CH3 TIM3 PWM(5) GPIO(54) # M5
PB1 TIM3_CH4 TIM3 PWM(6) GPIO(55) # M6

# Camera switch control - should be high at startup to ensure Camera 1 selected
PC5 CAM_CTRL OUTPUT HIGH GPIO(82)
define RELAY3_PIN_DEFAULT 82

# LEDs
PB3 TIM2_CH2 TIM2 PWM(7) GPIO(56) # M7

PC14 LED0 OUTPUT LOW GPIO(90)
define HAL_GPIO_A_LED_PIN 90

PC15 LED1 OUTPUT LOW GPIO(91)
define HAL_GPIO_B_LED_PIN 91

# Dataflash setup
SPIDEV dataflash SPI3 DEVID1 FLASH1_CS MODE3 104*MHZ 104*MHZ

define HAL_LOGGING_DATAFLASH_ENABLED 1

# OSD setup
SPIDEV osd SPI2 DEVID1 OSD1_CS MODE0 10*MHZ 10*MHZ

define OSD_ENABLED 1
define HAL_OSD_TYPE_DEFAULT 1
ROMFS_WILDCARD libraries/AP_OSD/fonts/font*.bin

# IMU setup

# IMU setup
SPIDEV imu1 SPI1 DEVID1 GYRO1_CS MODE3 1*MHZ 8*MHZ
DMA_NOSHARE TIM8_UP TIM4_UP TIM3_UP SPI1*
DMA_PRIORITY TIM8_UP TIM4_UP TIM3_UP SPI1*

IMU Invensensev3 SPI:imu1 ROTATION_PITCH_180_YAW_270

# no built-in compass, but probe the i2c bus for all possible
# external compass types
define ALLOW_ARM_NO_COMPASS
define HAL_PROBE_EXTERNAL_I2C_COMPASSES
define HAL_I2C_INTERNAL_MASK 0
define HAL_COMPASS_AUTO_ROT_DEFAULT 2
define HAL_DEFAULT_INS_FAST_SAMPLE 3
# Motor order implies Betaflight/X for standard ESCs
define HAL_FRAME_TYPE_DEFAULT 12

# save some flash
include ../include/minimize_fpv_osd.inc
Loading