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

Addition for Target Brahma F4 #27936

Open
wants to merge 38 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
bdc7258
Add files via upload
ShadowWalker8642 Aug 26, 2024
59a3ea3
Merge branch 'master' into ShadowWalker8642-DMF4
ShadowWalker8642 Aug 27, 2024
6ba19a4
Merge branch 'master' into ShadowWalker8642-DMF4
ShadowWalker8642 Aug 28, 2024
60a0447
Add files via upload
ShadowWalker8642 Aug 28, 2024
62d5c8f
Create README.md
ShadowWalker8642 Aug 28, 2024
901acd0
Update README.md
ShadowWalker8642 Aug 28, 2024
fdb01f8
Update README.md
ShadowWalker8642 Aug 28, 2024
03b0737
Update README.md
ShadowWalker8642 Aug 28, 2024
ff5a79e
Update README.md
ShadowWalker8642 Aug 28, 2024
15cd65f
Update README.md
ShadowWalker8642 Aug 28, 2024
35c9711
Update README.md
ShadowWalker8642 Aug 28, 2024
f1e290f
Update README.md
ShadowWalker8642 Aug 28, 2024
b5cb2fd
Update README.md
ShadowWalker8642 Aug 28, 2024
e1e34f2
Add target brahma f4 id board_types.txt
ShadowWalker8642 Aug 28, 2024
5bac5b7
Update libraries/AP_HAL_ChibiOS/hwdef/BrahmaF4/README.md
ShadowWalker8642 Aug 28, 2024
3d5d288
Update libraries/AP_HAL_ChibiOS/hwdef/BrahmaF4/README.md
ShadowWalker8642 Aug 28, 2024
ba05453
Update README.md
ShadowWalker8642 Aug 28, 2024
ff7f89e
Update README.md
ShadowWalker8642 Aug 28, 2024
6d71dcf
Update libraries/AP_HAL_ChibiOS/hwdef/BrahmaF4/README.md
ShadowWalker8642 Aug 28, 2024
8a5ad8b
Update defaults.parm
ShadowWalker8642 Aug 28, 2024
f1a1704
hwdef.dat file cleanup
ShadowWalker8642 Aug 28, 2024
5333787
Update libraries/AP_HAL_ChibiOS/hwdef/BrahmaF4/README.md
ShadowWalker8642 Aug 28, 2024
5ce3d5e
Update README.md
ShadowWalker8642 Aug 28, 2024
c713e0b
Merge branch 'ArduPilot:master' into ShadowWalker8642-DMF4
ShadowWalker8642 Aug 29, 2024
31824b6
Update hwdef.dat
ShadowWalker8642 Aug 29, 2024
1e378f7
Merge branch 'master' into ShadowWalker8642-DMF4
ShadowWalker8642 Aug 30, 2024
ff44097
Update README.md
ShadowWalker8642 Aug 30, 2024
cadb027
Merge branch 'ArduPilot:master' into ShadowWalker8642-DMF4
ShadowWalker8642 Sep 11, 2024
4e30ccb
Merge branch 'ArduPilot:master' into ShadowWalker8642-DMF4
ShadowWalker8642 Sep 19, 2024
cc144d6
Update libraries/AP_HAL_ChibiOS/hwdef/BrahmaF4/hwdef.dat
ShadowWalker8642 Nov 12, 2024
a9bbafc
Merge branch 'master' into ShadowWalker8642-DMF4
ShadowWalker8642 Nov 12, 2024
390679f
Merge branch 'master' into ShadowWalker8642-DMF4
ShadowWalker8642 Nov 24, 2024
072d7f2
Update libraries/AP_HAL_ChibiOS/hwdef/BrahmaF4/README.md
ShadowWalker8642 Dec 8, 2024
743c275
Update libraries/AP_HAL_ChibiOS/hwdef/BrahmaF4/README.md
ShadowWalker8642 Dec 8, 2024
2d84cc0
Merge branch 'master' into ShadowWalker8642-DMF4
ShadowWalker8642 Feb 8, 2025
baa5d96
Board ID update
ShadowWalker8642 Feb 8, 2025
14a08ba
Merge branch 'master' into ShadowWalker8642-DMF4
ShadowWalker8642 Feb 8, 2025
2a0d12a
Update board_types.txt
ShadowWalker8642 Feb 10, 2025
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
5 changes: 5 additions & 0 deletions Tools/AP_Bootloader/board_types.txt
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,11 @@ AP_HW_DroneBuild_G2 5701
# IDs 7000-7099 reserved for CUAV
AP_HW_CUAV-7-NANO 7000

AP_HW_BrahmaF4 7010
ShadowWalker8642 marked this conversation as resolved.
Show resolved Hide resolved

# IDs 7100-7109 reserved for VIEWPRO
Copy link
Collaborator

Choose a reason for hiding this comment

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

this will definitely cause a failure by double defining

AP_HW_VUAV-V7pro 7100

# IDs 7100-7109 reserved for V-UAV
AP_HW_VUAV-V7pro 7100

Expand Down
Binary file added Tools/bootloaders/BrahmaF4_bl.bin
Binary file not shown.
Binary file added Tools/bootloaders/BrahmaF4_bl.elf
Binary file not shown.
893 changes: 893 additions & 0 deletions Tools/bootloaders/BrahmaF4_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.
102 changes: 102 additions & 0 deletions libraries/AP_HAL_ChibiOS/hwdef/BrahmaF4/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@

# Brahma F4 Flight Controller

Brahma F4 is a flight controller manufactured by [Darkmatter®](https://thedarkmatter.in)

## Features

- MCU: STM32F405RGT6, 168MHz
- Gyro: BMI270
- 32MB Onboard Flash (32 Megabyte)
- BEC output: 5V, 2A@4V
- Barometer: BMP280
- OSD: AT7456E
- 4 UARTS: (UART1, UART3, UART4, UART6)
- 9 PWM Outputs (includes 1 neopixel out can be used for pwm)
- 5V Power Out: 2.0A max
- 9V Power Out: 2.0A max



## Pinout for BRAHMA F405

![BrahmaF405](BRAHMA_F405-diagram.jpg "DM_BrahmaF4")



## UART Mapping

The UARTs are marked Rx and Tx in the above pinouts.

| Name | Pad | Port | Function |
| :------- | :------- | :------ | :------------------ |
| SERIAL 0 | DM/DP | USB | Mavlink |
| SERIAL 1 | RX1/TX1 | USART 1 | (DMA) (Reciever) |
| SERIAL 2 | RX3/TX3 | USART 3 | (NODMA) (MAVLINK) |
| SERIAL 3 | RX4/TX4 | USART 4 | (NODMA) (GPS2) |
ShadowWalker8642 marked this conversation as resolved.
Show resolved Hide resolved
| SERIAL 4 | RX6/TX6 | USART 6 | (DMA) (GPS) |
ShadowWalker8642 marked this conversation as resolved.
Show resolved Hide resolved

USART1 and USART6 supports RX and TX DMA.
UART2 and UART4 do not support DMA.
ESC Telemetry need to be manually configured based upon esc.


## RC Input

RC input is configured by default on the R1 T1 (UART1) pads (CRSF or ELRS).
SBUS inverted pad is available
(PPM is disabled currently)


## OSD
- ANALOG OSD (MAX7456) (SPI1) (Preconfigured)
- DIGITAL OSD (MSP) (UART4 can be used for MSP Displayport by chnaging SERIAL2_
PROTOCOL to "42")


## PWM Output

The PWM is in 5 groups:

- PWM 1,2 in group1
- PWM 3,4 in group2
- PWM 5 in group3
- PWM 6-8 in group4
- PWM 9 in group5

Pads for PWM 1-8 are available on bottom side of pcb
ESC port is a jst-sh V-G-C-R3-1-2-3-4

*NOTE*
Channels within the same group need to use the same output rate.
All channels in specific Timer groups are configured either as DSHOT or PWM,
mixing of protocols within groups is not possible.
Channel 9 is configured as NeoPixel can be configured for extra pwm.


## Battery Monitoring

The board has a builtin voltage sensor, voltage sensor supports up to 6S LiPo.
The default battery configuration is:

- BATT_MONITOR 4
- BATT_VOLT_PIN 14
- BATT_VOLT_MULT 11
- BATT_CURR_PIN 13
- BATT_CURR_MULT 37


## Compass & Baro

Internal DPS310 Baro.
No Internal Compass.
External on I2C BUS1.


## Loading Firmware

Initial firmware and bootloader load can be done via DFU by plugging in USB while the bootloader button is held.
Then flash the "*_with_bl.hex" or "AP_Bootloader.hex", using your preferred DFU programming tool.

Once the initial firmware or bootloader is flashed you can update the firmware using "Mission Planner" or "QGroundControl".
Future updates should be done via the *.apj firmware files.
3 changes: 3 additions & 0 deletions libraries/AP_HAL_ChibiOS/hwdef/BrahmaF4/defaults.parm
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SERVO9_FUNCTION 120
NTF_LED_TYPES 257
NTF_LED_LEN 6
46 changes: 46 additions & 0 deletions libraries/AP_HAL_ChibiOS/hwdef/BrahmaF4/hwdef-bl.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# hw definition file for processing by chibios_pins.py
# for Brahma F405 bootloader
#File Author [email protected]

USB_STRING_MANUFACTURER "DM"
USB_STRING_PRODUCT "BRAHMAf4"

# MCU class and specific type
MCU STM32F4xx STM32F405xx

# board ID for firmware load
APJ_BOARD_ID 7701

# crystal frequency
OSCILLATOR_HZ 8000000

FLASH_SIZE_KB 1024

# bootloader is installed at zero offset
FLASH_RESERVE_START_KB 0

# LEDs
PA8 LED_BOOTLOADER OUTPUT LOW
define HAL_LED_ON 0

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


# order of UARTs
SERIAL_ORDER OTG1

PA11 OTG_FS_DM OTG1
PA12 OTG_FS_DP OTG1
PA13 JTMS-SWDIO SWD
PA14 JTCK-SWCLK SWD


PA10 USART1_RX USART1 HIGH PULLUP
PA1 UART4_RX UART4 NODMA HIGH PULLUP
PC7 USART6_RX USART6 HIGH PULLUP

# Add CS pins to ensure they are high in bootloader
PB12 FLASH_CS CS
PA4 OSD_CS CS
PB3 GYRO_CS CS
139 changes: 139 additions & 0 deletions libraries/AP_HAL_ChibiOS/hwdef/BrahmaF4/hwdef.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
# hw definition file for processing by chibios_pins.py
# for Brahma F405 FW
#File Author [email protected]

USB_STRING_MANUFACTURER "DM"
USB_STRING_PRODUCT "BrahmaF4"

# MCU class and specific type
MCU STM32F4xx STM32F405xx

# board ID for firmware load
APJ_BOARD_ID 7701

# crystal frequency
OSCILLATOR_HZ 8000000

STM32_ST_USE_TIMER 5

# flash size
FLASH_SIZE_KB 1024
FLASH_RESERVE_START_KB 48
define HAL_STORAGE_SIZE 16384
define STORAGE_FLASH_PAGE 1

################# UART Configuration ##################
SERIAL_ORDER OTG1 USART1 USART3 USART6 UART4

PA11 OTG_FS_DM OTG1
PA12 OTG_FS_DP OTG1

PA10 USART1_RX USART1
PA9 USART1_TX USART1
define DEFAULT_SERIAL1_PROTOCOL SerialProtocol_RCIN

PB10 USART3_TX USART3 NODMA
ShadowWalker8642 marked this conversation as resolved.
Show resolved Hide resolved
PB11 USART3_RX USART3 NODMA
define DEFAULT_SERIAL3_PROTOCOL SerialProtocol_ESCTelemetry
PA0 UART4_TX UART4 NODMA
PA1 UART4_RX UART4 NODMA

PC6 USART6_TX USART6
PC7 USART6_RX USART6

##################SPI Configuration##############
PA5 SPI1_SCK SPI1
PA6 SPI1_MISO SPI1
PA7 SPI1_MOSI SPI1
PA4 OSD1_CS CS

PB15 SPI2_MOSI SPI2
PB14 SPI2_MISO SPI2
PB13 SPI2_SCK SPI2
PB12 FLASH1_CS CS

PC12 SPI3_MOSI SPI3
PC11 SPI3_MISO SPI3
PC10 SPI3_SCK SPI3
PB3 GYRO1_CS CS

SPIDEV osd SPI1 DEVID4 OSD1_CS MODE0 10*MHZ 10*MHZ
SPIDEV dataflash SPI2 DEVID2 FLASH1_CS MODE3 32*MHZ 32*MHZ
SPIDEV imu1 SPI3 DEVID1 GYRO1_CS MODE3 1*MHZ 4*MHZ
DMA_NOSHARE SPI3*
DMA_PRIORITY TIM1* TIM2* TIM2* TIM4* SPI3* TIM8*
IMU BMI270 SPI:imu1 ROTATION_ROLL_180

####################I2C bus Configuration##########
#define HAL_USE_I2C TRUE
#define STM32_I2C_USE_I2C1 TRUE
I2C_ORDER I2C1
PB6 I2C1_SCL I2C1 PULLUP
PB7 I2C1_SDA I2C1 PULLUP
BARO DPS310 I2C:0:0x77
define AP_BARO_BACKEND_DEFAULT_ENABLED 1
define HAL_BARO_ALLOW_INIT_NO_BARO 1
define AP_BARO_DPS280_ENABLED 1
define AP_BARO_BMP280_ENABLED 1

# no built-in compass
# 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

#############GPIO Motors###############
PB1 TIM1_CH3N TIM1 PWM(1) GPIO(50)
PB0 TIM1_CH2N TIM1 PWM(2) GPIO(51)

PA3 TIM2_CH4 TIM2 PWM(3) GPIO(52)
PA2 TIM2_CH3 TIM2 PWM(4) GPIO(53)

PB9 TIM4_CH4 TIM4 PWM(5) GPIO(54)

PB4 TIM3_CH1 TIM3 PWM(6) GPIO(55)
PB5 TIM3_CH2 TIM3 PWM(7) GPIO(56)
PC9 TIM3_CH4 TIM3 PWM(8) GPIO(57)

PC8 TIM8_CH3 TIM8 PWM(9) GPIO(58) # LED NOPIXEL

#PA15 TIM2_CH1 TIM2 RCININT PULLDOWN LOW

# Motor order implies Betaflight/X for standard ESCs
define HAL_FRAME_TYPE_DEFAULT 12

#ADC definitions
PC3 BATT_CURRENT_SENS ADC1 SCALE(1)
define HAL_BATT_CURR_PIN 13
define HAL_BATT_CURR_SCALE 37.0

PC4 BATT_VOLTAGE_SENS ADC1 SCALE(1)
define HAL_BATT_VOLT_PIN 14
define HAL_BATT_VOLT_SCALE 11.0

PC5 RSSI_ADC ADC1
define BOARD_RSSI_ANA_PIN 15
define HAL_BATT_MONITOR_DEFAULT 4


#################Indicator LEDs#######################
ShadowWalker8642 marked this conversation as resolved.
Show resolved Hide resolved
define AP_NOTIFY_GPIO_LED_1_ENABLED 1
PA8 LED_YELLOW OUTPUT LOW GPIO(1)
define HAL_GPIO_A_LED_PIN 1


# enable logging to dataflash
define HAL_LOGGING_DATAFLASH_ENABLED 1

######################osd setup######################
define OSD_ENABLED 1
define HAL_OSD_TYPE_DEFAULT 1
ShadowWalker8642 marked this conversation as resolved.
Show resolved Hide resolved
ROMFS_WILDCARD libraries/AP_OSD/fonts/font0.bin


################### Save Some Flash #################
#disable parachute and sprayer to save flash
define HAL_PARACHUTE_ENABLED 0
include ../include/minimize_fpv_osd.inc
include ../include/no_bootloader_DFU.inc
Loading