diff --git a/libraries/AP_HAL_ChibiOS/hwdef/CSKY-PMU/defaults.parm b/libraries/AP_HAL_ChibiOS/hwdef/CSKY-PMU/defaults.parm new file mode 100644 index 0000000000000..d578f1ee90b5f --- /dev/null +++ b/libraries/AP_HAL_ChibiOS/hwdef/CSKY-PMU/defaults.parm @@ -0,0 +1,26 @@ +FORMAT_VERSION 0 +CAN_NODE 0 +CAN_BAUDRATE 1000000 +FLASH_BOOTLOADER 0 +DEBUG 0 +BRD_SERIAL_NUM 0 +BATT_MONITOR 26 +BATT_CAPACITY 3300 +BATT_SERIAL_NUM 0 +BATT_MAX_AMPS 204.8 +BATT_SHUNT 0.0002 +BATT_HIDE_MASK 0 +TEMP1_TYPE 5 +TEMP1_BUS 0 +TEMP1_ADDR 0 +TEMP1_SRC 0 +TEMP1_SRC_ID 0 +TEMP1_PIN 3 +TEMP1_A0 -41.0 +TEMP1_A1 50.0 +TEMP1_A2 0.0 +TEMP1_A3 0.0 +TEMP1_A4 0.0 +TEMP1_A5 0.0 +TEMP_MSG_RATE 0 +OPTIONS 0 diff --git a/libraries/AP_HAL_ChibiOS/hwdef/CSKY-PMU/hwdef-bl.dat b/libraries/AP_HAL_ChibiOS/hwdef/CSKY-PMU/hwdef-bl.dat new file mode 100644 index 0000000000000..60b347368f9d7 --- /dev/null +++ b/libraries/AP_HAL_ChibiOS/hwdef/CSKY-PMU/hwdef-bl.dat @@ -0,0 +1,65 @@ +# hw definition file for processing by chibios_pins.py + +# CSKY-PMU Bootloader + +# MCU class and specific type +MCU STM32F4xx STM32F412Rx + +# bootloader loads at start of flash +FLASH_RESERVE_START_KB 0 + +# location of application code +FLASH_BOOTLOADER_LOAD_KB 64 + +# board ID for firmware load +APJ_BOARD_ID 1212 + +# crystal frequency +OSCILLATOR_HZ 8000000 + +# setup build for a peripheral firmware +env AP_PERIPH 1 + +define CH_CFG_ST_FREQUENCY 1000000 + +# Flash available +FLASH_SIZE_KB 512 + +# order of UARTs +SERIAL_ORDER + +PB14 LED_BOOTLOADER OUTPUT HIGH +define HAL_LED_ON 1 + +# USART1 +PB6 USART1_TX USART1 +PB7 USART1_RX USART1 + +# SWD debugging +PA13 JTMS-SWDIO SWD +PA14 JTCK-SWCLK SWD + +define HAL_USE_SERIAL TRUE + +define STM32_SERIAL_USE_USART1 TRUE +define STM32_SERIAL_USE_USART2 FALSE +define STM32_SERIAL_USE_USART3 FALSE + +define HAL_NO_GPIO_IRQ +define HAL_USE_EMPTY_IO TRUE + +# avoid timer thread to save memory +define HAL_NO_TIMER_THREAD + +define DMA_RESERVE_SIZE 0 + +# enable CAN support +PB8 CAN1_RX CAN1 +PB9 CAN1_TX CAN1 +PB5 GPIO_CAN1_SILENT OUTPUT PUSHPULL SPEED_LOW LOW + +# make bl baudrate match debug baudrate for easier debugging +define BOOTLOADER_BAUDRATE 57600 + +# use a small bootloader timeout +define HAL_BOOTLOADER_TIMEOUT 1000 diff --git a/libraries/AP_HAL_ChibiOS/hwdef/CSKY-PMU/hwdef.dat b/libraries/AP_HAL_ChibiOS/hwdef/CSKY-PMU/hwdef.dat new file mode 100644 index 0000000000000..293c05eceaf92 --- /dev/null +++ b/libraries/AP_HAL_ChibiOS/hwdef/CSKY-PMU/hwdef.dat @@ -0,0 +1,91 @@ +# hw definition file for processing by chibios_pins.py + +# MCU class and specific type +MCU STM32F4xx STM32F412Rx + +# bootloader starts firmware at 64k +FLASH_RESERVE_START_KB 64 + +# store parameters in pages 2 and 3 +STORAGE_FLASH_PAGE 2 +define HAL_STORAGE_SIZE 8192 + +# board ID for firmware load +APJ_BOARD_ID 1212 + +# setup build for a peripheral firmware +env AP_PERIPH 1 + +# ChibiOS system timer +STM32_ST_USE_TIMER 5 + +# crystal frequency +OSCILLATOR_HZ 8000000 + +define CH_CFG_ST_FREQUENCY 1000000 + +# assume 512k flash part +FLASH_SIZE_KB 512 + +define HAL_NO_GPIO_IRQ +define SERIAL_BUFFERS_SIZE 512 +define PORT_INT_REQUIRED_STACK 64 + +define DMA_RESERVE_SIZE 0 + +define HAL_NO_MONITOR_THREAD + +# setup a small defaults.parm +define AP_PARAM_MAX_EMBEDDED_PARAM 512 + +# order of UARTs +SERIAL_ORDER USART1 EMPTY EMPTY EMPTY + +# USART1 for debug +PB6 USART1_TX USART1 NODMA +PB7 USART1_RX USART1 NODMA +define DEFAULT_SERIAL0_BAUD 57600 + +# debugger support +PA13 JTMS-SWDIO SWD +PA14 JTCK-SWCLK SWD + +# activity LED +PB14 LED OUTPUT HIGH +define HAL_LED_ON 1 + +#CAN bus +CAN_ORDER 1 +PB8 CAN1_RX CAN1 +PB9 CAN1_TX CAN1 +PB5 GPIO_CAN1_SILENT OUTPUT PUSHPULL SPEED_LOW LOW + +define CAN_APP_NODE_NAME "org.csky.pmu" +define HAL_CAN_POOL_SIZE 6000 + +# SPI1 RM3100 +PA5 SPI1_SCK SPI1 +PA6 SPI1_MISO SPI1 +PA7 SPI1_MOSI SPI1 +PA4 SPARE_CS CS +SPIDEV INA23X SPI1 DEVID1 SPARE_CS MODE1 10*MHZ 10*MHZ + +# enable temperature +define AP_TEMPERATURE_SENSOR_ENABLED 1 +define AP_TEMPERATURE_SENSOR_MAX_INSTANCES 1 +define HAL_PERIPH_ENABLE_DEVICE_TEMPERATURE + +# ADC +define HAL_USE_ADC TRUE +define STM32_ADC_USE_ADC1 TRUE + +PA3 BATT_TEMP_SENS ADC1 SCALE(1) + +# enable battery monitor +define HAL_PERIPH_ENABLE_BATTERY +define AP_BATTERY_INA239_ENABLED 1 +define AP_BATTERY_INA239_SPI_DEVICE "INA23X" +define HAL_BATT_MONITOR_DEFAULT 26 + +# bootloader embedding / bootloader flashing not available +define AP_BOOTLOADER_FLASHING_ENABLED 0