# MCU class and specific type MCU STM32L4xx STM32L4R5xx # board ID for firmware load APJ_BOARD_ID 1090 # crystal frequency OSCILLATOR_HZ 24000000 USB_STRING_MANUFACTURER "Dheeran labs" USB_STRING_PRODUCT "PixFlamingo" # ChibiOS system timer STM32_ST_USE_TIMER 5 define CH_CFG_ST_RESOLUTION 16 # flash size FLASH_SIZE_KB 2048 FLASH_RESERVE_START_KB 28 env OPTIMIZE -O2 # only one I2C bus I2C_ORDER I2C2 # order of UARTs (and USB) SERIAL_ORDER OTG1 USART3 USART1 UART4 PC1 BATT_VOLTAGE_SENS ADC1 PC0 BATT_CURRENT_SENS ADC1 PA4 VDD_5V_SENS ADC1 SCALE(2) # SPI1 is fram bus PA5 SPI1_SCK SPI1 PA6 SPI1_MISO SPI1 PA7 SPI1_MOSI SPI1 PA9 VBUS INPUT PA11 USB_OTG_FS_DM OTG1 PA12 USB_OTG_FS_DP OTG1 # USART3 serial3 telem1 PC4 USART3_TX USART3 PC5 USART3_RX USART3 PB13 USART3_CTS USART3 PB14 USART3_RTS USART3 # USART1 serial1 telem2 PB6 USART1_TX USART1 PB7 USART1_RX USART1 PB4 USART1_CTS USART1 PB3 USART1_RTS USART1 # UART4 is GPS PA0 UART4_TX UART4 PA1 UART4_RX UART4 define HAL_USE_SERIAL TRUE PA13 JTMS-SWDIO SWD PA14 JTCK-SWCLK SWD # PWM output for buzzer PA15 BUZZER OUTPUT GPIO(80) LOW define HAL_BUZZER_PIN 80 PE2 BOOT1 INPUT PD9 VDD_BRICK_VALID INPUT PULLDOWN PB10 I2C2_SCL I2C2 PB11 I2C2_SDA I2C2 # SPI2 is for sensors PD1 SPI2_SCK SPI2 PD3 SPI2_MISO SPI2 PD4 SPI2_MOSI SPI2 PB8 CAN1_RX CAN1 PB9 CAN1_TX CAN1 PD0 IMU1_CS CS PE0 GYRO_CS CS PB5 BARO_CS CS PD7 MAG_CS CS # This defines more ADC inputs. PC2 AUX_POWER ADC1 SCALE(1) PC3 AUX_ADC2 ADC1 SCALE(1) PD10 VBUS_VALID INPUT PULLDOWN PB0 RSSI_IN ADC1 SCALE(1) PE12 LED_SAFETY OUTPUT PE15 SAFETY_IN INPUT PULLDOWN PC14 VDD_PERIPH_EN OUTPUT HIGH #PD6 RCININT PULLDOWN LOW # also USART6_RX for serial RC PC7 SBUS_INV OUTPUT LOW PC8 SDMMC1_D0 SDMMC1 PC9 SDMMC1_D1 SDMMC1 PC10 SDMMC1_D2 SDMMC1 PC11 SDMMC1_D3 SDMMC1 PC12 SDMMC1_CK SDMMC1 PD2 SDMMC1_CMD SDMMC1 PE5 IMU1_DRDY INPUT PE4 MAG_DRDY INPUT PE6 GYRO_DRDY INPUT PC13 VDD_SENSORS_EN OUTPUT HIGH PC6 TIM8_CH1 TIM8 RCININT PULLDOWN LOW PE14 TIM1_CH4 TIM1 PWM(1) GPIO(50) PE13 TIM1_CH3 TIM1 PWM(2) GPIO(51) PE11 TIM1_CH2 TIM1 PWM(3) GPIO(52) PE9 TIM1_CH1 TIM1 PWM(4) GPIO(53) PD12 TIM4_CH1 TIM4 PWM(5) GPIO(54) PD13 TIM4_CH2 TIM4 PWM(6) GPIO(55) PD14 TIM4_CH3 TIM4 PWM(7) GPIO(56) PD15 TIM4_CH4 TIM4 PWM(8) GPIO(57) PB15 TIM15_CH2 TIM15 PWM(9) GPIO(59) # SPI device table. SPIDEV icm42670 SPI2 DEVID1 IMU1_CS MODE3 2*MHZ 8*MHZ SPIDEV ms5611 SPI1 DEVID3 BARO_CS MODE3 20*MHZ 20*MHZ SPIDEV lis3mdl SPI2 DEVID5 MAG_CS MODE3 500*KHZ 500*KHZ SPIDEV lsm9ds0_g SPI2 DEVID4 GYRO_CS MODE3 11*MHZ 11*MHZ # enable FAT filesystem define HAL_OS_FATFS_IO 1 # pixracer has 3 LEDs, Red, Green, Blue define HAL_HAVE_PIXRACER_LED # LED setup for PixracerLED driver PE8 LED_RED OUTPUT GPIO(0) PE7 LED_GREEN OUTPUT GPIO(1) PB2 LED_BLUE OUTPUT GPIO(2) define HAL_GPIO_A_LED_PIN 0 define HAL_GPIO_B_LED_PIN 1 define HAL_GPIO_C_LED_PIN 2 # battery setup define HAL_BATT_MONITOR_DEFAULT 4 define HAL_BATT_VOLT_PIN 2 define HAL_BATT_CURR_PIN 1 define HAL_BATT_VOLT_SCALE 10.1 define HAL_BATT_CURR_SCALE 17.0 DMA_PRIORITY S* define STORAGE_FLASH_PAGE 5 define HAL_STORAGE_SIZE 16384 # two IMUs IMU Invensensev3 SPI:icm42670 ROTATION_YAW_270 IMU LSM9DS0 SPI:lsm9ds0_g SPI:lsm9ds0_am ROTATION_ROLL_180 ROTATION_ROLL_180_YAW_270 ROTATION_PITCH_180 define HAL_DEFAULT_INS_FAST_SAMPLE 1 COMPASS LIS3MDL SPI:lis3mdl false ROTATION_NONE # also probe all types of external I2C compasses define HAL_PROBE_EXTERNAL_I2C_COMPASSES define HAL_I2C_INTERNAL_MASK 0 define STM32_I2C_USE_DMA FALSE # one barometer BARO MS56XX SPI:ms5611