Skip to content
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

add DroneerF405 hwdef #28846

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

add DroneerF405 hwdef #28846

wants to merge 1 commit into from

Conversation

DroneerUAV
Copy link

@DroneerUAV DroneerUAV commented Dec 12, 2024

Add DroneerF405 board from Droneer UAV

@andyp1per
Copy link
Collaborator

andyp1per commented Dec 12, 2024

I recommend these changes:

diff --git a/libraries/AP_HAL_ChibiOS/hwdef/DroneerF405/hwdef.dat b/libraries/AP_HAL_ChibiOS/hwdef/DroneerF405/hwdef.dat
index 4063f183a1..96d622b26a 100644
--- a/libraries/AP_HAL_ChibiOS/hwdef/DroneerF405/hwdef.dat
+++ b/libraries/AP_HAL_ChibiOS/hwdef/DroneerF405/hwdef.dat
@@ -34,14 +34,14 @@ PA12 OTG_FS_DP OTG1
 PC5 VBUS INPUT OPENDRAIN

 # USART1(VTX)
-PA9  USART1_TX USART1
-PA10 USART1_RX USART1
+PA9  USART1_TX USART1 NODMA
+PA10 USART1_RX USART1 NODMA
 define DEFAULT_SERIAL1_PROTOCOL SerialProtocol_Tramp

 # USART2, RC input
 PA2 USART2_TX USART2
-PA3 USART2_RX USART2 NODMA
-define DEFAULT_SERIAL2_PROTOCOL SerialProtocol_MAVLink2
+PA3 USART2_RX USART2
+define DEFAULT_SERIAL2_PROTOCOL SerialProtocol_RCIN

 # default to timer for RC input
 #PA3 TIM9_CH2 TIM9 RCININT PULLDOWN LOW
@@ -70,10 +70,10 @@ define DEFAULT_SERIAL5_PROTOCOL SerialProtocol_None

 # PWM output. 1 - 8 on ESC header
 # --------------------- PWM -----------------------
-PC6  TIM8_CH1   TIM8  PWM(1)  GPIO(50)
+PC6  TIM8_CH1   TIM8  PWM(1)  GPIO(50) BIDIR
 PC7  TIM8_CH2   TIM8  PWM(2)  GPIO(51)
 PC8  TIM8_CH3   TIM8  PWM(3)  GPIO(52)
-PC9  TIM8_CH4   TIM8  PWM(4)  GPIO(53)
+PC9  TIM8_CH4   TIM8  PWM(4)  GPIO(53) BIDIR
 PA15 TIM2_CH1   TIM2  PWM(5)  GPIO(54)
 PA8  TIM1_CH1   TIM1  PWM(6)  GPIO(55)
 PB10 TIM2_CH3   TIM2  PWM(7)  GPIO(56)
@@ -174,7 +174,7 @@ define HAL_OSD_TYPE_DEFAULT 1
 # Font for the osd
 ROMFS_WILDCARD libraries/AP_OSD/fonts/font*.bin

-DMA_PRIORITY TIM2* TIM3*
+DMA_PRIORITY TIM8* TIM3*

 # minimal drivers to reduce flash usage
 include ../include/minimize_fpv_osd.inc

Copy link
Collaborator

@andyp1per andyp1per left a comment

Choose a reason for hiding this comment

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

Needs a README.md
Suggest the changes I outlined

OSCILLATOR_HZ 8000000

# board ID for firmware load
APJ_BOARD_ID 1054
Copy link
Collaborator

Choose a reason for hiding this comment

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

This ID is used. Please reserve an unused id

Copy link
Contributor

Choose a reason for hiding this comment

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

@DroneerUAV to be clear, you need to make an entry in Tools/AP_Bootloader/board_types.txt, reserving an ID for your board. You then you use either that numeric ID in here, or the board name you've used in board_types.txt

HAL_CHIBIOS_ARCH_F405 1

# board ID for firmware load
APJ_BOARD_ID 1054
Copy link
Collaborator

Choose a reason for hiding this comment

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

This id is used - need another one

@DroneerUAV
Copy link
Author

我建议进行以下更改:

diff --git a/libraries/AP_HAL_ChibiOS/hwdef/DroneerF405/hwdef.dat b/libraries/AP_HAL_ChibiOS/hwdef/DroneerF405/hwdef.dat
index 4063f183a1..96d622b26a 100644
--- a/libraries/AP_HAL_ChibiOS/hwdef/DroneerF405/hwdef.dat
+++ b/libraries/AP_HAL_ChibiOS/hwdef/DroneerF405/hwdef.dat
@@ -34,14 +34,14 @@ PA12 OTG_FS_DP OTG1
 PC5 VBUS INPUT OPENDRAIN

 # USART1(VTX)
-PA9  USART1_TX USART1
-PA10 USART1_RX USART1
+PA9  USART1_TX USART1 NODMA
+PA10 USART1_RX USART1 NODMA
 define DEFAULT_SERIAL1_PROTOCOL SerialProtocol_Tramp

 # USART2, RC input
 PA2 USART2_TX USART2
-PA3 USART2_RX USART2 NODMA
-define DEFAULT_SERIAL2_PROTOCOL SerialProtocol_MAVLink2
+PA3 USART2_RX USART2
+define DEFAULT_SERIAL2_PROTOCOL SerialProtocol_RCIN

 # default to timer for RC input
 #PA3 TIM9_CH2 TIM9 RCININT PULLDOWN LOW
@@ -70,10 +70,10 @@ define DEFAULT_SERIAL5_PROTOCOL SerialProtocol_None

 # PWM output. 1 - 8 on ESC header
 # --------------------- PWM -----------------------
-PC6  TIM8_CH1   TIM8  PWM(1)  GPIO(50)
+PC6  TIM8_CH1   TIM8  PWM(1)  GPIO(50) BIDIR
 PC7  TIM8_CH2   TIM8  PWM(2)  GPIO(51)
 PC8  TIM8_CH3   TIM8  PWM(3)  GPIO(52)
-PC9  TIM8_CH4   TIM8  PWM(4)  GPIO(53)
+PC9  TIM8_CH4   TIM8  PWM(4)  GPIO(53) BIDIR
 PA15 TIM2_CH1   TIM2  PWM(5)  GPIO(54)
 PA8  TIM1_CH1   TIM1  PWM(6)  GPIO(55)
 PB10 TIM2_CH3   TIM2  PWM(7)  GPIO(56)
@@ -174,7 +174,7 @@ define HAL_OSD_TYPE_DEFAULT 1
 # Font for the osd
 ROMFS_WILDCARD libraries/AP_OSD/fonts/font*.bin

-DMA_PRIORITY TIM2* TIM3*
+DMA_PRIORITY TIM8* TIM3*

 # minimal drivers to reduce flash usage
 include ../include/minimize_fpv_osd.inc

1734343967586(1)
Does the suggestion here need to be changed? Our hardware serial port 2 must be added with NODMA in order to work normally

@Hwurzburg Hwurzburg self-requested a review December 25, 2024 16:28
@andyp1per
Copy link
Collaborator

我建议进行以下更改:

diff --git a/libraries/AP_HAL_ChibiOS/hwdef/DroneerF405/hwdef.dat b/libraries/AP_HAL_ChibiOS/hwdef/DroneerF405/hwdef.dat
index 4063f183a1..96d622b26a 100644
--- a/libraries/AP_HAL_ChibiOS/hwdef/DroneerF405/hwdef.dat
+++ b/libraries/AP_HAL_ChibiOS/hwdef/DroneerF405/hwdef.dat
@@ -34,14 +34,14 @@ PA12 OTG_FS_DP OTG1
 PC5 VBUS INPUT OPENDRAIN

 # USART1(VTX)
-PA9  USART1_TX USART1
-PA10 USART1_RX USART1
+PA9  USART1_TX USART1 NODMA
+PA10 USART1_RX USART1 NODMA
 define DEFAULT_SERIAL1_PROTOCOL SerialProtocol_Tramp

 # USART2, RC input
 PA2 USART2_TX USART2
-PA3 USART2_RX USART2 NODMA
-define DEFAULT_SERIAL2_PROTOCOL SerialProtocol_MAVLink2
+PA3 USART2_RX USART2
+define DEFAULT_SERIAL2_PROTOCOL SerialProtocol_RCIN

 # default to timer for RC input
 #PA3 TIM9_CH2 TIM9 RCININT PULLDOWN LOW
@@ -70,10 +70,10 @@ define DEFAULT_SERIAL5_PROTOCOL SerialProtocol_None

 # PWM output. 1 - 8 on ESC header
 # --------------------- PWM -----------------------
-PC6  TIM8_CH1   TIM8  PWM(1)  GPIO(50)
+PC6  TIM8_CH1   TIM8  PWM(1)  GPIO(50) BIDIR
 PC7  TIM8_CH2   TIM8  PWM(2)  GPIO(51)
 PC8  TIM8_CH3   TIM8  PWM(3)  GPIO(52)
-PC9  TIM8_CH4   TIM8  PWM(4)  GPIO(53)
+PC9  TIM8_CH4   TIM8  PWM(4)  GPIO(53) BIDIR
 PA15 TIM2_CH1   TIM2  PWM(5)  GPIO(54)
 PA8  TIM1_CH1   TIM1  PWM(6)  GPIO(55)
 PB10 TIM2_CH3   TIM2  PWM(7)  GPIO(56)
@@ -174,7 +174,7 @@ define HAL_OSD_TYPE_DEFAULT 1
 # Font for the osd
 ROMFS_WILDCARD libraries/AP_OSD/fonts/font*.bin

-DMA_PRIORITY TIM2* TIM3*
+DMA_PRIORITY TIM8* TIM3*

 # minimal drivers to reduce flash usage
 include ../include/minimize_fpv_osd.inc

1734343967586(1) Does the suggestion here need to be changed? Our hardware serial port 2 must be added with NODMA in order to work normally

I don't think so. We discussed this on discord, you need to use an actual serial protocol

@DroneerUAV
Copy link
Author

@andyp1per I have addressed the requested changes,Please review the updated PR

Copy link
Collaborator

@andyp1per andyp1per left a comment

Choose a reason for hiding this comment

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

Looking good

@@ -413,6 +413,13 @@ AP_HW_ZeroOne_GNSS 5602
AP_HW_DroneBuild_G1 5700
AP_HW_DroneBuild_G2 5701

#IDs 5700-5710 reserved for DroneBuild
AP_HW_DroneBuild_G1 5700
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is a dup of the two lines above please remove

Copy link
Author

Choose a reason for hiding this comment

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

oh sry,now that I've changed it,please review

Copy link
Collaborator

@Hwurzburg Hwurzburg left a comment

Choose a reason for hiding this comment

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

in addition to changes listed, commits will need to be squashed and then split into one for Tools: add DronnerF405(for Tools library files)
and hwdef: add DroneerF405(for hwdef library files)

OSCILLATOR_HZ 8000000

# board ID for firmware load
APJ_BOARD_ID 5800
Copy link
Collaborator

Choose a reason for hiding this comment

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

use text name

Suggested change
APJ_BOARD_ID 5800
APJ_BOARD_ID AP_HW_DroneerF405

HAL_CHIBIOS_ARCH_F405 1

# board ID for firmware load
APJ_BOARD_ID 5800
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
APJ_BOARD_ID 5800
APJ_BOARD_ID AP_HW_DroneerF405

# USART3
PC10 USART3_TX USART3 NODMA
PC11 USART3_RX USART3 NODMA
define DEFAULT_SERIAL3_PROTOCOL SerialProtocol_ESCTelemetry
Copy link
Collaborator

Choose a reason for hiding this comment

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

this does not match your wiring diagram or product info sheet

Suggested change
define DEFAULT_SERIAL3_PROTOCOL SerialProtocol_ESCTelemetry
define DEFAULT_SERIAL3_PROTOCOL SerialProtocol_None


# UART5
PC12 UART5_TX UART5 NODMA
PD2 UART5_RX UART5 NODMA
Copy link
Collaborator

Choose a reason for hiding this comment

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

does not match pinout or wiring diagram

Suggested change
PD2 UART5_RX UART5 NODMA
PD2 UART5_RX UART5 NODMA
define DEFAULT_SERIAL5_PROTOCOL SerialProtocol_ESCTelemetry

## Features

- STM32F405 microcontroller
- MPU6000 IMU
Copy link
Collaborator

Choose a reason for hiding this comment

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

incorrect

Suggested change
- MPU6000 IMU
- ICM42688-P IMU


The Droneer F405 supports OSD using OSD_TYPE 1 (MAX7456 driver).

## VTX Support
Copy link
Collaborator

Choose a reason for hiding this comment

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

remove this secttion...no such connector exists

## PWM Output

The Droneer F405 supports up to 9 PWM outputs. The pads for motor output
M1 to M4 on the motor connector, plus M9 for LED strip or another
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
M1 to M4 on the motor connector, plus M9 for LED strip or another
M1 to M4 on the motor connector, plus M9(marked LED) for LED strip or another

## Battery Monitoring

The board has a internal voltage sensor and connections on the ESC connector for an external current sensor input.
The voltage sensor can handle up to 6S.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
The voltage sensor can handle up to 6S.
The voltage sensor can handle up to 8S.

## Compass

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

add this section:

Suggested change
## Firmware
Firmware for this board can be found here in sub-folders labeled “DroneerF405i”.


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.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
*.apj firmware files.
\*.apj firmware files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants