Paparazzi UAS  v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
nucleo144_f767zi.h
Go to the documentation of this file.
1 #ifndef CONFIG_NUCLEO144_F767ZI_1_00_H
2 #define CONFIG_NUCLEO144_F767ZI_1_00_H
3 
4 #define BOARD_NUCLEO144_F767ZI
5 
14 
19 /*
20  * AHB_CLK
21  */
22 #define AHB_CLK STM32_HCLK
23 
24 /*
25  * Concat macro
26  */
27 #define _CONCAT_BOARD_PARAM(_s1, _s2) _s1 ## _s2
28 #define CONCAT_BOARD_PARAM(_s1, _s2) _CONCAT_BOARD_PARAM(_s1, _s2)
29 
30 /*
31  * LEDs
32  */
33 /* green, on PB0, 1 on LED_ON, 0 on LED_OFF */
34 #ifndef USE_LED_1
35 #define USE_LED_1 1
36 #endif
37 #define LED_1_GPIO PAL_PORT(LINE_LED1)
38 #define LED_1_GPIO_PIN PAL_PAD(LINE_LED1)
39 #define LED_1_GPIO_ON gpio_set
40 #define LED_1_GPIO_OFF gpio_clear
41 
42 /* blue, on PB7, 1 on LED_ON, 0 on LED_OFF */
43 #ifndef USE_LED_2
44 #define USE_LED_2 1
45 #endif
46 #define LED_2_GPIO PAL_PORT(LINE_LED2)
47 #define LED_2_GPIO_PIN PAL_PAD(LINE_LED2)
48 #define LED_2_GPIO_ON gpio_set
49 #define LED_2_GPIO_OFF gpio_clear
50 
51 /* red, on PB14, 1 on LED_ON, 0 on LED_OFF (disabled by default as shared with SPI2) */
52 #ifndef USE_LED_3
53 #define USE_LED_3 0
54 #endif
55 #define LED_3_GPIO PAL_PORT(LINE_LED3)
56 #define LED_3_GPIO_PIN PAL_PAD(LINE_LED3)
57 #define LED_3_GPIO_ON gpio_set
58 #define LED_3_GPIO_OFF gpio_clear
59 
60 /*
61  * ADCs
62  */
63 // AUXa1
64 #if USE_ADC_1
65 #define AD1_1_CHANNEL CONCAT_BOARD_PARAM(ADC_CHANNEL_IN, AUX_A1_ADC_IN)
66 #define ADC_1 AD1_1
67 #define ADC_1_GPIO_PORT PAL_PORT(LINE_AUX_A1)
68 #define ADC_1_GPIO_PIN PAL_PAD(LINE_AUX_A1)
69 #endif
70 
71 // AUXa2
72 #if USE_ADC_2
73 #define AD1_2_CHANNEL CONCAT_BOARD_PARAM(ADC_CHANNEL_IN, AUX_A2_ADC_IN)
74 #define ADC_2 AD1_2
75 #define ADC_2_GPIO_PORT PAL_PORT(LINE_AUX_A2)
76 #define ADC_2_GPIO_PIN PAL_PAD(LINE_AUX_A2)
77 #endif
78 
79 // AUXa3
80 #if USE_ADC_3
81 #define AD1_3_CHANNEL CONCAT_BOARD_PARAM(ADC_CHANNEL_IN, AUX_A3_ADC_IN)
82 #define ADC_3 AD1_3
83 #define ADC_3_GPIO_PORT PAL_PORT(LINE_AUX_A3)
84 #define ADC_3_GPIO_PIN PAL_PAD(LINE_AUX_A3)
85 #endif
86 
87 // AUXa4
88 #if USE_ADC_4
89 #define AD1_4_CHANNEL CONCAT_BOARD_PARAM(ADC_CHANNEL_IN, AUX_A4_ADC_IN)
90 #define ADC_4 AD1_4
91 #define ADC_4_GPIO_PORT PAL_PORT(LINE_AUX_A4)
92 #define ADC_4_GPIO_PIN PAL_PAD(LINE_AUX_A4)
93 #endif
94 
95 // AUXb1
96 #if USE_ADC_5
97 #define AD1_5_CHANNEL CONCAT_BOARD_PARAM(ADC_CHANNEL_IN, AUX_B1_ADC_IN)
98 #define ADC_5 AD1_5
99 #define ADC_5_GPIO_PORT PAL_PORT(LINE_AUX_B1)
100 #define ADC_5_GPIO_PIN PAL_PAD(LINE_AUX_B1)
101 #endif
102 
103 // AUXb2
104 #if USE_ADC_6
105 #define AD1_6_CHANNEL CONCAT_BOARD_PARAM(ADC_CHANNEL_IN, AUX_B2_ADC_IN)
106 #define ADC_6 AD1_6
107 #define ADC_6_GPIO_PORT PAL_PORT(LINE_AUX_B2)
108 #define ADC_6_GPIO_PIN PAL_PAD(LINE_AUX_B2)
109 #endif
110 
111 // AUXb3
112 //#if USE_ADC_7
113 //#define AD1_7_CHANNEL CONCAT_BOARD_PARAM(ADC_CHANNEL_IN, AUX_B3_ADC_IN)
114 //#define ADC_7 AD1_7
115 //#define ADC_7_GPIO_PORT PAL_PORT(LINE_AUX_B3)
116 //#define ADC_7_GPIO_PIN PAL_PAD(LINE_AUX_B3)
117 //#endif
118 
119 // AUXb4
120 #if USE_ADC_8
121 #define AD1_8_CHANNEL CONCAT_BOARD_PARAM(ADC_CHANNEL_IN, AUX_B4_ADC_IN)
122 #define ADC_8 AD1_8
123 #define ADC_8_GPIO_PORT PAL_PORT(LINE_AUX_B4)
124 #define ADC_8_GPIO_PIN PAL_PAD(LINE_AUX_B4)
125 #endif
126 
127 // Internal ADC for battery enabled by default
128 #ifndef USE_ADC_9
129 #define USE_ADC_9 1
130 #endif
131 #if USE_ADC_9
132 #define AD1_9_CHANNEL CONCAT_BOARD_PARAM(ADC_CHANNEL_IN, VBAT_MEAS_ADC_IN)
133 #define ADC_9 AD1_9
134 #define ADC_9_GPIO_PORT PAL_PORT(LINE_VBAT_MEAS)
135 #define ADC_9_GPIO_PIN PAL_PAD(LINE_VBAT_MEAS)
136 #endif
137 
138 /* allow to define ADC_CHANNEL_VSUPPLY in the airframe file*/
139 #ifndef ADC_CHANNEL_VSUPPLY
140 #define ADC_CHANNEL_VSUPPLY ADC_9
141 #endif
142 
143 /*
144  * R1 = 2.2k
145  * R2 = 12k
146  * adc * (3.3 / 2^12) * ((R1 + R2) / R1)
147  */
148 #define VBAT_R1 2200.0f
149 #define VBAT_R2 12000.0f
150 #define DefaultVoltageOfAdc(adc) ((3.3f/4096.0f)*((VBAT_R1+VBAT_R2)/VBAT_R1)*adc)
151 
152 /*
153  * PWM defines
154  */
155 
156 // SRVa connectors, activated in PWM mode by default
157 
158 #ifndef USE_PWM1
159 #define USE_PWM1 1
160 #endif
161 #if USE_PWM1
162 #define PWM_SERVO_1 1
163 #define PWM_SERVO_1_GPIO PAL_PORT(LINE_SRVA1)
164 #define PWM_SERVO_1_PIN PAL_PAD(LINE_SRVA1)
165 #define PWM_SERVO_1_AF AF_SRVA1
166 #define PWM_SERVO_1_DRIVER CONCAT_BOARD_PARAM(PWMD, SRVA1_TIM)
167 #define PWM_SERVO_1_CHANNEL (SRVA1_TIM_CH-1)
168 #define PWM_SERVO_1_ACTIVE PWM_OUTPUT_ACTIVE_HIGH
169 #else
170 #define PWM_SERVO_1_ACTIVE PWM_OUTPUT_DISABLED
171 #endif
172 
173 #ifndef USE_PWM2
174 #define USE_PWM2 1
175 #endif
176 #if USE_PWM2
177 #define PWM_SERVO_2 2
178 #define PWM_SERVO_2_GPIO PAL_PORT(LINE_SRVA2)
179 #define PWM_SERVO_2_PIN PAL_PAD(LINE_SRVA2)
180 #define PWM_SERVO_2_AF AF_SRVA2
181 #define PWM_SERVO_2_DRIVER CONCAT_BOARD_PARAM(PWMD, SRVA2_TIM)
182 #define PWM_SERVO_2_CHANNEL (SRVA2_TIM_CH-1)
183 #define PWM_SERVO_2_ACTIVE PWM_OUTPUT_ACTIVE_HIGH
184 #else
185 #define PWM_SERVO_2_ACTIVE PWM_OUTPUT_DISABLED
186 #endif
187 
188 #ifndef USE_PWM3
189 #define USE_PWM3 1
190 #endif
191 #if USE_PWM3
192 #define PWM_SERVO_3 3
193 #define PWM_SERVO_3_GPIO PAL_PORT(LINE_SRVA3)
194 #define PWM_SERVO_3_PIN PAL_PAD(LINE_SRVA3)
195 #define PWM_SERVO_3_AF AF_SRVA3
196 #define PWM_SERVO_3_DRIVER CONCAT_BOARD_PARAM(PWMD, SRVA3_TIM)
197 #define PWM_SERVO_3_CHANNEL (SRVA3_TIM_CH-1)
198 #define PWM_SERVO_3_ACTIVE PWM_OUTPUT_ACTIVE_HIGH
199 #else
200 #define PWM_SERVO_3_ACTIVE PWM_OUTPUT_DISABLED
201 #endif
202 
203 #ifndef USE_PWM4
204 #define USE_PWM4 1
205 #endif
206 #if USE_PWM4
207 #define PWM_SERVO_4 4
208 #define PWM_SERVO_4_GPIO PAL_PORT(LINE_SRVA4)
209 #define PWM_SERVO_4_PIN PAL_PAD(LINE_SRVA4)
210 #define PWM_SERVO_4_AF AF_SRVA4
211 #define PWM_SERVO_4_DRIVER CONCAT_BOARD_PARAM(PWMD, SRVA4_TIM)
212 #define PWM_SERVO_4_CHANNEL (SRVA4_TIM_CH-1)
213 #define PWM_SERVO_4_ACTIVE PWM_OUTPUT_ACTIVE_HIGH
214 #else
215 #define PWM_SERVO_4_ACTIVE PWM_OUTPUT_DISABLED
216 #endif
217 
218 // SRVb connector, PWM mode disabled by default (DShot is enabled by default)
219 
220 #ifndef USE_PWM5
221 #define USE_PWM5 0
222 #endif
223 #if USE_PWM5
224 #define PWM_SERVO_5 5
225 #define PWM_SERVO_5_GPIO PAL_PORT(LINE_SRVB1)
226 #define PWM_SERVO_5_PIN PAL_PAD(LINE_SRVB1)
227 #define PWM_SERVO_5_AF AF_SRVB1
228 #define PWM_SERVO_5_DRIVER CONCAT_BOARD_PARAM(PWMD, SRVB1_TIM)
229 #define PWM_SERVO_5_CHANNEL (SRVB1_TIM_CH-1)
230 #define PWM_SERVO_5_ACTIVE PWM_OUTPUT_ACTIVE_HIGH
231 #else
232 #define PWM_SERVO_5_ACTIVE PWM_OUTPUT_DISABLED
233 #endif
234 
235 #ifndef USE_PWM6
236 #define USE_PWM6 0
237 #endif
238 #if USE_PWM6
239 #define PWM_SERVO_6 6
240 #define PWM_SERVO_6_GPIO PAL_PORT(LINE_SRVB2)
241 #define PWM_SERVO_6_PIN PAL_PAD(LINE_SRVB2)
242 #define PWM_SERVO_6_AF AF_SRVB2
243 #define PWM_SERVO_6_DRIVER CONCAT_BOARD_PARAM(PWMD, SRVB2_TIM)
244 #define PWM_SERVO_6_CHANNEL (SRVB2_TIM_CH-1)
245 #define PWM_SERVO_6_ACTIVE PWM_OUTPUT_ACTIVE_HIGH
246 #else
247 #define PWM_SERVO_6_ACTIVE PWM_OUTPUT_DISABLED
248 #endif
249 
250 #ifndef USE_PWM7
251 #define USE_PWM7 0
252 #endif
253 #if USE_PWM7
254 #define PWM_SERVO_7 7
255 #define PWM_SERVO_7_GPIO PAL_PORT(LINE_SRVB3)
256 #define PWM_SERVO_7_PIN PAL_PAD(LINE_SRVB3)
257 #define PWM_SERVO_7_AF AF_SRVB3
258 #define PWM_SERVO_7_DRIVER CONCAT_BOARD_PARAM(PWMD, SRVB3_TIM)
259 #define PWM_SERVO_7_CHANNEL (SRVB3_TIM_CH-1)
260 #define PWM_SERVO_7_ACTIVE PWM_OUTPUT_ACTIVE_HIGH
261 #else
262 #define PWM_SERVO_7_ACTIVE PWM_OUTPUT_DISABLED
263 #endif
264 
265 #ifndef USE_PWM8
266 #define USE_PWM8 0
267 #endif
268 #if USE_PWM8
269 #define PWM_SERVO_8 8
270 #define PWM_SERVO_8_GPIO PAL_PORT(LINE_SRVB4)
271 #define PWM_SERVO_8_PIN PAL_PAD(LINE_SRVB4)
272 #define PWM_SERVO_8_AF AF_SRVB4
273 #define PWM_SERVO_8_DRIVER CONCAT_BOARD_PARAM(PWMD, SRVB4_TIM)
274 #define PWM_SERVO_8_CHANNEL (SRVB4_TIM_CH-1)
275 #define PWM_SERVO_8_ACTIVE PWM_OUTPUT_ACTIVE_HIGH
276 #else
277 #define PWM_SERVO_8_ACTIVE PWM_OUTPUT_DISABLED
278 #endif
279 
280 #ifndef USE_PWM9
281 #define USE_PWM9 0
282 #endif
283 #if USE_PWM9
284 #define PWM_SERVO_9 9
285 #define PWM_SERVO_9_GPIO PAL_PORT(LINE_AUX_A1)
286 #define PWM_SERVO_9_PIN PAL_PAD(LINE_AUX_A1)
287 #define PWM_SERVO_9_AF GPIO_AF2
288 #define PWM_SERVO_9_DRIVER CONCAT_BOARD_PARAM(PWMD, AUX_A1_TIM)
289 #define PWM_SERVO_9_CHANNEL (AUX_A1_TIM_CH-1)
290 #define PWM_SERVO_9_ACTIVE PWM_OUTPUT_ACTIVE_HIGH
291 #else
292 #define PWM_SERVO_9_ACTIVE PWM_OUTPUT_DISABLED
293 #endif
294 
295 #ifndef USE_PWM10
296 #define USE_PWM10 0
297 #endif
298 #if USE_PWM10
299 #define PWM_SERVO_10 10
300 #define PWM_SERVO_10_GPIO PAL_PORT(LINE_AUX_A2)
301 #define PWM_SERVO_10_PIN PAL_PAD(LINE_AUX_A2)
302 #define PWM_SERVO_10_AF GPIO_AF2
303 #define PWM_SERVO_10_DRIVER CONCAT_BOARD_PARAM(PWMD, AUX_A2_TIM)
304 #define PWM_SERVO_10_CHANNEL (AUX_A2_TIM_CH-1)
305 #define PWM_SERVO_10_ACTIVE PWM_OUTPUT_ACTIVE_HIGH
306 #else
307 #define PWM_SERVO_10_ACTIVE PWM_OUTPUT_DISABLED
308 #endif
309 
310 #ifndef USE_PWM11
311 #define USE_PWM11 0
312 #endif
313 #if USE_PWM11
314 #define PWM_SERVO_11 11
315 #define PWM_SERVO_11_GPIO PAL_PORT(LINE_AUX_A3)
316 #define PWM_SERVO_11_PIN PAL_PAD(LINE_AUX_A3)
317 #define PWM_SERVO_11_AF GPIO_AF2
318 #define PWM_SERVO_11_DRIVER CONCAT_BOARD_PARAM(PWMD, AUX_A3_TIM)
319 #define PWM_SERVO_11_CHANNEL (AUX_A3_TIM_CH-1)
320 #define PWM_SERVO_11_ACTIVE PWM_OUTPUT_ACTIVE_HIGH
321 #else
322 #define PWM_SERVO_11_ACTIVE PWM_OUTPUT_DISABLED
323 #endif
324 
325 #ifndef USE_PWM12
326 #define USE_PWM12 0
327 #endif
328 #if USE_PWM12
329 #define PWM_SERVO_12 12
330 #define PWM_SERVO_12_GPIO PAL_PORT(LINE_AUX_A4)
331 #define PWM_SERVO_12_PIN PAL_PAD(LINE_AUX_A4)
332 #define PWM_SERVO_12_AF GPIO_AF2
333 #define PWM_SERVO_12_DRIVER CONCAT_BOARD_PARAM(PWMD, AUX_A4_TIM)
334 #define PWM_SERVO_12_CHANNEL (AUX_A4_TIM_CH-1)
335 #define PWM_SERVO_12_ACTIVE PWM_OUTPUT_ACTIVE_HIGH
336 #else
337 #define PWM_SERVO_12_ACTIVE PWM_OUTPUT_DISABLED
338 #endif
339 
340 #ifndef USE_PWM13
341 #define USE_PWM13 0
342 #endif
343 #if USE_PWM13
344 #define PWM_SERVO_13 13
345 #define PWM_SERVO_13_GPIO PAL_PORT(LINE_AUX_B1)
346 #define PWM_SERVO_13_PIN PAL_PAD(LINE_AUX_B1)
347 #define PWM_SERVO_13_AF GPIO_AF2
348 #define PWM_SERVO_13_DRIVER CONCAT_BOARD_PARAM(PWMD, AUX_B1_TIM)
349 #define PWM_SERVO_13_CHANNEL (AUX_B1_TIM_CH-1)
350 #define PWM_SERVO_13_ACTIVE PWM_OUTPUT_ACTIVE_HIGH
351 #else
352 #define PWM_SERVO_13_ACTIVE PWM_OUTPUT_DISABLED
353 #endif
354 
355 #ifndef USE_PWM14
356 #define USE_PWM14 0
357 #endif
358 #if USE_PWM14
359 #define PWM_SERVO_14 14
360 #define PWM_SERVO_14_GPIO PAL_PORT(LINE_AUX_B2)
361 #define PWM_SERVO_14_PIN PAL_PAD(LINE_AUX_B2)
362 #define PWM_SERVO_14_AF GPIO_AF2
363 #define PWM_SERVO_14_DRIVER CONCAT_BOARD_PARAM(PWMD, AUX_B2_TIM)
364 #define PWM_SERVO_14_CHANNEL (AUX_B2_TIM_CH-1)
365 #define PWM_SERVO_14_ACTIVE PWM_OUTPUT_ACTIVE_HIGH
366 #else
367 #define PWM_SERVO_14_ACTIVE PWM_OUTPUT_DISABLED
368 #endif
369 
370 //#ifndef USE_PWM15
371 //#define USE_PWM15 0
372 //#endif
373 //#if USE_PWM15
374 //#define PWM_SERVO_15 15
375 //#define PWM_SERVO_15_GPIO PAL_PORT(LINE_AUX_B3)
376 //#define PWM_SERVO_15_PIN PAL_PAD(LINE_AUX_B3)
377 //#define PWM_SERVO_15_AF GPIO_AF2
378 //#define PWM_SERVO_15_DRIVER CONCAT_BOARD_PARAM(PWMD, AUX_B3_TIM)
379 //#define PWM_SERVO_15_CHANNEL (AUX_B3_TIM_CH-1)
380 //#define PWM_SERVO_15_ACTIVE PWM_OUTPUT_ACTIVE_HIGH
381 //#else
382 //#define PWM_SERVO_15_ACTIVE PWM_OUTPUT_DISABLED
383 //#endif
384 
385 #ifndef USE_PWM16
386 #define USE_PWM16 0
387 #endif
388 #if USE_PWM16
389 #define PWM_SERVO_16 16
390 #define PWM_SERVO_16_GPIO PAL_PORT(LINE_AUX_B4)
391 #define PWM_SERVO_16_PIN PAL_PAD(LINE_AUX_B4)
392 #define PWM_SERVO_16_AF GPIO_AF2
393 #define PWM_SERVO_16_DRIVER CONCAT_BOARD_PARAM(PWMD, AUX_B4_TIM)
394 #define PWM_SERVO_16_CHANNEL (AUX_B4_TIM_CH-1)
395 #define PWM_SERVO_16_ACTIVE PWM_OUTPUT_ACTIVE_HIGH
396 #else
397 #define PWM_SERVO_16_ACTIVE PWM_OUTPUT_DISABLED
398 #endif
399 
400 // servo index starting at 1 + regular servos + aux servos
401 // so NB = 1+8+8
402 #define ACTUATORS_PWM_NB 17
403 
404 
405 #ifdef STM32_PWM_USE_TIM1
406 #define PWM_CONF_TIM1 STM32_PWM_USE_TIM1
407 #else
408 #define PWM_CONF_TIM1 1
409 #endif
410 #define PWM_CONF1_DEF { \
411  PWM_FREQUENCY, \
412  PWM_FREQUENCY/TIM1_SERVO_HZ, \
413  NULL, \
414  { \
415  { PWM_SERVO_1_ACTIVE, NULL }, \
416  { PWM_SERVO_2_ACTIVE, NULL }, \
417  { PWM_SERVO_3_ACTIVE, NULL }, \
418  { PWM_SERVO_4_ACTIVE, NULL }, \
419  }, \
420  0, \
421  0 \
422 }
423 
424 #ifdef STM32_PWM_USE_TIM3
425 #define PWM_CONF_TIM3 STM32_PWM_USE_TIM3
426 #else
427 #define PWM_CONF_TIM3 1
428 #endif
429 #define PWM_CONF3_DEF { \
430  PWM_FREQUENCY, \
431  PWM_FREQUENCY/TIM3_SERVO_HZ, \
432  NULL, \
433  { \
434  { PWM_SERVO_12_ACTIVE, NULL }, \
435  { PWM_SERVO_14_ACTIVE, NULL }, \
436  { PWM_SERVO_15_ACTIVE, NULL }, \
437  { PWM_SERVO_16_ACTIVE, NULL }, \
438  }, \
439  0, \
440  0 \
441 }
442 
443 #ifdef STM32_PWM_USE_TIM4
444 #define PWM_CONF_TIM4 STM32_PWM_USE_TIM4
445 #else
446 #define PWM_CONF_TIM4 1
447 #endif
448 #define PWM_CONF4_DEF { \
449  PWM_FREQUENCY, \
450  PWM_FREQUENCY/TIM4_SERVO_HZ, \
451  NULL, \
452  { \
453  { PWM_SERVO_5_ACTIVE, NULL }, \
454  { PWM_SERVO_6_ACTIVE, NULL }, \
455  { PWM_SERVO_7_ACTIVE, NULL }, \
456  { PWM_SERVO_8_ACTIVE, NULL }, \
457  }, \
458  0, \
459  0 \
460 }
461 
462 #ifdef STM32_PWM_USE_TIM5
463 #define PWM_CONF_TIM5 STM32_PWM_USE_TIM5
464 #else
465 #define PWM_CONF_TIM5 1
466 #endif
467 #define PWM_CONF5_DEF { \
468  PWM_FREQUENCY, \
469  PWM_FREQUENCY/TIM5_SERVO_HZ, \
470  NULL, \
471  { \
472  { PWM_SERVO_9_ACTIVE, NULL }, \
473  { PWM_SERVO_10_ACTIVE, NULL }, \
474  { PWM_SERVO_11_ACTIVE, NULL }, \
475  { PWM_SERVO_13_ACTIVE, NULL }, \
476  }, \
477  0, \
478  0 \
479 }
480 
484 #ifndef DSHOT_TELEMETRY_DEV
485 #define DSHOT_TELEMETRY_DEV NULL
486 #endif
487 
488 #ifndef USE_DSHOT_TIM4
489 #define USE_DSHOT_TIM4 1 // use SRVb for DShot by default
490 #endif
491 
492 #if USE_DSHOT_TIM4 // Servo B1, B2, B3, B4 on TIM4
493 
494 // Servo B1, B2, B3, B4 on TM4 are primary DSHOT connector
495 #define DSHOT_SERVO_1 1
496 #define DSHOT_SERVO_1_GPIO PAL_PORT(LINE_SRVB1)
497 #define DSHOT_SERVO_1_PIN PAL_PAD(LINE_SRVB1)
498 #define DSHOT_SERVO_1_AF AF_SRVB1
499 #define DSHOT_SERVO_1_DRIVER CONCAT_BOARD_PARAM(DSHOTD, SRVB1_TIM)
500 #define DSHOT_SERVO_1_CHANNEL SRVB1_TIM_CH
501 
502 #define DSHOT_SERVO_2 2
503 #define DSHOT_SERVO_2_GPIO PAL_PORT(LINE_SRVB2)
504 #define DSHOT_SERVO_2_PIN PAL_PAD(LINE_SRVB2)
505 #define DSHOT_SERVO_2_AF AF_SRVB2
506 #define DSHOT_SERVO_2_DRIVER CONCAT_BOARD_PARAM(DSHOTD, SRVB2_TIM)
507 #define DSHOT_SERVO_2_CHANNEL SRVB2_TIM_CH
508 
509 #define DSHOT_SERVO_3 3
510 #define DSHOT_SERVO_3_GPIO PAL_PORT(LINE_SRVB3)
511 #define DSHOT_SERVO_3_PIN PAL_PAD(LINE_SRVB3)
512 #define DSHOT_SERVO_3_AF AF_SRVB3
513 #define DSHOT_SERVO_3_DRIVER CONCAT_BOARD_PARAM(DSHOTD, SRVB3_TIM)
514 #define DSHOT_SERVO_3_CHANNEL SRVB3_TIM_CH
515 
516 #define DSHOT_SERVO_4 4
517 #define DSHOT_SERVO_4_GPIO PAL_PORT(LINE_SRVB4)
518 #define DSHOT_SERVO_4_PIN PAL_PAD(LINE_SRVB4)
519 #define DSHOT_SERVO_4_AF AF_SRVB4
520 #define DSHOT_SERVO_4_DRIVER CONCAT_BOARD_PARAM(DSHOTD, SRVB4_TIM)
521 #define DSHOT_SERVO_4_CHANNEL SRVB4_TIM_CH
522 
523 #define DSHOT_CONF_TIM4 1
524 #define DSHOT_CONF4_DEF { \
525  .dma_stream = STM32_PWM4_UP_DMA_STREAM, \
526  .dma_channel = STM32_PWM4_UP_DMA_CHANNEL, \
527  .pwmp = &PWMD4, \
528  .tlm_sd = DSHOT_TELEMETRY_DEV, \
529  .dma_buf = &dshot4DmaBuffer, \
530  .dcache_memory_in_use = false \
531 }
532 
533 #endif
534 
535 #if USE_DSHOT_TIM1 // Servo A1, A2, A3, A4 on TIM1 only activated if needed
536 
537 #define DSHOT_SERVO_5 5
538 #define DSHOT_SERVO_5_GPIO PAL_PORT(LINE_SRVA1)
539 #define DSHOT_SERVO_5_PIN PAL_PAD(LINE_SRVA1)
540 #define DSHOT_SERVO_5_AF AF_SRVA1
541 #define DSHOT_SERVO_5_DRIVER CONCAT_BOARD_PARAM(DSHOTD, SRVA1_TIM)
542 #define DSHOT_SERVO_5_CHANNEL SRVA1_TIM_CH
543 
544 #define DSHOT_SERVO_6 6
545 #define DSHOT_SERVO_6_GPIO PAL_PORT(LINE_SRVA2)
546 #define DSHOT_SERVO_6_PIN PAL_PAD(LINE_SRVA2)
547 #define DSHOT_SERVO_6_AF AF_SRVA2
548 #define DSHOT_SERVO_6_DRIVER CONCAT_BOARD_PARAM(DSHOTD, SRVA2_TIM)
549 #define DSHOT_SERVO_6_CHANNEL SRVA2_TIM_CH
550 
551 #define DSHOT_SERVO_7 7
552 #define DSHOT_SERVO_7_GPIO PAL_PORT(LINE_SRVA3)
553 #define DSHOT_SERVO_7_PIN PAL_PAD(LINE_SRVA3)
554 #define DSHOT_SERVO_7_AF AF_SRVA3
555 #define DSHOT_SERVO_7_DRIVER CONCAT_BOARD_PARAM(DSHOTD, SRVA3_TIM)
556 #define DSHOT_SERVO_7_CHANNEL SRVA3_TIM_CH
557 
558 #define DSHOT_SERVO_8 8
559 #define DSHOT_SERVO_8_GPIO PAL_PORT(LINE_SRVA4)
560 #define DSHOT_SERVO_8_PIN PAL_PAD(LINE_SRVA4)
561 #define DSHOT_SERVO_8_AF AF_SRVA4
562 #define DSHOT_SERVO_8_DRIVER CONCAT_BOARD_PARAM(DSHOTD, SRVA4_TIM)
563 #define DSHOT_SERVO_8_CHANNEL SRVA4_TIM_CH
564 
565 #define DSHOT_CONF_TIM1 1
566 #define DSHOT_CONF1_DEF { \
567  .dma_stream = STM32_PWM1_UP_DMA_STREAM, \
568  .dma_channel = STM32_PWM1_UP_DMA_CHANNEL, \
569  .pwmp = &PWMD1, \
570  .tlm_sd = DSHOT_TELEMETRY_DEV, \
571  .dma_buf = &dshot1DmaBuffer, \
572  .dcache_memory_in_use = false \
573 }
574 
575 #endif
576 
580 #define UART2_GPIO_PORT_TX PAL_PORT(LINE_UART2_TX)
581 #define UART2_GPIO_TX PAL_PAD(LINE_UART2_TX)
582 #define UART2_GPIO_PORT_RX PAL_PORT(LINE_UART2_RX)
583 #define UART2_GPIO_RX PAL_PAD(LINE_UART2_RX)
584 #define UART2_GPIO_AF AF_UART2_TX
585 #ifndef UART2_HW_FLOW_CONTROL
586 #define UART2_HW_FLOW_CONTROL FALSE
587 #endif
588 
594 #define UART3_GPIO_PORT_TX PAL_PORT(LINE_UART3_TX)
595 #define UART3_GPIO_TX PAL_PAD(LINE_UART3_TX)
596 #define UART3_GPIO_PORT_RX PAL_PORT(LINE_UART3_RX)
597 #define UART3_GPIO_RX PAL_PAD(LINE_UART3_RX)
598 #define UART3_GPIO_AF AF_UART3_TX
599 
600 #define UART7_GPIO_PORT_TX PAL_PORT(LINE_UART7_TX)
601 #define UART7_GPIO_TX PAL_PAD(LINE_UART7_TX)
602 #define UART7_GPIO_PORT_RX PAL_PORT(LINE_UART7_RX)
603 #define UART7_GPIO_RX PAL_PAD(LINE_UART7_RX)
604 #define UART7_GPIO_AF AF_UART7_TX
605 
610 #define UART4_GPIO_PORT_TX PAL_PORT(LINE_AUX_A1)
611 #define UART4_GPIO_TX PAL_PAD(LINE_AUX_A1)
612 #define UART4_GPIO_PORT_RX PAL_PORT(LINE_AUX_A2)
613 #define UART4_GPIO_RX PAL_PAD(LINE_AUX_A2)
614 #define UART4_GPIO_AF AUX_A1_UART_AF
615 
628 // In case, do dynamic config of UARTs
629 #define USE_UART8_RX TRUE
630 #ifndef USE_UART8_TX // may be used in half duplex mode
631 #define USE_UART8_TX FALSE
632 #endif
633 #define UART8_GPIO_PORT_RX PAL_PORT(LINE_RC1)
634 #define UART8_GPIO_RX PAL_PAD(LINE_RC1)
635 #define UART8_GPIO_AF RC1_UART_AF
636 
637 // FIXME when RC2 is used for FrSky telemetry
638 #define USE_UART6_RX TRUE
639 #define USE_UART6_TX FALSE
640 #define UART6_GPIO_PORT_RX PAL_PORT(LINE_RC2)
641 #define UART6_GPIO_RX PAL_PAD(LINE_RC2)
642 #define UART6_GPIO_AF RC2_USART_AF
643 
644 /* The line that is pulled low at power up to initiate the bind process
645  * PB1: AUXb4
646  */
647 #define SPEKTRUM_BIND_PIN PAL_PORT(LINE_AUX_B4)
648 #define SPEKTRUM_BIND_PIN_PORT PAL_PAD(LINE_AUX_B4)
649 
650 // no wait with chibios as the RTC oscillator takes longer to stabilize
651 #define SPEKTRUM_BIND_WAIT 30000
652 
658 #define RC_PPM_TICKS_PER_USEC 6
659 #define PPM_TIMER_FREQUENCY 6000000
660 #define PPM_CHANNEL CONCAT_BOARD_PARAM(ICU_CHANNEL_, RC2_TIM_CH)
661 #define PPM_TIMER CONCAT_BOARD_PARAM(ICUD, RC2_TIM)
662 
663 /*
664  * PWM input
665  */
666 // PWM_INPUT 1 on PA0 (AUXa1)
667 #define PWM_INPUT1_ICU ICUD2
668 #define PWM_INPUT1_CHANNEL ICU_CHANNEL_1
669 #define PWM_INPUT1_GPIO_PORT PAL_PORT(LINE_AUX_A1)
670 #define PWM_INPUT1_GPIO_PIN PAL_PAD(LINE_AUX_A1)
671 #define PWM_INPUT1_GPIO_AF GPIO_AF1
672 
673 // PWM_INPUT 2 on PA1 (AUXa2)
674 #define PWM_INPUT2_ICU ICUD5
675 #define PWM_INPUT2_CHANNEL ICU_CHANNEL_2
676 #define PWM_INPUT2_GPIO_PORT PAL_PORT(LINE_AUX_A2)
677 #define PWM_INPUT2_GPIO_PIN PAL_PAD(LINE_AUX_A2)
678 #define PWM_INPUT2_GPIO_AF GPIO_AF2
679 
683 // Digital noise filter: 0 disabled, [0x1 - 0xF] enable up to n t_I2CCLK
684 #define STM32_CR1_DNF(n) ((n & 0x0f) << 8)
685 // Timing register
686 #define I2C_FAST_400KHZ_DNF0_100NS_PCLK54MHZ_TIMINGR (STM32_TIMINGR_PRESC(0U) | \
687  STM32_TIMINGR_SCLDEL(10U) | STM32_TIMINGR_SDADEL(0U) | \
688  STM32_TIMINGR_SCLH(34U) | STM32_TIMINGR_SCLL(86U))
689 #define I2C_STD_100KHZ_DNF0_100NS_PCLK54MHZ_TIMINGR (STM32_TIMINGR_PRESC(1U) | \
690  STM32_TIMINGR_SCLDEL(9U) | STM32_TIMINGR_SDADEL(0U) | \
691  STM32_TIMINGR_SCLH(105U) | STM32_TIMINGR_SCLL(153U))
692 
693 
694 // Internal I2C (baro, magneto)
695 
696 #ifndef I2C4_CLOCK_SPEED
697 #define I2C4_CLOCK_SPEED 400000
698 #endif
699 
700 #if I2C4_CLOCK_SPEED == 400000
701 #define I2C4_CFG_DEF { \
702  .timingr = I2C_FAST_400KHZ_DNF0_100NS_PCLK54MHZ_TIMINGR, \
703  .cr1 = STM32_CR1_DNF(0), \
704  .cr2 = 0 \
705 }
706 #elif I2C4_CLOCK_SPEED == 100000
707 #define I2C4_CFG_DEF { \
708  .timingr = I2C_STD_100KHZ_DNF0_100NS_PCLK54MHZ_TIMINGR, \
709  .cr1 = STM32_CR1_DNF(0), \
710  .cr2 = 0 \
711 }
712 #else
713 #error "Unknown I2C4 clock speed"
714 #endif
715 
716 // External I2C
717 
718 #ifndef I2C2_CLOCK_SPEED
719 #define I2C2_CLOCK_SPEED 400000
720 #endif
721 
722 #if I2C2_CLOCK_SPEED == 400000
723 #define I2C2_CFG_DEF { \
724  .timingr = I2C_FAST_400KHZ_DNF0_100NS_PCLK54MHZ_TIMINGR, \
725  .cr1 = STM32_CR1_DNF(0), \
726  .cr2 = 0 \
727 }
728 #elif I2C2_CLOCK_SPEED == 100000
729 #define I2C2_CFG_DEF { \
730  .timingr = I2C_STD_100KHZ_DNF0_100NS_PCLK54MHZ_TIMINGR, \
731  .cr1 = STM32_CR1_DNF(0), \
732  .cr2 = 0 \
733 }
734 #else
735 #error "Unknown I2C2 clock speed"
736 #endif
737 
742 // Internal SPI (IMU)
743 #define SPI4_GPIO_AF AF_SPI4_INTERNAL_CLK
744 #define SPI4_GPIO_PORT_MISO PAL_PORT(LINE_SPI4_INTERNAL_MISO)
745 #define SPI4_GPIO_MISO PAL_PAD(LINE_SPI4_INTERNAL_MISO)
746 #define SPI4_GPIO_PORT_MOSI PAL_PORT(LINE_SPI4_INTERNAL_MOSI)
747 #define SPI4_GPIO_MOSI PAL_PAD(LINE_SPI4_INTERNAL_MOSI)
748 #define SPI4_GPIO_PORT_SCK PAL_PORT(LINE_SPI4_INTERNAL_CLK)
749 #define SPI4_GPIO_SCK PAL_PAD(LINE_SPI4_INTERNAL_CLK)
750 
751 // External SPI
752 #define SPI2_GPIO_AF AF_SPI2_EXTERNAL_CLK
753 #define SPI2_GPIO_PORT_MISO PAL_PORT(LINE_SPI2_EXTERNAL_MISO)
754 #define SPI2_GPIO_MISO PAL_PAD(LINE_SPI2_EXTERNAL_MISO)
755 #define SPI2_GPIO_PORT_MOSI PAL_PORT(LINE_SPI2_EXTERNAL_MOSI)
756 #define SPI2_GPIO_MOSI PAL_PAD(LINE_SPI2_EXTERNAL_MOSI)
757 #define SPI2_GPIO_PORT_SCK PAL_PORT(LINE_SPI2_EXTERNAL_CLK)
758 #define SPI2_GPIO_SCK PAL_PAD(LINE_SPI2_EXTERNAL_CLK)
759 
760 // SLAVE0 on SPI connector (NSS possible)
761 #define SPI_SELECT_SLAVE0_PORT PAL_PORT(LINE_SPI2_EXTERNAL_CS)
762 #define SPI_SELECT_SLAVE0_PIN PAL_PAD(LINE_SPI2_EXTERNAL_CS)
763 // SLAVE1 on AUXb1
764 #define SPI_SELECT_SLAVE1_PORT PAL_PORT(LINE_AUX_B1)
765 #define SPI_SELECT_SLAVE1_PIN PAL_PAD(LINE_AUX_B1)
766 // SLAVE2 on AUXb2
767 #define SPI_SELECT_SLAVE2_PORT PAL_PORT(LINE_AUX_B2)
768 #define SPI_SELECT_SLAVE2_PIN PAL_PAD(LINE_AUX_B2)
769 // SLAVE3 on AUXb3
770 //#define SPI_SELECT_SLAVE3_PORT PAL_PORT(LINE_AUX_B3)
771 //#define SPI_SELECT_SLAVE3_PIN PAL_PAD(LINE_AUX_B3)
772 // SLAVE4 on AUXb4
773 #define SPI_SELECT_SLAVE4_PORT PAL_PORT(LINE_AUX_B4)
774 #define SPI_SELECT_SLAVE4_PIN PAL_PAD(LINE_AUX_B4)
775 // SLAVE5 on PE4 (internal IMU)
776 #define SPI_SELECT_SLAVE5_PORT PAL_PORT(LINE_SPI4_INTERNAL_CS)
777 #define SPI_SELECT_SLAVE5_PIN PAL_PAD(LINE_SPI4_INTERNAL_CS)
778 
785 #ifndef USE_BARO_BOARD
786 #define USE_BARO_BOARD 0
787 #endif
788 
792 #define SDIO_D0_PORT PAL_PORT(LINE_SDMMC1_D0)
793 #define SDIO_D0_PIN PAL_PAD(LINE_SDMMC1_D0)
794 #define SDIO_D1_PORT PAL_PORT(LINE_SDMMC1_D1)
795 #define SDIO_D1_PIN PAL_PAD(LINE_SDMMC1_D1)
796 #define SDIO_D2_PORT PAL_PORT(LINE_SDMMC1_D2)
797 #define SDIO_D2_PIN PAL_PAD(LINE_SDMMC1_D2)
798 #define SDIO_D3_PORT PAL_PORT(LINE_SDMMC1_D3)
799 #define SDIO_D3_PIN PAL_PAD(LINE_SDMMC1_D3)
800 #define SDIO_CK_PORT PAL_PORT(LINE_SDMMC1_CK)
801 #define SDIO_CK_PIN PAL_PAD(LINE_SDMMC1_CK)
802 #define SDIO_CMD_PORT PAL_PORT(LINE_SDMMC1_CMD)
803 #define SDIO_CMD_PIN PAL_PAD(LINE_SDMMC1_CMD)
804 #define SDIO_AF AF_SDMMC1_CK
805 // bat monitoring for file closing
806 #define SDLOG_BAT_ADC CONCAT_BOARD_PARAM(ADCD, VBAT_MEAS_ADC)
807 #define SDLOG_BAT_CHAN CONCAT_BOARD_PARAM(ADC_CHANNEL_IN, VBAT_MEAS_ADC_IN)
808 // usb led status
809 #define SDLOG_USB_LED 4
810 #define SDLOG_USB_VBUS_PORT PAL_PORT(LINE_USB_VBUS)
811 #define SDLOG_USB_VBUS_PIN PAL_PAD(LINE_USB_VBUS)
812 
813 
814 /*
815  * Actuators for fixedwing
816  */
817  /* Default actuators driver */
818 #define DEFAULT_ACTUATORS "subsystems/actuators/actuators_pwm.h"
819 #define ActuatorDefaultSet(_x,_y) ActuatorPwmSet(_x,_y)
820 #define ActuatorsDefaultInit() ActuatorsPwmInit()
821 #define ActuatorsDefaultCommit() ActuatorsPwmCommit()
822 
826 #define WS2812D1_GPIO PAL_PORT(LINE_AUX_A1)
827 #define WS2812D1_PIN PAL_PAD(LINE_AUX_A1)
828 #define WS2812D1_AF 2
829 #define WS2812D1_CFG_DEF { \
830  .dma_stream = STM32_PWM5_UP_DMA_STREAM, \
831  .dma_channel = STM32_PWM5_UP_DMA_CHANNEL, \
832  .dma_priority = STM32_PWM5_UP_DMA_PRIORITY, \
833  .pwm_channel = 0, \
834  .pwmp = &PWMD5 \
835 }
836 
837 #endif /* CONFIG_NUCLEO144_F767ZI_1_00_H */
838 
board.h