Browse Source

AP_HAL_ChibiOS: Support for Diatone MambaF405 MK2

zr-v5.1
Sebastian Witt 4 years ago committed by Andrew Tridgell
parent
commit
6cfaae4e7d
  1. 84
      libraries/AP_HAL_ChibiOS/hwdef/MambaF405v2/README.md
  2. 39
      libraries/AP_HAL_ChibiOS/hwdef/MambaF405v2/hwdef-bl.dat
  3. 159
      libraries/AP_HAL_ChibiOS/hwdef/MambaF405v2/hwdef.dat
  4. BIN
      libraries/AP_HAL_ChibiOS/hwdef/MambaF405v2/mamba_f405mk2_board.jpg
  5. BIN
      libraries/AP_HAL_ChibiOS/hwdef/MambaF405v2/mamba_f405mk2_pinout.png

84
libraries/AP_HAL_ChibiOS/hwdef/MambaF405v2/README.md

@ -0,0 +1,84 @@ @@ -0,0 +1,84 @@
# Mamba F405 MK2 Flight Controller
https://www.diatone.us/products/mamba-f405-flight-controller-mk2
The Mamba F405 MK2 is a flight controller produced by [Diatone](https://www.diatone.us).
## Features
- STM32F405RGT6 microcontroller
- MPU6000 IMU
- AT7456E OSD
- 4 UARTs
- 4 PWM outputs
## Pinout
![Mamba F405 MK2 Board](mamba_f405mk2_pinout.png "Mamba F405 MK2")
## 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.
|Name|Pin|Function|
|:-|:-|:-|
|SERIAL0|COMPUTER|USB|
|SERIAL1|PPM/RX1/SBUS/TX1|UART1 (RC Input)|
|SERIAL3|TX3/RX3|UART3 (Telem1)|
|SERIAL6|TX6/RX6|UART6 (GPS)|
## RC Input
RC input is configured on the PPM (UART1_RX) pin. It supports all RC protocols.
The S.BUS pad provides an inverted input for S.BUS receivers.
## OSD Support
The Mamba F405 MK2 supports OSD using OSD_TYPE 1 (MAX7456 driver).
## PWM Output
The Mamba F405 MK2 supports up to 4 PWM outputs. The pads for motor output ESC1 to ESC4 on the above diagram are for the 4 outputs. All 4 outputs support DShot as well as all PWM types.
The PWM are in one group.
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.
## Battery Monitoring
The board has a builting voltage sensor. The voltage sensor can handle up to 6S
LiPo batteries.
The correct battery setting parameters are:
- BATT_MONITOR 3
- BATT_VOLT_PIN 11
- BATT_VOLT_MULT around 12.0
- BATT_CURR_PIN 13
- BATT_CURR_MULT around 39 with the included 40A ESC
## Compass
The Mamba F405 MK2 does not have a builting compass, but you can attach an external compass using I2C on the SDA and SCL pads.
## Alternate settings
It is possible to set alternate configurations with the BRD_ALT_CONFIG parameter.
|BRD_ALT_CONFIG|RX1 function|
|:----|:----|
|ALT 0(default) |RCININT|
|ALT 1|RX1/TX1|
## 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. Updates should be done with the
*.apj firmware files.

39
libraries/AP_HAL_ChibiOS/hwdef/MambaF405v2/hwdef-bl.dat

@ -0,0 +1,39 @@ @@ -0,0 +1,39 @@
# hw definition file for processing by chibios_pins.py
# for MambaF405 bootloader
# MCU class and specific type
MCU STM32F4xx STM32F405xx
# board ID for firmware load
APJ_BOARD_ID 1019
# crystal frequency
OSCILLATOR_HZ 8000000
FLASH_SIZE_KB 1024
# don't allow bootloader to use more than 16k
FLASH_USE_MAX_KB 16
# bootloader is installed at zero offset
FLASH_RESERVE_START_KB 0
# LEDs
PB5 LED_BOOTLOADER OUTPUT LOW # blue
PB4 LED_GREEN OUTPUT LOW # green
define HAL_LED_ON 0
# the location where the bootloader will put the firmware
FLASH_BOOTLOADER_LOAD_KB 64
# board voltage
STM32_VDD 330U
# order of UARTs
SERIAL_ORDER OTG1
PA11 OTG_FS_DM OTG1
PA12 OTG_FS_DP OTG1
define HAL_USE_EMPTY_STORAGE 1
define HAL_STORAGE_SIZE 15360

159
libraries/AP_HAL_ChibiOS/hwdef/MambaF405v2/hwdef.dat

@ -0,0 +1,159 @@ @@ -0,0 +1,159 @@
# hw definition file for processing by chibios_pins.py
# Mamba F405 MK2
# With F405 MCU, MPU6000 IMU and 7456 series OSD
# Based on Mamba F405 from jeanphilippehell
@ thanks to betaflight for pin information
# MCU class and specific type.
MCU STM32F4xx STM32F405xx
HAL_CHIBIOS_ARCH_F405 1
# board ID for firmware load
APJ_BOARD_ID 1019
# crystal frequency
OSCILLATOR_HZ 8000000
# board voltage
STM32_VDD 330U
STM32_ST_USE_TIMER 5
# order of I2C buses
I2C_ORDER I2C1
# order of UARTs (and USB)
# this order follows the labels on the board
# namely COMPUTER, PPM/SBUS (configurable as USART), TX3/RX3, TX6/RX6
SERIAL_ORDER OTG1 USART1 EMPTY USART3 EMPTY EMPTY USART6
# The pins that USB is connected on
PA11 OTG_FS_DM OTG1
PA12 OTG_FS_DP OTG1
PC5 VBUS INPUT OPENDRAIN
# USART1 is wired to SBUS and PPM input
# RC input defaults to timer capture
PA10 TIM1_CH3 TIM1 RCININT PULLDOWN
PA9 USART1_TX USART1 NODMA
# Alt config to allow RCIN on UART
PA10 USART1_RX USART1 NODMA ALT(1)
# SBUS inversion control pin, active low
PC0 USART1_RXINV OUTPUT HIGH GPIO(78) POL(0)
# USART3
PB10 USART3_TX USART3
PB11 USART3_RX USART3
# USART6
PC6 USART6_TX USART6
PC7 USART6_RX USART6
# The pins for SWD debugging with a STlinkv2 or black-magic probe (not tested)
PA13 JTMS-SWDIO SWD
PA14 JTCK-SWCLK SWD
# ADC
PC1 BAT_VOLT_SENS ADC1 SCALE(1)
PC2 RSSI_IN ADC1
PC3 BAT_CURR_SENS ADC1 SCALE(1)
# PWM output. 1 - 4 on ESC header
PA3 TIM2_CH4 TIM2 PWM(1) GPIO(50)
PB0 TIM3_CH3 TIM3 PWM(2) GPIO(51)
PB1 TIM3_CH4 TIM3 PWM(3) GPIO(52)
PA2 TIM2_CH3 TIM2 PWM(4) GPIO(53)
# Board LEDs
PB5 LED_BLUE OUTPUT LOW GPIO(1)
PB4 LED_GREEN OUTPUT LOW GPIO(2)
define HAL_GPIO_A_LED_PIN 1
define HAL_GPIO_B_LED_PIN 2
# External LEDs
PA0 LED_EXT1 OUTPUT GPIO(30)
# Buzzer
PA8 BUZZER OUTPUT GPIO(80) LOW
define HAL_BUZZER_PIN 80
define HAL_BUZZER_ON 1
define HAL_BUZZER_OFF 0
# Note that this board needs PULLUP on I2C pins
PB6 I2C1_SCL I2C1 PULLUP
PB7 I2C1_SDA I2C1 PULLUP
# SPI1 - Internal IMU
PA4 MPU6000_CS CS
PA5 SPI1_SCK SPI1
PA6 SPI1_MISO SPI1
PA7 SPI1_MOSI SPI1
# SPI2 - OSD
PB15 SPI2_MOSI SPI2
PB14 SPI2_MISO SPI2
PB13 SPI2_SCK SPI2
# OSD max7456
PB12 OSD_CS CS
# SPI3 - dataflash
PC10 SPI3_SCK SPI3
PC11 SPI3_MISO SPI3
PC12 SPI3_MOSI SPI3
# Dataflash M25P16
PB3 FLASH_CS CS
# SPI Device table
SPIDEV mpu6000 SPI1 DEVID1 MPU6000_CS MODE3 1*MHZ 4*MHZ
SPIDEV dataflash SPI3 DEVID1 FLASH_CS MODE3 32*MHZ 32*MHZ
SPIDEV osd SPI2 DEVID4 OSD_CS MODE0 10*MHZ 10*MHZ
# One IMU rotated in yaw
IMU Invensense SPI:mpu6000 ROTATION_YAW_90
# Probe for I2C BMP280, but allow init on board variants without onboard baro too
BARO BMP280 I2C:0:0x76
define HAL_PROBE_EXTERNAL_I2C_BAROS
define HAL_BARO_ALLOW_INIT_NO_BARO
# no built-in compass, but probe the i2c bus for all possible
# external compass types
define ALLOW_ARM_NO_COMPASS
define HAL_COMPASS_DEFAULT HAL_COMPASS_NONE
define HAL_PROBE_EXTERNAL_I2C_COMPASSES
define HAL_I2C_INTERNAL_MASK 0
define HAL_COMPASS_AUTO_ROT_DEFAULT 2
# enable logging to dataflash
define HAL_LOGGING_DATAFLASH
define HAL_STORAGE_SIZE 16384
define STORAGE_FLASH_PAGE 1
# flash size
FLASH_SIZE_KB 1024
# reserve 32k for bootloader and 32k for flash storage
FLASH_RESERVE_START_KB 64
# define default battery setup
define HAL_BATT_VOLT_PIN 11
define HAL_BATT_CURR_PIN 13
define HAL_BATT_VOLT_SCALE 12
define HAL_BATT_CURR_SCALE 39
# Analog RSSI pin (also could be used as analog airspeed input)
define BOARD_RSSI_ANA_PIN 1
# Setup for OSD
define OSD_ENABLED 1
define HAL_OSD_TYPE_DEFAULT 1
# Font for the osd
ROMFS_WILDCARD libraries/AP_OSD/fonts/font*.bin
# To complementary channels work we define this
#define STM32_PWM_USE_ADVANCED TRUE
define BOARD_PWM_COUNT_DEFAULT 4

BIN
libraries/AP_HAL_ChibiOS/hwdef/MambaF405v2/mamba_f405mk2_board.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

BIN
libraries/AP_HAL_ChibiOS/hwdef/MambaF405v2/mamba_f405mk2_pinout.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 198 KiB

Loading…
Cancel
Save