Skip to content
Closed
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
Binary file added Tools/bootloaders/BrahmaF4_bl.bin
Binary file not shown.
892 changes: 892 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

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 that 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 Default Protocol
========== ========== ======= ====================
SERIAL 0 DM/DP USB Mavlink
SERIAL 1 RX1/TX1 USART 1 RCin (DMA)
SERIAL 2 RX3/TX3 USART 3 ESC
SERIAL 3 RX6/TX6 USART 6 GPS1 (DMA)
SERIAL 4 RX4/TX4 USART 4 GPS2
========== ========== ======= ====================

* 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 and T1 (UART1) pads (CRSF or ELRS).
SBUS pad is inverted and applied to R1

* FPort requires connection to T1 and :ref:`SERIAL1_OPTIONS<SERIAL1_OPTIONS>` be set to “7”.
* CRSF also requires a T1 connection, in addition to R1, and automatically provides telemetry. Set :ref:`SERIAL1_OPTIONS<SERIAL1_OPTIONS>` to “0”.
* SRXL2 requires a connecton to T1 and automatically provides telemetry. Set :ref:`SERIAL1_OPTIONS<SERIAL1_OPTIONS>` to “4”.

Any UART can be used for RC system connections in ArduPilot also, and is compatible with all protocols except PPM. See Radio Control Systems for details.


## OSD
- ANALOG OSD (MAX7456) (SPI1) (Preconfigured)
- DIGITAL OSD (MSP) (UART4 can be used for MSP Displayport by changing :ref:`SERIAL4_PROTOCOL<SERIAL4_PROTOCOL>` to "42")


## PWM Output
The autopilot supports up to 9 PWM outputs (PWM 9 is defaulted to serial LED support). Outputs are available a standard ESC JST-SH connectors and solder pads for M5-M8. All outputs support DShot,as well as all PWM types.

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

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 by default but can be configured for and extra PWM output.


## 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

The autopilot does not have a built-in compass, however you can attach an external compass using I2C on the SDA and SCL pads.


## Firmware¶

Firmware for this board can be found `here <https://firmware.ardupilot.org`__ in sub-folders labeled “BrahmaF4”.
Loading Firmware¶

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. Later updates should be done with 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 AP_HW_BrahmaF4

# 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
141 changes: 141 additions & 0 deletions libraries/AP_HAL_ChibiOS/hwdef/BrahmaF4/hwdef.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
# 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 AP_HW_BrahmaF4

# 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
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
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 TIM3_CH4 TIM3 PWM(1) GPIO(50) BIDIR
PB0 TIM3_CH3 TIM3 PWM(2) GPIO(51)

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

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 TIM8_CH4 TIM8 PWM(8) GPIO(57)

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

#PA15 TIM2_CH1 TIM2 RCININT PULLDOWN LOW

DMA_PRIORITY TIM3* TIM2* TIM4* SPI3* TIM8*
DMA_NOSHARE SPI3*

# 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#######################
define AP_NOTIFY_GPIO_LED_1_ENABLED 1
PA8 LED_YELLOW OUTPUT LOW GPIO(1)
define AP_NOTIFY_GPIO_LED_1_PIN 1


# enable logging to dataflash
define HAL_LOGGING_DATAFLASH_ENABLED 1

######################osd setup######################
define OSD_ENABLED 1
define HAL_OSD_TYPE_DEFAULT 1
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