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

AP_HAL_ChibiOS: add new target Stellar H7V2 #28926

Open
wants to merge 2 commits 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
Binary file added Tools/bootloaders/StellarH7V2_bl.bin
Binary file not shown.
1,170 changes: 1,170 additions & 0 deletions Tools/bootloaders/StellarH7V2_bl.hex

Large diffs are not rendered by default.

110 changes: 110 additions & 0 deletions libraries/AP_HAL_ChibiOS/hwdef/StellarH7V2/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# StellarH7V2 Flight Controller

https://stingbee.com.ua/flight_controllers/stellarh7v2


## Features
Processor
STM32H743VIH6 480 MHz, 2MB flash
Sensors
ICM-42688p Acc/Gyro with external clock feature
DPS310/BMP280 barometer
AT7456E OSD
SD Card
Power
2S-8S Lipo input voltage with voltage monitoring
12V, 3A BEC for powering Video Transmitter
5V, 2A BEC for internal and peripherals
Interfaces
10x PWM outputs DShot capable, 4 outputs BDShot capable
7x UARTs
1x CAN
1x I2C
3x ADC
SD card for logging
USB-C port
LED
Red, 3.3V power indicator
Blue and Green, FC status
Size
41 x 41mm PCB with 30.5mm M3 mounting


## Overview

![StellarH7V2](Stellar_H7V2.png)

![StellarH7V2](StellarH7V2.png)

## UART Mapping

The UARTs are marked Rx* and Tx* in the above pinouts. The Rx* pin is the
receive pin for UART*. The Tx* pin is the transmit pin for UART*. All UARTS are DMA capable.

- SERIAL0 -> USB
- SERIAL1 -> UART1 (MAVLink2)
- SERIAL2 -> UART2 (MAVLink2)
- SERIAL3 -> UART3 (User)
- SERIAL4 -> UART4 (Serial RC input)
- SERIAL5 -> UART6 (GPS)
- SERIAL6 -> UART7 (DisplayPort)
- SERIAL7 -> UART8 (ESC Telemetry, RX8 pin only)

## CAN and I2C

StellarH7V2 supports 1x CAN bus and 1x I2C bus

## RC Input

The default RC input is configured on the UART4 RX4 input and can be used for all ArduPilot supported unidirectional receiver protocols.
* PPM is not supported.
* SBUS/DSM/SRXL connects to the RX4 pin.
* FPort requires connection to TX4 and :ref:`SERIAL4_OPTIONS<SERIAL4_OPTIONS>` set to "7". See :ref:`common-FPort-receivers`.
* CRSF also requires a TX4 connection, in addition to RX4, and automatically provides telemetry.
* SRXL2 requires a connection to TX4 and automatically provides telemetry. Set :ref:`SERIAL4_OPTIONS<SERIAL4_OPTIONS>` to “4”.


## OSD Support

StellarH7V2 supports using its internal OSD using OSD_TYPE 1 (MAX7456 driver). Simulatenous DisplayPort OSD operation is preconfigured on SERIAL 6 but requires OSD_TYPE2 = 5. See :ref:`common-msp-osd-overview-4.2` for more info.

## PWM Output

StellarH7V2 supports up to 10 PWM outputs. PWM 1-4 outputs support DShot.

All the channels support DShot. Channels 1-6 support bi-directional DShot. Channels 9 and 10 Marked as S5 and S6 on the board. PWM outputs are grouped and every group must use the same output protocol:
* 1, 2 are Group 1;
* 3, 4, 5, 6 are Group 2;
* 7, 8, 9, 10 are Group 3;


## Battery Monitoring

The board has 1 built-in voltage dividers and 2x current ADC. support external 3.3V based current sensor

The voltage input is compatible with 2~8S LiPo batteries.
The default battery parameters are:
* :ref:`BATT_MONITOR<BATT_MONITOR>` = 4
* :ref:`BATT_VOLT_PIN<BATT_VOLT_PIN__AP_BattMonitor_Analog>` = 10
* :ref:`BATT_CURR_PIN<BATT_CURR_PIN__AP_BattMonitor_Analog>` = 11 (CURR pin)
* :ref:`BATT_VOLT_MULT<BATT_VOLT_MULT__AP_BattMonitor_Analog>` = 11
* :ref:`BATT_AMP_PERVLT<BATT_AMP_PERVLT__AP_BattMonitor_Analog>` = 10
* :ref:`BATT2_CURR_PIN<BATT2_CURR_PIN__AP_BattMonitor_Analog>` = 7 (ADC2 pin)


## Compass

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


## Loading Firmware
Firmware for these boards can be found at https://firmware.ardupilot.org in sub-folders labeled StellarH7V2.

Initial firmware load can be done with DFU by plugging in USB with the
boot button pressed. Then you should load the "ardu*_with_bl.hex" firmware, using your favourite DFU loading tool. eg STM32CubeProgrammer

Subsequently, you can update firmware with Mission Planner.


## Camera Switch
GPIO 81 controls which camera input (CAM1 or CAM2) is applied to the internal OSD. A RELAY function can be enabled to control the switching.
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.
41 changes: 41 additions & 0 deletions libraries/AP_HAL_ChibiOS/hwdef/StellarH7V2/hwdef-bl.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# hw definition file for Stellar H7V2 bootloader

# MCU class and specific type
MCU STM32H7xx STM32H743xx

# board ID for firmware load
APJ_BOARD_ID AP_HW_StellarH7V2

# crystal frequency, setup to use external oscillator
OSCILLATOR_HZ 8000000

FLASH_SIZE_KB 2048

# bootloader starts at zero offset
FLASH_RESERVE_START_KB 0

# the location where the bootloader will put the firmware
# the H743 has 128k sectors
FLASH_BOOTLOADER_LOAD_KB 128


# order of UARTs (and USB). Allow bootloading on USB and telem1
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

# make sure Vsw is on during bootloader
PD10 PINIO1 OUTPUT LOW

PE3 LED_BOOTLOADER OUTPUT LOW
define HAL_LED_ON 0

# Add CS pins to ensure they are high in bootloader
PC15 IMU_CS CS
PB12 MAX7456_CS CS
PE11 FLASH_CS CS
176 changes: 176 additions & 0 deletions libraries/AP_HAL_ChibiOS/hwdef/StellarH7V2/hwdef.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
# hw definition file for Stellar H7V2

# MCU class and specific type
MCU STM32H7xx STM32H743xx

# board ID for firmware load
APJ_BOARD_ID AP_HW_StellarH7V2

# crystal frequency, setup to use external oscillator
OSCILLATOR_HZ 8000000

FLASH_SIZE_KB 2048
env OPTIMIZE -Os

# bootloader takes first sector
FLASH_RESERVE_START_KB 128


# ChibiOS system timer
STM32_ST_USE_TIMER 12
define CH_CFG_ST_RESOLUTION 16

# USB
PA11 OTG_FS_DM OTG1
PA12 OTG_FS_DP OTG1

PA13 JTMS-SWDIO SWD
PA14 JTCK-SWCLK SWD

# SPI1 for icm42688
PA5 SPI1_SCK SPI1
PA6 SPI1_MISO SPI1
PD7 SPI1_MOSI SPI1
PC15 IMU1_CS CS

# SPI2 for MAX7456
PB13 SPI2_SCK SPI2
PB14 SPI2_MISO SPI2
PB15 SPI2_MOSI SPI2
PB12 MAX7456_CS CS

# SPI4 NAND W25M01G/2G Not supported yet
# PE12 SPI4_SCK SPI4
# PE13 SPI4_MISO SPI4
# PE14 SPI4_MOSI SPI4
# PE11 FLASH_CS CS

# I2C bus
I2C_ORDER I2C2

# I2C2
PB10 I2C2_SCL I2C2
PB11 I2C2_SDA I2C2

# ADC
PC0 BATT_VOLTAGE_SENS ADC1 SCALE(1)
PC1 BATT_CURRENT_SENS ADC1 SCALE(1)
PA4 BATT2_CURRENT_SENS ADC1 SCALE(1)

define HAL_BATT_MONITOR_DEFAULT 4
define HAL_BATT_VOLT_PIN 10
define HAL_BATT_CURR_PIN 11
define HAL_BATT2_CURR_PIN 7
define HAL_BATT_VOLT_SCALE 11.0
define HAL_BATT_CURR_SCALE 10.0

# LED
# green LED1 marked as B/E
# blue LED0 marked as ACT
define AP_NOTIFY_GPIO_LED_2_ENABLED 1
PE3 LED0 OUTPUT LOW GPIO(90)
PE4 LED1 OUTPUT LOW GPIO(91)
define HAL_GPIO_A_LED_PIN 91
define HAL_GPIO_B_LED_PIN 90

# order of UARTs (and USB)
SERIAL_ORDER OTG1 USART1 USART2 USART3 UART4 USART6 UART7 UART8

# USART1
PA10 USART1_RX USART1
PA9 USART1_TX USART1

# USART2
PD5 USART2_TX USART2
PD6 USART2_RX USART2

# USART3
PD9 USART3_RX USART3
PD8 USART3_TX USART3
define DEFAULT_SERIAL3_PROTOCOL SerialProtocol_None

# UART4 (RCIN)
PB9 UART4_TX UART4
PB8 UART4_RX UART4
define DEFAULT_SERIAL4_PROTOCOL SerialProtocol_RCIN

# USART6
PC7 USART6_RX USART6
PC6 USART6_TX USART6
define DEFAULT_SERIAL6_PROTOCOL SerialProtocol_GPS

# UART7
PE7 UART7_RX UART7
PE8 UART7_TX UART7
define DEFAULT_SERIAL7_PROTOCOL SerialProtocol_MSP_DisplayPort

# UART8
PE0 UART8_RX UART8
PE1 UART8_TX UART8
define DEFAULT_SERIAL8_PROTOCOL SerialProtocol_ESCTelemetry

# CAN bus
PD0 CAN1_RX CAN1
PD1 CAN1_TX CAN1
PD3 GPIO_CAN1_SILENT OUTPUT PUSHPULL SPEED_LOW LOW GPIO(70)

# Motors
PB0 TIM3_CH3 TIM3 PWM(1) GPIO(50) BIDIR # M1
PB1 TIM3_CH4 TIM3 PWM(2) GPIO(51) # M2
PA0 TIM5_CH1 TIM5 PWM(3) GPIO(52) BIDIR # M3
PA1 TIM5_CH2 TIM5 PWM(4) GPIO(53) # M4
PA2 TIM5_CH3 TIM5 PWM(5) GPIO(54) BIDIR # M5
PA3 TIM5_CH4 TIM5 PWM(6) GPIO(55) # M6
PD12 TIM4_CH1 TIM4 PWM(7) GPIO(56) # M7
PD13 TIM4_CH2 TIM4 PWM(8) GPIO(57) # M8
PD14 TIM4_CH3 TIM4 PWM(9) GPIO(58) # S5
PD15 TIM4_CH4 TIM4 PWM(10) GPIO(59) # S6

# buzzer
PB2 BUZZER OUTPUT GPIO(80) LOW
define HAL_BUZZER_PIN 80

# microSD support
PC8 SDMMC1_D0 SDMMC1
PC9 SDMMC1_D1 SDMMC1
PC10 SDMMC1_D2 SDMMC1
PC11 SDMMC1_D3 SDMMC1
PC12 SDMMC1_CK SDMMC1
PD2 SDMMC1_CMD SDMMC1

# GPIOs
PD10 PINIO1 OUTPUT GPIO(81) LOW

DMA_PRIORITY S*

define HAL_STORAGE_SIZE 32768

# use last 2 pages for flash storage
# H743 has 16 pages of 128k each
STORAGE_FLASH_PAGE 14

# spi devices
SPIDEV icm42688 SPI1 DEVID1 IMU1_CS MODE3 2*MHZ 16*MHZ
SPIDEV osd SPI2 DEVID2 MAX7456_CS MODE0 10*MHZ 10*MHZ

# 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

# IMU
IMU Invensensev3 SPI:icm42688 ROTATION_ROLL_180
define HAL_DEFAULT_INS_FAST_SAMPLE 1

# DPS310 integrated on I2C2 bus, multiple possible choices for external barometer
BARO DPS310 I2C:0:0x76
BARO BMP280 I2C:0:0x76

define HAL_OS_FATFS_IO 1

# setup for OSD
define OSD_ENABLED 1
define HAL_OSD_TYPE_DEFAULT 1
ROMFS_WILDCARD libraries/AP_OSD/fonts/font*.bin
Loading