# hw definition file for processing by chibios_hwdef.py # for SmartAP AIRLink hardware # MCU class and specific type MCU STM32F7xx STM32F767xx # crystal frequency OSCILLATOR_HZ 16000000 # default to all pins low to avoid ESD issues DEFAULTGPIO OUTPUT LOW PULLDOWN # board ID for firmware load APJ_BOARD_ID 55 FLASH_RESERVE_START_KB 32 # flash size FLASH_SIZE_KB 2048 env OPTIMIZE -O2 # order of UARTs (and USB) SERIAL_ORDER OTG1 UART7 UART5 USART1 UART8 USART3 USART2 OTG2 # default the 2nd interface to MAVLink2 define HAL_OTG1_PROTOCOL SerialProtocol_MAVLink2 # USB support PA11 OTG_FS_DM OTG1 PA12 OTG_FS_DP OTG1 # debugging support PA13 JTMS-SWDIO SWD PA14 JTCK-SWCLK SWD # SPI1 - ICM20602 PA5 SPI1_SCK SPI1 PB4 SPI1_MISO SPI1 PB5 SPI1_MOSI SPI1 # SPI2 - MPU9250 FPC PI1 SPI2_SCK SPI2 PI2 SPI2_MISO SPI2 PI3 SPI2_MOSI SPI2 # SPI3 - MPU9250 Board PC10 SPI3_SCK SPI3 PC11 SPI3_MISO SPI3 PB2 SPI3_MOSI SPI3 # SPI5 - FRAM PF7 SPI5_SCK SPI5 PF8 SPI5_MISO SPI5 PF11 SPI5_MOSI SPI5 # sensor CS PI9 ICM20602_CS CS SPEED_VERYLOW PH5 MPU_FPC_CS CS PI8 MPU_BOARD_CS CS PG7 FRAM_CS CS SPEED_VERYLOW # I2C buses PB8 I2C1_SCL I2C1 PB7 I2C1_SDA I2C1 PF1 I2C2_SCL I2C2 PF0 I2C2_SDA I2C2 PH7 I2C3_SCL I2C3 PH8 I2C3_SDA I2C3 PF14 I2C4_SCL I2C4 PF15 I2C4_SDA I2C4 # order of I2C buses I2C_ORDER I2C3 I2C4 I2C1 I2C2 define HAL_I2C_INTERNAL_MASK 3 # enable sensors power pins PI11 VDD_3V3_SENSORS_EN OUTPUT HIGH PD15 VDD_3V3_SENSORS2_EN OUTPUT HIGH PE7 VDD_3V3_SENSORS3_EN OUTPUT HIGH PG8 VDD_3V3_SENSORS4_EN OUTPUT HIGH PF12 VDD_5V_HIPOWER_EN OUTPUT HIGH # drdy pins PF2 DRDY4_ICM20602 INPUT PH12 MPU_FPC_DRDY INPUT PI6 MPU_BOARD_DRDY INPUT # UART for IOMCU IOMCU_UART USART6 # UARTs # USART2 is telem3 PA3 USART2_RX USART2 NODMA PD5 USART2_TX USART2 NODMA PD3 USART2_CTS USART2 PD4 USART2_RTS USART2 # USART1 is GPS1 PB15 USART1_RX USART1 NODMA PB14 USART1_TX USART1 NODMA # USART3 is debug PD9 USART3_RX USART3 NODMA PD8 USART3_TX USART3 NODMA #PD11 USART3_CTS USART3 #PD12 USART3_RTS USART3 # UART4 is ext PH14 UART4_RX UART4 NODMA PH13 UART4_TX UART4 NODMA # UART5 is telem2 PD2 UART5_RX UART5 PB9 UART5_TX UART5 # USART6 for IOMCU PC7 USART6_RX USART6 PC6 USART6_TX USART6 # UART7 is telem1 PF6 UART7_RX UART7 NODMA PE8 UART7_TX UART7 NODMA # UART8 is for gps2 PE0 UART8_RX UART8 NODMA PE1 UART8_TX UART8 NODMA # PWM AUX channels PE14 TIM1_CH4 TIM1 PWM(1) GPIO(50) PA10 TIM1_CH3 TIM1 PWM(2) GPIO(51) PE11 TIM1_CH2 TIM1 PWM(3) GPIO(52) PA8 TIM1_CH1 TIM1 PWM(4) GPIO(53) PD13 TIM4_CH2 TIM4 PWM(5) GPIO(54) PD14 TIM4_CH3 TIM4 PWM(6) GPIO(55) # we need to disable DMA on the last 2 FMU channels # as timer 12 doesn't have a TIMn_UP DMA option PH6 TIM12_CH1 TIM12 PWM(7) GPIO(56) NODMA PH9 TIM12_CH2 TIM12 PWM(8) GPIO(57) NODMA # PWM output for buzzer PF9 TIM14_CH1 TIM14 GPIO(77) ALARM # analog in PC3 BATT_VOLTAGE_SENS ADC1 SCALE(1) PC0 BATT_CURRENT_SENS ADC1 SCALE(1) PB0 RSSI_IN ADC1 SCALE(1) #PF5 HW_REV_SENS ADC3 SCALE(1) #PF4 HW_VER_SENS ADC3 SCALE(1) PB1 VDD_5V_SENS ADC1 SCALE(3) PA0 SCALED_V3V3 ADC1 SCALE(2) undef HAL_HAVE_SAFETY_SWITCH 0 # setup scaling defaults for power brick define HAL_BATT_VOLT_SCALE 18.0 define HAL_BATT_CURR_SCALE 24.0 define HAL_BATT_VOLT_PIN 0 define HAL_BATT_CURR_PIN 1 # CAN bus PD0 CAN1_RX CAN1 PD1 CAN1_TX CAN1 PB12 CAN2_RX CAN2 PB6 CAN2_TX CAN2 # GPIOs PB10 HEATER_EN OUTPUT LOW GPIO(80) define HAL_HEATER_GPIO_PIN 80 # heater is on when pulled low define HAL_HEATER_GPIO_ON 0 # SPI devices SPIDEV icm20602 SPI1 DEVID1 ICM20602_CS MODE3 2*MHZ 8*MHZ SPIDEV mpu9250_fpc SPI2 DEVID1 MPU_FPC_CS MODE3 4*MHZ 8*MHZ SPIDEV mpu9250_board SPI3 DEVID1 MPU_BOARD_CS MODE3 4*MHZ 8*MHZ SPIDEV ramtron SPI5 DEVID1 FRAM_CS MODE3 8*MHZ 8*MHZ # up to 3 IMUs IMU Invensense SPI:icm20602 ROTATION_YAW_270 IMU Invensense SPI:mpu9250_fpc ROTATION_YAW_180 IMU Invensense SPI:mpu9250_board ROTATION_YAW_90 define HAL_DEFAULT_INS_FAST_SAMPLE 7 BARO MS56XX I2C:0:0x77 BARO BMP388 I2C:1:0x76 COMPASS AK8963:probe_mpu9250 0 ROTATION_NONE COMPASS AK8963:probe_mpu9250 1 ROTATION_YAW_270 # also problem all external compass types define HAL_PROBE_EXTERNAL_I2C_COMPASSES # microSD support PG9 SDMMC2_D0 SDMMC2 PG10 SDMMC2_D1 SDMMC2 PG11 SDMMC2_D2 SDMMC2 PG12 SDMMC2_D3 SDMMC2 PD6 SDMMC2_CK SDMMC2 PD7 SDMMC2_CMD SDMMC2 # red LED marked as B/E PE5 LED_RED OUTPUT OPENDRAIN GPIO(90) # green LED marked as PWR. We leave this solid on, but allow # for it to be controlled as a relay if needed PE4 LED_GREEN OUTPUT GPIO(91) LOW # blue LED marked as ACT PE3 LED_BLUE OUTPUT GPIO(92) HIGH # setup for BoardLED2 define HAL_GPIO_A_LED_PIN 90 define HAL_GPIO_B_LED_PIN 92 define HAL_GPIO_LED_ON 0 # enable RAMTROM parameter storage define HAL_STORAGE_SIZE 32768 define HAL_WITH_RAMTRON 1 define HAL_COMPASS_AUTO_ROT_DEFAULT 2 DMA_PRIORITY SDMMC* USART6* ADC* SPI* TIM* # we can't share IO UART (USART6) DMA_NOSHARE USART6_TX USART6_RX ADC1 DMA_PRIORITY USART6* UART5_RX define FATFS_HAL_DEVICE SDCD2 # enable FAT filesystem support (needs a microSD defined via SDMMC) define HAL_OS_FATFS_IO 1 define HAL_BOARD_LOG_DIRECTORY "/APM/LOGS" define HAL_BOARD_TERRAIN_DIRECTORY "/APM/TERRAIN" ROMFS io_firmware.bin Tools/IO_Firmware/iofirmware_lowpolh.bin