# hw definition file for processing by chibios_hwdef.py # for F4BY v2.1.5 board description http://swift-flyer.com/?page_id=83 # MCU class and specific type MCU STM32F4xx STM32F407xx # is not declared chibios_hwdef.py for 407 define def_ccm_size 64 #default 256 NO WORK WITH DISPLAY SSD1306 CONNECTED and compass internal calibration #use auto calculation stack size for interrupt by os define PORT_INT_REQUIRED_STACK 0 # board ID for firmware load APJ_BOARD_ID 20 define CONFIG_HAL_BOARD_SUBTYPE HAL_BOARD_SUBTYPE_CHIBIOS_F4BY # define AP_FEATURE_BOARD_DETECT 1 # USB setup USB_VENDOR 0x27AC # Swift-Flyer USB_PRODUCT 0x0201 # fmu usb driver USB_STRING_MANUFACTURER "Swift-Flyer" USB_STRING_PRODUCT "%BOARD%" USB_STRING_SERIAL "%SERIAL%" FLASH_SIZE_KB 1024 # crystal frequency OSCILLATOR_HZ 8000000 STM32_PLLM_VALUE 8 # board voltage STM32_VDD 330U # this is the STM32 timer that ChibiOS will use for the low level # driver. This must be a 32 bit timer. We currently only support # timers 2, 3, 4, 5 and 21. See hal_st_lld.c in ChibiOS for details # ChibiOS system timer STM32_ST_USE_TIMER 5 PA11 OTG_FS_DM OTG1 PA12 OTG_FS_DP OTG1 PA13 JTMS-SWDIO SWD PA14 JTCK-SWCLK SWD # the normal usage of this ordering is: # 1) SERIAL0: console (primary mavlink, usually USB) # 2) SERIAL3: primary GPS # 3) SERIAL1: telem1 # 4) SERIAL2: telem2 # 5) SERIAL4: GPS2 # 6) SERIAL5: extra UART (usually RTOS debug console) STDOUT_SERIAL SD2 STDOUT_BAUDRATE 57600 # this is the pin that senses USB being connected. It is an input pin # setup as OPENDRAIN PA9 VBUS INPUT OPENDRAIN # order of UARTs (and USB) 2 3 4 5 NODMA # UART_ORDER OTG1 USART1 # UART4 UART_ORDER OTG1 USART3 USART2 USART1 # UART1 as board 2.1.5 for serial 3 gps PB6 USART1_TX USART1 PB7 USART1_RX USART1 # USART2 serial2 telem2 PD5 USART2_TX USART2 NODMA PD6 USART2_RX USART2 # USART3 serial3 telem1 PD8 USART3_TX USART3 NODMA PD9 USART3_RX USART3 PC10 UART4_TX UART4 NODMA PC11 UART4_RX UART4 # SHARE dma with I2C2_TX PC12 UART5_TX UART5 NODMA PD2 UART5_RX UART5 NODMA define HAL_STORAGE_SIZE 16384 define STORAGE_FLASH_PAGE 22 define HAL_INS_DEFAULT HAL_INS_MPU60XX_SPI #SPI1 for MPU PA5 SPI1_SCK SPI1 PA6 SPI1_MISO SPI1 PA7 SPI1_MOSI SPI1 PA4 MPU_CS CS # spi bus for dataflash AND SD PB13 SPI2_SCK SPI2 PB14 SPI2_MISO SPI2 PB15 SPI2_MOSI SPI2 PB12 FRAM_CS CS SPEED_VERYLOW PE15 FLASH_CS CS SPIDEV mpu6000 SPI1 DEVID1 MPU_CS MODE3 1*MHZ 8*MHZ SPIDEV ramtron SPI2 DEVID10 FRAM_CS MODE3 8*MHZ 8*MHZ SPIDEV dataflash SPI2 DEVID1 FLASH_CS MODE3 1*MHZ 8*MHZ # enable RAMTROM parameter storage define HAL_WITH_RAMTRON 1 # enable FAT filesystem support (needs a microSD defined via SDIO) # define HAL_OS_FATFS_IO 1 # now some defines for logging and terrain data files NO WORK WITHOUT FAT # define HAL_BOARD_LOG_DIRECTORY "/APM/LOGS" # define HAL_BOARD_TERRAIN_DIRECTORY "/APM/TERRAIN" # this defines the default maximum clock on I2C devices. define HAL_I2C_MAX_CLOCK 100000 I2C_ORDER I2C2 I2C1 PB8 I2C1_SCL I2C1 PB9 I2C1_SDA I2C1 PB10 I2C2_SCL I2C2 PB11 I2C2_SDA I2C2 define HAL_BARO_DEFAULT HAL_BARO_MS5611_I2C define HAL_BARO_MS5611_I2C_BUS 0 define HAL_COMPASS_DEFAULT HAL_COMPASS_HMC5843 define HAL_COMPASS_HMC5843_I2C_BUS 0 define HAL_COMPASS_HMC5843_ROTATION ROTATION_YAW_270 define HAL_EXT_COMPASS_HMC5843_I2C_BUS 1 # PWM out pins PA0 TIM2_CH1 TIM2 PWM(1) PA1 TIM2_CH2 TIM2 PWM(2) PA2 TIM2_CH3 TIM2 PWM(3) PA3 TIM2_CH4 TIM2 PWM(4) PE9 TIM1_CH1 TIM1 PWM(5) PE11 TIM1_CH2 TIM1 PWM(6) PE13 TIM1_CH3 TIM1 PWM(7) PE14 TIM1_CH4 TIM1 PWM(8) PD13 TIM4_CH2 TIM4 PWM(9) PD12 TIM4_CH1 TIM4 PWM(10) PD15 TIM4_CH4 TIM4 PWM(11) PD14 TIM4_CH3 TIM4 PWM(12) # also USART6_RX for serial RC PC7 TIM8_CH2 TIM8 RCIN PULLUP LOW DMA_CH0 # LED setup is similar to PixRacer define HAL_HAVE_PIXRACER_LED PE3 LED_RED OUTPUT GPIO(10) PE2 LED_GREEN OUTPUT GPIO(11) PE1 LED_BLUE OUTPUT GPIO(12) PE0 LED_YELOW OUTPUT GPIO(13) define HAL_GPIO_A_LED_PIN 10 define HAL_GPIO_B_LED_PIN 11 define HAL_GPIO_C_LED_PIN 12 define HAL_GPIO_LED_ON 0 define HAL_GPIO_LED_OFF 1 PC0 PRESSURE_SENS ADC1 SCALE(1) PC1 RSSI_IN ADC1 PC2 BATT_CURRENT_SENS ADC1 SCALE(2) PC3 BATT_VOLTAGE_SENS ADC1 SCALE(2) PC4 VDD_5V_SENS ADC1 SCALE(2) PC5 FMU_SERVORAIL_VCC_SENS ADC1 SCALE(2) PE5 TIM9_CH1 TIM9 ALARM PC14 EXTERN_GPIO1 GPIO(1) PC13 EXTERN_GPIO2 GPIO(2) PE4 EXTERN_GPIO3 GPIO(3) PE6 EXTERN_GPIO4 GPIO(4) PC9 EXTERN_GPIO5 GPIO(5) # IRQ for MPU6000 PB0 EXTI_MPU6000 INPUT PULLUP PB1 DRDY_HMC5883 INPUT PULLUP define AP_FEATURE_BRD_PWM_COUNT_PARAM 1 define BOARD_PWM_COUNT_DEFAULT 12