Skip to content

Commit

Permalink
HWDEF : add modalai_fc-v2 & fc-v2-bdshot
Browse files Browse the repository at this point in the history
  • Loading branch information
hendjoshsr71 committed Sep 28, 2024
1 parent 637aec0 commit b2cfeac
Show file tree
Hide file tree
Showing 7 changed files with 603 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include ../modalai_fc-v2/hwdef-bl.dat
16 changes: 16 additions & 0 deletions libraries/AP_HAL_ChibiOS/hwdef/modalai_fc-v2-bdshot/hwdef.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# hw definition file for processing by chibios_hwdef.py
# Modal AI FCV2 BDShot

include ../modalai_fc-v2/hwdef.dat

undef PI0 PH12 PH11 PH10 PD13 PD14

# PWM output pins
PI0 TIM5_CH4 TIM5 PWM(1) GPIO(50) BIDIR
PH12 TIM5_CH3 TIM5 PWM(2) GPIO(51)
PH11 TIM5_CH2 TIM5 PWM(3) GPIO(52) BIDIR
PH10 TIM5_CH1 TIM5 PWM(4) GPIO(53)
PD13 TIM4_CH2 TIM4 PWM(5) GPIO(54) BIDIR
PD14 TIM4_CH3 TIM4 PWM(6) GPIO(55) BIDIR

DMA_PRIORITY TIM5* TIM4* SPI1* SPI2* SDMMC* USART6* ADC* UART* USART*
10 changes: 10 additions & 0 deletions libraries/AP_HAL_ChibiOS/hwdef/modalai_fc-v2/hwdef-bl.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# hw definition file for processing by chibios_hwdef.py
# for H743 bootloader

# MCU class and specific type
MCU STM32H7xx STM32H743xx

include hwdef-bl.inc

# build ABIN for flash-from-bootloader support:
env BUILD_ABIN True
96 changes: 96 additions & 0 deletions libraries/AP_HAL_ChibiOS/hwdef/modalai_fc-v2/hwdef-bl.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@

# ModalAI have an ID allocated??
# USB setup
# USB_VENDOR 0x2DAE # ONLY FOR USE BY HEX! NOBODY ELSE
# USB_PRODUCT 0x1016
# USB_STRING_MANUFACTURER "Hex/ProfiCNC"

# crystal frequency
OSCILLATOR_HZ 16000000

# board ID for firmware load
APJ_BOARD_ID 41776

# default to all pins low to avoid ESD issues
DEFAULTGPIO OUTPUT LOW PULLDOWN

FLASH_SIZE_KB 2048

# bootloader is installed at zero offset
FLASH_RESERVE_START_KB 0

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

define HAL_LED_ON 0

PE5 LED_BOOTLOADER OUTPUT HIGH OPENDRAIN # Blue LED
PE3 LED_ACTIVITY OUTPUT HIGH OPENDRAIN # Red LED

# order of UARTs (and USB)
# USB1_1 TELEM1 TELEM2 GPS1 Debug
SERIAL_ORDER OTG1 UART7 UART5 USART1 USART3

# USB
PA11 OTG_FS_DM OTG1
PA12 OTG_FS_DP OTG1
PA9 VBUS INPUT OPENDRAIN # This input pin is used to detect that power is valid on USB.

# UART7 Telem 1, TELEM_UART_4W
PF6 UART7_RX UART7
PE8 UART7_TX UART7
PF8 UART7_RTS UART7
PE10 UART7_CTS UART7

# UART5 Telem 2, MSS_UART_4W
PD2 UART5_RX UART5
PC12 UART5_TX UART5
PC8 UART5_RTS UART5
PC9 UART5_CTS UART5

# USART1 GPS1, UART_2W
PB7 USART1_RX USART1
PB6 USART1_TX USART1

# USART3 Debug, UART_2W
PD8 USART3_TX USART3
PD9 USART3_RX USART3

# Debug Pins
PA13 JTMS-SWDIO SWD
PA14 JTCK-SWCLK SWD

# Add CS pins to ensure they are high in bootloader

/* SPI
* SPI1 : ICM_42688_1
* SPI2 : ICM_42688_2
* SPI5 : FRAM 256 Kb
* SPI6 : Reserved
*
*/
PI9 ICM_42688_1_CS CS
PH5 ICM_42688_2_CS CS
PG7 FRAM_CS CS SPEED_VERYLOW
PI10 GYRO_EXT_CS CS

# enable DFU by default
ENABLE_DFU_BOOT 1

# enable flashing from SD card:
include sdcard.inc
define FATFS_HAL_DEVICE SDCD2

# enable FAT filesystem support (needs a microSD defined via SDMMC)
define HAL_OS_FATFS_IO 1
define AP_BOOTLOADER_FLASH_FROM_SD_ENABLED 1

# FATFS support:
define CH_CFG_USE_MEMCORE 1
define CH_CFG_USE_HEAP 1
define CH_CFG_USE_SEMAPHORES 0
define CH_CFG_USE_MUTEXES 1
define CH_CFG_USE_DYNAMIC 1
define CH_CFG_USE_WAITEXIT 1
define CH_CFG_USE_REGISTRY 1
14 changes: 14 additions & 0 deletions libraries/AP_HAL_ChibiOS/hwdef/modalai_fc-v2/hwdef.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# hw definition file for processing by chibios_hwdef.py
# Modal AI FCV2

# MCU class and specific type
MCU STM32H7xx STM32H743xx

include hwdef.inc

# to be compatible with the px4 bootloader we need
# to use a different RAM_MAP
env USE_ALT_RAM_MAP 1

# build ABIN for flash-from-bootloader support:
env BUILD_ABIN True
Loading

0 comments on commit b2cfeac

Please sign in to comment.