Merge pull request #11195 from mathiasvr/pr-elrs-clean
[betaflight.git] / src / main / target / NUCLEOH743 / target.h
blob3a0796fd43439e66f5c112aa3fd80c13a4d9e318
1 /*
2 * This file is part of Cleanflight and Betaflight.
4 * Cleanflight and Betaflight are free software. You can redistribute
5 * this software and/or modify this software under the terms of the
6 * GNU General Public License as published by the Free Software
7 * Foundation, either version 3 of the License, or (at your option)
8 * any later version.
10 * Cleanflight and Betaflight are distributed in the hope that they
11 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
12 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 * See the GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this software.
18 * If not, see <http://www.gnu.org/licenses/>.
21 #pragma once
23 #define TARGET_BOARD_IDENTIFIER "H743"
24 #define USBD_PRODUCT_STRING "Nucleo-H743"
26 #define USE_TARGET_CONFIG
28 #define USE_DEBUG_PIN
29 #define DEBUG_PIN_COUNT 1
31 #define LED0_PIN PB0
32 #define LED1_PIN PB7 // PE1 on NUCLEO-H743ZI2 (may collide with UART8_TX)
33 //#define LED2_PIN PB14 // SDMMC2_D0
35 // Use explicit cache management as per https://github.com/betaflight/betaflight/pull/10378
36 #define USE_LEDSTRIP_CACHE_MGMT
38 // Nucleo-H743 has one button (The blue USER button).
39 // Force two buttons to look at the single button so config reset on button works
40 #define USE_BUTTONS
41 #define BUTTON_A_PIN PC13
42 #define BUTTON_A_PIN_INVERTED // Active high
43 #define BUTTON_B_PIN PC13
44 #define BUTTON_B_PIN_INVERTED // Active high
46 #define USE_BEEPER
47 #define BEEPER_PIN PE3
48 #define BEEPER_INVERTED
50 #define USE_UART
52 #define USE_UART1
53 #define UART1_RX_PIN PA10
54 #define UART1_TX_PIN PA9
56 #define USE_UART2
57 #define UART2_RX_PIN NONE // PD6, collide with SDMMC2_CK
58 #define UART2_TX_PIN PD5
60 #define USE_UART3
61 #define UART3_RX_PIN PD9 // ST-LINK Virtual COM Port
62 #define UART3_TX_PIN PD8 // ST-LINK Virtual COM Port
64 #define USE_UART4
65 #define UART4_RX_PIN PC11
66 #define UART4_TX_PIN PC10
68 #define USE_UART5
69 #define UART5_RX_PIN PD2
70 #define UART5_TX_PIN PC12
72 #define USE_UART6
73 #define UART6_RX_PIN PC7
74 #define UART6_TX_PIN PC6
76 #define USE_UART7
77 #define UART7_RX_PIN PE7
78 #define UART7_TX_PIN PE8
80 #define USE_UART8
81 #define UART8_RX_PIN PE0
82 #define UART8_TX_PIN PE1
84 #define USE_LPUART1
85 #define LPUART1_RX_PIN PB7 // PA10 (Shared with UART1)
86 #define LPUART1_TX_PIN PB6 // PA9 (Shared with UART1)
88 #define USE_VCP
90 #define USE_SOFTSERIAL1
91 #define USE_SOFTSERIAL2
93 #define SERIAL_PORT_COUNT 12
95 #define USE_SPI
97 #define USE_SPI_DEVICE_1
98 #define SPI1_SCK_PIN PB3
99 #define SPI1_MISO_PIN PB4
100 #define SPI1_MOSI_PIN PB5
102 #define USE_SPI_DEVICE_2
103 #define SPI2_SCK_PIN NONE
104 #define SPI2_MISO_PIN NONE
105 #define SPI2_MOSI_PIN NONE
107 #define USE_SPI_DEVICE_3
108 #define SPI3_SCK_PIN PC10 // PC10
109 #define SPI3_MISO_PIN PC11 // PC11
110 #define SPI3_MOSI_PIN PC12 // PC12
112 #define USE_SPI_DEVICE_4
113 #define SPI4_SCK_PIN NONE
114 #define SPI4_MISO_PIN NONE
115 #define SPI4_MOSI_PIN NONE
117 #define USE_SPI_DEVICE_5
118 #define SPI5_SCK_PIN NONE
119 #define SPI5_MISO_PIN NONE
120 #define SPI5_MOSI_PIN NONE
122 #define USE_SPI_DEVICE_6
123 #define SPI6_SCK_PIN NONE
124 #define SPI6_MISO_PIN NONE
125 #define SPI6_MOSI_PIN NONE
127 #define USE_QUADSPI
128 #define USE_QUADSPI_DEVICE_1
130 #define QUADSPI1_SCK_PIN NONE // PB2
132 #define QUADSPI1_BK1_IO0_PIN NONE // PD11
133 #define QUADSPI1_BK1_IO1_PIN NONE // PD12
134 #define QUADSPI1_BK1_IO2_PIN NONE // PE2
135 #define QUADSPI1_BK1_IO3_PIN NONE // PD13
136 #define QUADSPI1_BK1_CS_PIN NONE // PB10
138 #define QUADSPI1_BK2_IO0_PIN NONE // PE7
139 #define QUADSPI1_BK2_IO1_PIN NONE // PE8
140 #define QUADSPI1_BK2_IO2_PIN NONE // PE9
141 #define QUADSPI1_BK2_IO3_PIN NONE // PE10
142 #define QUADSPI1_BK2_CS_PIN NONE // NONE
144 #define QUADSPI1_MODE QUADSPI_MODE_BK1_ONLY
145 #define QUADSPI1_CS_FLAGS (QUADSPI_BK1_CS_HARDWARE | QUADSPI_BK2_CS_NONE | QUADSPI_CS_MODE_LINKED)
147 #if !defined(NUCLEOH743_RAMBASED)
149 #define USE_SDCARD
150 #define USE_SDCARD_SDIO
151 #define SDCARD_DETECT_PIN NONE
153 // SDMMC1
154 // CK PC12
155 // CMD PD2
156 // D0 PC8
157 // D1 PC9
158 // D2 PC10
159 // D3 PC11
161 // SDIO configuration for SDMMC1, 1-bit width
162 #define SDIO_DEVICE SDIODEV_2 // SDIODEV_1 (for SDMMC1) or SDIODEV_2 (for SDMMC2) (or SDIOINVALID)
163 #define SDIO_USE_4BIT false
164 #define SDIO_CK_PIN PD6 // SDMMC1: PC12 SDMMC2: PC1 or PD6
165 #define SDIO_CMD_PIN PD7 // SDMMC1: PD2 SDMMC2: PA0 or PD7
166 #define SDIO_D0_PIN PB14 // SDMMC1: PC8 SDMMC2: PB14
167 #define SDIO_D1_PIN NONE // SDMMC1: PC9 SDMMC2: PB15
168 #define SDIO_D2_PIN NONE // SDMMC1: PC10 SDMMC2: PB3
169 #define SDIO_D3_PIN NONE // SDMMC2: PC11 SDMMC2: PB4
171 #define USE_BLACKBOX
172 #define ENABLE_BLACKBOX_LOGGING_ON_SDCARD_BY_DEFAULT
173 #endif
175 #define USE_I2C
176 #define USE_I2C_DEVICE_1
177 #define I2C1_SCL PB8
178 #define I2C1_SDA PB9
179 #define I2C_DEVICE (I2CDEV_1)
181 // For testing I2C4on APB4
182 //#define USE_I2C_DEVICE_4
183 //#define I2C4_SCL PF14
184 //#define I2C4_SDA PF15
185 //#define I2C_DEVICE (I2CDEV_4)
187 #define USE_MAG
188 #define USE_MAG_HMC5883
189 #define USE_MAG_SPI_HMC5883
190 #define HMC5883_SPI_INSTANCE NULL
191 #define HMC5883_CS_PIN NONE
193 #define USE_BARO
194 #define USE_BARO_LPS
195 #define USE_BARO_BMP085
196 #define USE_BARO_BMP280
197 #define USE_BARO_BMP388
198 #define USE_BARO_MS5611
199 #define USE_BARO_SPI_BMP280
200 #define BMP280_SPI_INSTANCE NULL
201 #define BMP280_CS_PIN NONE
203 #define USE_GYRO
204 #define USE_MULTI_GYRO
205 #define USE_ACC
207 #define USE_FAKE_GYRO
208 #define USE_FAKE_ACC
209 #define USE_GYRO_SPI_MPU6000
210 #define USE_ACC_SPI_MPU6000
211 #define USE_GYRO_SPI_MPU6500
212 #define USE_ACC_SPI_MPU6500
213 #define USE_GYRO_SPI_MPU9250
214 #define USE_ACC_SPI_MPU9250
215 #define USE_GYRO_SPI_ICM42605
216 #define USE_ACC_SPI_ICM42605
217 #define USE_GYRO_SPI_ICM42688P
218 #define USE_ACC_SPI_ICM42688P
220 #define GYRO_1_CS_PIN PD15
221 #define GYRO_1_SPI_INSTANCE SPI1
223 // I2C acc/gyro test, may require to activate
224 // set gyro_x_bustype = I2C
225 // set gyro_x_i2cBus = <Bus ordinal of I2C_DEVICE>
226 //#define USE_GYRO_MPU6050
227 //#define USE_ACC_MPU6050
229 #define USE_FLASH_CHIP
230 #define USE_FLASH_M25P16
231 #define USE_FLASH_W25M
232 #define USE_FLASH_W25Q128FV
233 #define USE_FLASH_W25N01G
234 #define FLASH_SPI_INSTANCE NULL
235 #define FLASH_CS_PIN NONE
236 #define USE_FLASHFS
238 #define USE_BRUSHED_ESC_AUTODETECT // Detect if brushed motors are connected and set defaults appropriately to avoid motors spinning on boot
239 #define USE_GYRO_REGISTER_DUMP // Adds gyroregisters command to cli to dump configured register values
240 #define USE_TIMER
241 #define USE_PWM_OUTPUT
242 #define USE_MOTOR
244 #define USE_RANGEFINDER
245 #define USE_RANGEFINDER_HCSR04
246 #define USE_RANGEFINDER_TF
248 #define USE_TRANSPONDER
250 #define USE_MAX7456
251 #define MAX7456_SPI_INSTANCE NULL // SPI3
252 #define MAX7456_SPI_CS_PIN NONE // PC9
254 #define USE_I2C_OLED_DISPLAY
256 #define USE_ADC
258 // DMA stream assignmnets
259 #define VBAT_ADC_PIN PB1 // ADC1
260 #define CURRENT_METER_ADC_PIN PC0 // ADC1
261 #define RSSI_ADC_PIN PF14 // ADC2
262 #define EXTERNAL1_ADC_PIN PC3 // ADC3
264 #define DEFAULT_VOLTAGE_METER_SOURCE VOLTAGE_METER_ADC
265 #define DEFAULT_CURRENT_METER_SOURCE CURRENT_METER_ADC
267 #define USE_DSHOT
268 #define USE_DSHOT_DMAR
270 #define USE_DMA
272 // Thanks to DMAMUX, H7 does not have limitations on DMA stream assignments to devices (except for collisions among them).
273 //#define UART1_TX_DMA_OPT 0
274 //#define UART2_TX_DMA_OPT 1
275 //#define UART3_TX_DMA_OPT 2
276 //#define UART4_TX_DMA_OPT 3
277 //#define UART5_TX_DMA_OPT 4
278 //#define UART6_TX_DMA_OPT 5
279 //#define UART7_TX_DMA_OPT 6
280 //#define UART8_TX_DMA_OPT 7
281 #define ADC1_DMA_OPT 8
282 #define ADC2_DMA_OPT 9
283 #define ADC3_DMA_OPT 10
285 #define DEFAULT_FEATURE (FEATURE_OSD)
287 #define TARGET_IO_PORTA 0xffff
288 #define TARGET_IO_PORTB 0xffff
289 #define TARGET_IO_PORTC 0xffff
290 #define TARGET_IO_PORTD 0xffff
291 #define TARGET_IO_PORTE 0xffff
292 #define TARGET_IO_PORTF 0xffff
293 #define TARGET_IO_PORTG 0xffff
295 #define USABLE_TIMER_CHANNEL_COUNT 14
297 #define USED_TIMERS ( TIM_N(1) | TIM_N(2) | TIM_N(3) | TIM_N(5) | TIM_N(8) | TIM_N(12) )