2 * This file is part of Cleanflight.
4 * Cleanflight is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * Cleanflight is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
20 #define TARGET_BOARD_IDENTIFIER "SP4E"
22 #ifndef SPRACINGF4EVO_REV
23 #define SPRACINGF4EVO_REV 2
26 #define USBD_PRODUCT_STRING "SP Racing F4 EVO"
31 #define BEEPER_INVERTED
34 #define GYRO_INT_EXTI PC13
35 #define USE_MPU_DATA_READY_SIGNAL
37 #define USE_MAG_DATA_READY_SIGNAL
38 #define ENSURE_MAG_DATA_READY_IS_HIGH
40 #define USE_IMU_MPU6500
41 #define IMU_MPU6500_ALIGN CW0_DEG
43 #define USE_IMU_MPU9250
44 #define IMU_MPU9250_ALIGN CW0_DEG
47 #define BARO_I2C_BUS BUS_I2C1
48 #define USE_BARO_BMP280
49 #define USE_BARO_MS5611
52 #define MAG_I2C_BUS BUS_I2C1
53 #define USE_MAG_MPU9250
54 #define USE_MAG_HMC5883
55 #define USE_MAG_QMC5883
56 #define USE_MAG_IST8310
57 #define USE_MAG_IST8308
58 #define USE_MAG_MAG3110
59 #define USE_MAG_LIS3MDL
61 #define TEMPERATURE_I2C_BUS BUS_I2C1
62 #define BNO055_I2C_BUS BUS_I2C1
66 #define USE_UART_INVERTER
73 #define SERIAL_PORT_COUNT 6
75 #define UART1_TX_PIN PA9
76 #define UART1_RX_PIN PA10
78 #define UART2_TX_PIN PA2
79 #define UART2_RX_PIN PA3
80 #define INVERTER_PIN_UART2_RX PB2
82 #define UART3_TX_PIN PB10
83 #define UART3_RX_PIN PB11
85 #define UART4_TX_PIN PC10
86 #define UART4_RX_PIN PC11
88 #define UART5_TX_PIN PC12
89 #define UART5_RX_PIN PD2
92 #define USE_I2C_DEVICE_1
94 #if (SPRACINGF4EVO_REV >= 2)
103 #define USE_SPI_DEVICE_1 // MPU
104 #define USE_SPI_DEVICE_2 // SDCard
105 #define USE_SPI_DEVICE_3 // External
107 #define SPI1_NSS_PIN PA4
108 #define SPI1_SCK_PIN PA5
109 #define SPI1_MISO_PIN PA6
110 #define SPI1_MOSI_PIN PA7
112 #define SPI2_NSS_PIN PB12
113 #define SPI2_SCK_PIN PB13
114 #define SPI2_MISO_PIN PB14
115 #define SPI2_MOSI_PIN PB15
117 #define SPI3_NSS_PIN PA15 // NC
118 #define SPI3_SCK_PIN PB3 // NC
119 #define SPI3_MISO_PIN PB4 // NC
120 #define SPI3_MOSI_PIN PB5 // NC
123 #define USE_SDCARD_SPI
124 #define SDCARD_DETECT_INVERTED
125 #define SDCARD_DETECT_PIN PC14
126 #define SDCARD_SPI_BUS BUS_SPI2
127 #define SDCARD_CS_PIN SPI2_NSS_PIN
129 #define MPU6500_CS_PIN SPI1_NSS_PIN
130 #define MPU6500_SPI_BUS BUS_SPI1
132 #define MPU9250_CS_PIN SPI1_NSS_PIN
133 #define MPU9250_SPI_BUS BUS_SPI1
136 #define ADC_CHANNEL_1_PIN PC1
137 #define ADC_CHANNEL_2_PIN PC2
138 #define ADC_CHANNEL_3_PIN PC0
139 #define VBAT_ADC_CHANNEL ADC_CHN_1
140 #define CURRENT_METER_ADC_CHANNEL ADC_CHN_2
141 #define RSSI_ADC_CHANNEL ADC_CHN_3
143 // PC4 - NC - Free for ADC12_IN14 / VTX CS
144 // PC5 - NC - Free for ADC12_IN15 / VTX Enable / OSD VSYNC
146 //#define USE_MAX7456
147 //#define USE_OSD_OVER_MSP_DISPLAYPORT
149 #define USE_LED_STRIP
150 #define WS2811_PIN PA1
152 #define ENABLE_BLACKBOX_LOGGING_ON_SDCARD_BY_DEFAULT
154 #define DEFAULT_RX_TYPE RX_TYPE_SERIAL
155 #define DEFAULT_FEATURES (FEATURE_TX_PROF_SEL | FEATURE_RSSI_ADC | FEATURE_TELEMETRY | FEATURE_LED_STRIP)
156 #define SERIALRX_UART SERIAL_PORT_USART2
157 #define TELEMETRY_UART SERIAL_PORT_USART5
158 #define SERIALRX_PROVIDER SERIALRX_SBUS
160 #define USE_SERIAL_4WAY_BLHELI_INTERFACE
162 #define TARGET_IO_PORTA 0xffff
163 #define TARGET_IO_PORTB 0xffff
164 #define TARGET_IO_PORTC 0xffff
165 #define TARGET_IO_PORTD (BIT(2))
167 #define MAX_PWM_OUTPUT_PORTS 8