Paparazzi UAS
v7.0_unstable
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
13
#include "
boards/nucleo/144_f767zi/board.h
"
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 TIM defines
154
* enable TIM1 and TIM4 by default
155
*/
156
#ifndef USE_PWM_TIM1
157
#define USE_PWM_TIM1 1
158
#endif
159
160
#ifndef USE_PWM_TIM4
161
#define USE_PWM_TIM4 1
162
#endif
163
164
/*
165
* PWM defines
166
*/
167
168
// SRVa connectors, activated in PWM mode by default
169
170
#ifndef USE_PWM1
171
#define USE_PWM1 1
172
#endif
173
#if USE_PWM1
174
#define PWM_SERVO_1 1
175
#define PWM_SERVO_1_GPIO PAL_PORT(LINE_SRVA1)
176
#define PWM_SERVO_1_PIN PAL_PAD(LINE_SRVA1)
177
#define PWM_SERVO_1_AF AF_SRVA1
178
#define PWM_SERVO_1_DRIVER CONCAT_BOARD_PARAM(PWMD, SRVA1_TIM)
179
#define PWM_SERVO_1_CHANNEL (SRVA1_TIM_CH-1)
180
#define PWM_SERVO_1_CONF CONCAT_BOARD_PARAM(pwmcfg, SRVA1_TIM)
181
#endif
182
183
#ifndef USE_PWM2
184
#define USE_PWM2 1
185
#endif
186
#if USE_PWM2
187
#define PWM_SERVO_2 2
188
#define PWM_SERVO_2_GPIO PAL_PORT(LINE_SRVA2)
189
#define PWM_SERVO_2_PIN PAL_PAD(LINE_SRVA2)
190
#define PWM_SERVO_2_AF AF_SRVA2
191
#define PWM_SERVO_2_DRIVER CONCAT_BOARD_PARAM(PWMD, SRVA2_TIM)
192
#define PWM_SERVO_2_CHANNEL (SRVA2_TIM_CH-1)
193
#define PWM_SERVO_2_CONF CONCAT_BOARD_PARAM(pwmcfg, SRVA2_TIM)
194
#endif
195
196
#ifndef USE_PWM3
197
#define USE_PWM3 1
198
#endif
199
#if USE_PWM3
200
#define PWM_SERVO_3 3
201
#define PWM_SERVO_3_GPIO PAL_PORT(LINE_SRVA3)
202
#define PWM_SERVO_3_PIN PAL_PAD(LINE_SRVA3)
203
#define PWM_SERVO_3_AF AF_SRVA3
204
#define PWM_SERVO_3_DRIVER CONCAT_BOARD_PARAM(PWMD, SRVA3_TIM)
205
#define PWM_SERVO_3_CHANNEL (SRVA3_TIM_CH-1)
206
#define PWM_SERVO_3_CONF CONCAT_BOARD_PARAM(pwmcfg, SRVA3_TIM)
207
#endif
208
209
#ifndef USE_PWM4
210
#define USE_PWM4 1
211
#endif
212
#if USE_PWM4
213
#define PWM_SERVO_4 4
214
#define PWM_SERVO_4_GPIO PAL_PORT(LINE_SRVA4)
215
#define PWM_SERVO_4_PIN PAL_PAD(LINE_SRVA4)
216
#define PWM_SERVO_4_AF AF_SRVA4
217
#define PWM_SERVO_4_DRIVER CONCAT_BOARD_PARAM(PWMD, SRVA4_TIM)
218
#define PWM_SERVO_4_CHANNEL (SRVA4_TIM_CH-1)
219
#define PWM_SERVO_4_CONF CONCAT_BOARD_PARAM(pwmcfg, SRVA4_TIM)
220
#endif
221
222
// SRVb connector, PWM mode disabled by default (DShot is enabled by default)
223
224
#ifndef USE_PWM5
225
#define USE_PWM5 0
226
#endif
227
#if USE_PWM5
228
#define PWM_SERVO_5 5
229
#define PWM_SERVO_5_GPIO PAL_PORT(LINE_SRVB1)
230
#define PWM_SERVO_5_PIN PAL_PAD(LINE_SRVB1)
231
#define PWM_SERVO_5_AF AF_SRVB1
232
#define PWM_SERVO_5_DRIVER CONCAT_BOARD_PARAM(PWMD, SRVB1_TIM)
233
#define PWM_SERVO_5_CHANNEL (SRVB1_TIM_CH-1)
234
#define PWM_SERVO_5_CONF CONCAT_BOARD_PARAM(pwmcfg, SRVB1_TIM)
235
#endif
236
237
#ifndef USE_PWM6
238
#define USE_PWM6 0
239
#endif
240
#if USE_PWM6
241
#define PWM_SERVO_6 6
242
#define PWM_SERVO_6_GPIO PAL_PORT(LINE_SRVB2)
243
#define PWM_SERVO_6_PIN PAL_PAD(LINE_SRVB2)
244
#define PWM_SERVO_6_AF AF_SRVB2
245
#define PWM_SERVO_6_DRIVER CONCAT_BOARD_PARAM(PWMD, SRVB2_TIM)
246
#define PWM_SERVO_6_CHANNEL (SRVB2_TIM_CH-1)
247
#define PWM_SERVO_6_CONF CONCAT_BOARD_PARAM(pwmcfg, SRVB2_TIM)
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_CONF CONCAT_BOARD_PARAM(pwmcfg, SRVB3_TIM)
261
#endif
262
263
#ifndef USE_PWM8
264
#define USE_PWM8 0
265
#endif
266
#if USE_PWM8
267
#define PWM_SERVO_8 8
268
#define PWM_SERVO_8_GPIO PAL_PORT(LINE_SRVB4)
269
#define PWM_SERVO_8_PIN PAL_PAD(LINE_SRVB4)
270
#define PWM_SERVO_8_AF AF_SRVB4
271
#define PWM_SERVO_8_DRIVER CONCAT_BOARD_PARAM(PWMD, SRVB4_TIM)
272
#define PWM_SERVO_8_CHANNEL (SRVB4_TIM_CH-1)
273
#define PWM_SERVO_8_CONF CONCAT_BOARD_PARAM(pwmcfg, SRVB4_TIM)
274
#endif
275
276
#ifndef USE_PWM9
277
#define USE_PWM9 0
278
#endif
279
#if USE_PWM9
280
#define PWM_SERVO_9 9
281
#define PWM_SERVO_9_GPIO PAL_PORT(LINE_AUX_A1)
282
#define PWM_SERVO_9_PIN PAL_PAD(LINE_AUX_A1)
283
#define PWM_SERVO_9_AF GPIO_AF2
284
#define PWM_SERVO_9_DRIVER CONCAT_BOARD_PARAM(PWMD, AUX_A1_TIM)
285
#define PWM_SERVO_9_CHANNEL (AUX_A1_TIM_CH-1)
286
#define PWM_SERVO_9_CONF CONCAT_BOARD_PARAM(pwmcfg, AUX_A1_TIM)
287
#endif
288
289
#ifndef USE_PWM10
290
#define USE_PWM10 0
291
#endif
292
#if USE_PWM10
293
#define PWM_SERVO_10 10
294
#define PWM_SERVO_10_GPIO PAL_PORT(LINE_AUX_A2)
295
#define PWM_SERVO_10_PIN PAL_PAD(LINE_AUX_A2)
296
#define PWM_SERVO_10_AF GPIO_AF2
297
#define PWM_SERVO_10_DRIVER CONCAT_BOARD_PARAM(PWMD, AUX_A2_TIM)
298
#define PWM_SERVO_10_CHANNEL (AUX_A2_TIM_CH-1)
299
#define PWM_SERVO_10_CONF CONCAT_BOARD_PARAM(pwmcfg, AUX_A2_TIM)
300
#endif
301
302
#ifndef USE_PWM11
303
#define USE_PWM11 0
304
#endif
305
#if USE_PWM11
306
#define PWM_SERVO_11 11
307
#define PWM_SERVO_11_GPIO PAL_PORT(LINE_AUX_A3)
308
#define PWM_SERVO_11_PIN PAL_PAD(LINE_AUX_A3)
309
#define PWM_SERVO_11_AF GPIO_AF2
310
#define PWM_SERVO_11_DRIVER CONCAT_BOARD_PARAM(PWMD, AUX_A3_TIM)
311
#define PWM_SERVO_11_CHANNEL (AUX_A3_TIM_CH-1)
312
#define PWM_SERVO_11_CONF CONCAT_BOARD_PARAM(pwmcfg, AUX_A3_TIM)
313
#endif
314
315
#ifndef USE_PWM12
316
#define USE_PWM12 0
317
#endif
318
#if USE_PWM12
319
#define PWM_SERVO_12 12
320
#define PWM_SERVO_12_GPIO PAL_PORT(LINE_AUX_A4)
321
#define PWM_SERVO_12_PIN PAL_PAD(LINE_AUX_A4)
322
#define PWM_SERVO_12_AF GPIO_AF2
323
#define PWM_SERVO_12_DRIVER CONCAT_BOARD_PARAM(PWMD, AUX_A4_TIM)
324
#define PWM_SERVO_12_CHANNEL (AUX_A4_TIM_CH-1)
325
#define PWM_SERVO_12_CONF CONCAT_BOARD_PARAM(pwmcfg, AUX_A4_TIM)
326
#endif
327
328
#ifndef USE_PWM13
329
#define USE_PWM13 0
330
#endif
331
#if USE_PWM13
332
#define PWM_SERVO_13 13
333
#define PWM_SERVO_13_GPIO PAL_PORT(LINE_AUX_B1)
334
#define PWM_SERVO_13_PIN PAL_PAD(LINE_AUX_B1)
335
#define PWM_SERVO_13_AF GPIO_AF2
336
#define PWM_SERVO_13_DRIVER CONCAT_BOARD_PARAM(PWMD, AUX_B1_TIM)
337
#define PWM_SERVO_13_CHANNEL (AUX_B1_TIM_CH-1)
338
#define PWM_SERVO_13_CONF CONCAT_BOARD_PARAM(pwmcfg, AUX_B1_TIM)
339
#endif
340
341
#ifndef USE_PWM14
342
#define USE_PWM14 0
343
#endif
344
#if USE_PWM14
345
#define PWM_SERVO_14 14
346
#define PWM_SERVO_14_GPIO PAL_PORT(LINE_AUX_B2)
347
#define PWM_SERVO_14_PIN PAL_PAD(LINE_AUX_B2)
348
#define PWM_SERVO_14_AF GPIO_AF2
349
#define PWM_SERVO_14_DRIVER CONCAT_BOARD_PARAM(PWMD, AUX_B2_TIM)
350
#define PWM_SERVO_14_CHANNEL (AUX_B2_TIM_CH-1)
351
#define PWM_SERVO_14_CONF CONCAT_BOARD_PARAM(pwmcfg, AUX_B2_TIM)
352
#endif
353
354
//#ifndef USE_PWM15
355
//#define USE_PWM15 0
356
//#endif
357
//#if USE_PWM15
358
//#define PWM_SERVO_15 15
359
//#define PWM_SERVO_15_GPIO PAL_PORT(LINE_AUX_B3)
360
//#define PWM_SERVO_15_PIN PAL_PAD(LINE_AUX_B3)
361
//#define PWM_SERVO_15_AF GPIO_AF2
362
//#define PWM_SERVO_15_DRIVER CONCAT_BOARD_PARAM(PWMD, AUX_B3_TIM)
363
//#define PWM_SERVO_15_CHANNEL (AUX_B3_TIM_CH-1)
364
//#define PWM_SERVO_15_CONF CONCAT_BOARD_PARAM(pwmcfg, AUX_B3_TIM)
365
//#endif
366
367
#ifndef USE_PWM16
368
#define USE_PWM16 0
369
#endif
370
#if USE_PWM16
371
#define PWM_SERVO_16 16
372
#define PWM_SERVO_16_GPIO PAL_PORT(LINE_AUX_B4)
373
#define PWM_SERVO_16_PIN PAL_PAD(LINE_AUX_B4)
374
#define PWM_SERVO_16_AF GPIO_AF2
375
#define PWM_SERVO_16_DRIVER CONCAT_BOARD_PARAM(PWMD, AUX_B4_TIM)
376
#define PWM_SERVO_16_CHANNEL (AUX_B4_TIM_CH-1)
377
#define PWM_SERVO_16_CONF CONCAT_BOARD_PARAM(pwmcfg, AUX_B4_TIM)
378
#endif
379
380
// servo index starting at 1 + regular servos + aux servos
381
// so NB = 1+8+8
382
#define ACTUATORS_PWM_NB 17
383
384
388
#ifndef DSHOT_TELEMETRY_DEV
389
#define DSHOT_TELEMETRY_DEV NULL
390
#endif
391
392
#ifndef USE_DSHOT_TIM4
393
#define USE_DSHOT_TIM4 1
// use SRVb for DShot by default
394
#endif
395
396
#if USE_DSHOT_TIM4
// Servo B1, B2, B3, B4 on TIM4
397
398
// Servo B1, B2, B3, B4 on TM4 are primary DSHOT connector
399
#define DSHOT_SERVO_1 1
400
#define DSHOT_SERVO_1_GPIO PAL_PORT(LINE_SRVB1)
401
#define DSHOT_SERVO_1_PIN PAL_PAD(LINE_SRVB1)
402
#define DSHOT_SERVO_1_AF AF_SRVB1
403
#define DSHOT_SERVO_1_DRIVER CONCAT_BOARD_PARAM(DSHOTD, SRVB1_TIM)
404
#define DSHOT_SERVO_1_CHANNEL SRVB1_TIM_CH
405
406
#define DSHOT_SERVO_2 2
407
#define DSHOT_SERVO_2_GPIO PAL_PORT(LINE_SRVB2)
408
#define DSHOT_SERVO_2_PIN PAL_PAD(LINE_SRVB2)
409
#define DSHOT_SERVO_2_AF AF_SRVB2
410
#define DSHOT_SERVO_2_DRIVER CONCAT_BOARD_PARAM(DSHOTD, SRVB2_TIM)
411
#define DSHOT_SERVO_2_CHANNEL SRVB2_TIM_CH
412
413
#define DSHOT_SERVO_3 3
414
#define DSHOT_SERVO_3_GPIO PAL_PORT(LINE_SRVB3)
415
#define DSHOT_SERVO_3_PIN PAL_PAD(LINE_SRVB3)
416
#define DSHOT_SERVO_3_AF AF_SRVB3
417
#define DSHOT_SERVO_3_DRIVER CONCAT_BOARD_PARAM(DSHOTD, SRVB3_TIM)
418
#define DSHOT_SERVO_3_CHANNEL SRVB3_TIM_CH
419
420
#define DSHOT_SERVO_4 4
421
#define DSHOT_SERVO_4_GPIO PAL_PORT(LINE_SRVB4)
422
#define DSHOT_SERVO_4_PIN PAL_PAD(LINE_SRVB4)
423
#define DSHOT_SERVO_4_AF AF_SRVB4
424
#define DSHOT_SERVO_4_DRIVER CONCAT_BOARD_PARAM(DSHOTD, SRVB4_TIM)
425
#define DSHOT_SERVO_4_CHANNEL SRVB4_TIM_CH
426
427
#define DSHOT_CONF_TIM4 1
428
#define DSHOT_CONF4_DEF { \
429
.dma_stream = STM32_PWM4_UP_DMA_STREAM, \
430
.dma_channel = STM32_PWM4_UP_DMA_CHANNEL, \
431
.pwmp = &PWMD4, \
432
.tlm_sd = DSHOT_TELEMETRY_DEV, \
433
.dma_buf = &dshot4DmaBuffer, \
434
.dcache_memory_in_use = false \
435
}
436
437
#endif
438
439
#if USE_DSHOT_TIM1
// Servo A1, A2, A3, A4 on TIM1 only activated if needed
440
441
#define DSHOT_SERVO_5 5
442
#define DSHOT_SERVO_5_GPIO PAL_PORT(LINE_SRVA1)
443
#define DSHOT_SERVO_5_PIN PAL_PAD(LINE_SRVA1)
444
#define DSHOT_SERVO_5_AF AF_SRVA1
445
#define DSHOT_SERVO_5_DRIVER CONCAT_BOARD_PARAM(DSHOTD, SRVA1_TIM)
446
#define DSHOT_SERVO_5_CHANNEL SRVA1_TIM_CH
447
448
#define DSHOT_SERVO_6 6
449
#define DSHOT_SERVO_6_GPIO PAL_PORT(LINE_SRVA2)
450
#define DSHOT_SERVO_6_PIN PAL_PAD(LINE_SRVA2)
451
#define DSHOT_SERVO_6_AF AF_SRVA2
452
#define DSHOT_SERVO_6_DRIVER CONCAT_BOARD_PARAM(DSHOTD, SRVA2_TIM)
453
#define DSHOT_SERVO_6_CHANNEL SRVA2_TIM_CH
454
455
#define DSHOT_SERVO_7 7
456
#define DSHOT_SERVO_7_GPIO PAL_PORT(LINE_SRVA3)
457
#define DSHOT_SERVO_7_PIN PAL_PAD(LINE_SRVA3)
458
#define DSHOT_SERVO_7_AF AF_SRVA3
459
#define DSHOT_SERVO_7_DRIVER CONCAT_BOARD_PARAM(DSHOTD, SRVA3_TIM)
460
#define DSHOT_SERVO_7_CHANNEL SRVA3_TIM_CH
461
462
#define DSHOT_SERVO_8 8
463
#define DSHOT_SERVO_8_GPIO PAL_PORT(LINE_SRVA4)
464
#define DSHOT_SERVO_8_PIN PAL_PAD(LINE_SRVA4)
465
#define DSHOT_SERVO_8_AF AF_SRVA4
466
#define DSHOT_SERVO_8_DRIVER CONCAT_BOARD_PARAM(DSHOTD, SRVA4_TIM)
467
#define DSHOT_SERVO_8_CHANNEL SRVA4_TIM_CH
468
469
#define DSHOT_CONF_TIM1 1
470
#define DSHOT_CONF1_DEF { \
471
.dma_stream = STM32_PWM1_UP_DMA_STREAM, \
472
.dma_channel = STM32_PWM1_UP_DMA_CHANNEL, \
473
.pwmp = &PWMD1, \
474
.tlm_sd = DSHOT_TELEMETRY_DEV, \
475
.dma_buf = &dshot1DmaBuffer, \
476
.dcache_memory_in_use = false \
477
}
478
479
#endif
480
484
#define UART2_GPIO_PORT_TX PAL_PORT(LINE_UART2_TX)
485
#define UART2_GPIO_TX PAL_PAD(LINE_UART2_TX)
486
#define UART2_GPIO_PORT_RX PAL_PORT(LINE_UART2_RX)
487
#define UART2_GPIO_RX PAL_PAD(LINE_UART2_RX)
488
#define UART2_GPIO_AF AF_UART2_TX
489
#ifndef UART2_HW_FLOW_CONTROL
490
#define UART2_HW_FLOW_CONTROL FALSE
491
#endif
492
498
#define UART3_GPIO_PORT_TX PAL_PORT(LINE_UART3_TX)
499
#define UART3_GPIO_TX PAL_PAD(LINE_UART3_TX)
500
#define UART3_GPIO_PORT_RX PAL_PORT(LINE_UART3_RX)
501
#define UART3_GPIO_RX PAL_PAD(LINE_UART3_RX)
502
#define UART3_GPIO_AF AF_UART3_TX
503
504
#define UART7_GPIO_PORT_TX PAL_PORT(LINE_UART7_TX)
505
#define UART7_GPIO_TX PAL_PAD(LINE_UART7_TX)
506
#define UART7_GPIO_PORT_RX PAL_PORT(LINE_UART7_RX)
507
#define UART7_GPIO_RX PAL_PAD(LINE_UART7_RX)
508
#define UART7_GPIO_AF AF_UART7_TX
509
514
#define UART4_GPIO_PORT_TX PAL_PORT(LINE_AUX_A1)
515
#define UART4_GPIO_TX PAL_PAD(LINE_AUX_A1)
516
#define UART4_GPIO_PORT_RX PAL_PORT(LINE_AUX_A2)
517
#define UART4_GPIO_RX PAL_PAD(LINE_AUX_A2)
518
#define UART4_GPIO_AF AUX_A1_UART_AF
519
532
// In case, do dynamic config of UARTs
533
#define USE_UART8_RX TRUE
534
#ifndef USE_UART8_TX
// may be used in half duplex mode
535
#define USE_UART8_TX FALSE
536
#endif
537
#define UART8_GPIO_PORT_RX PAL_PORT(LINE_RC1)
538
#define UART8_GPIO_RX PAL_PAD(LINE_RC1)
539
#define UART8_GPIO_AF RC1_UART_AF
540
541
// FIXME when RC2 is used for FrSky telemetry
542
#define USE_UART6_RX TRUE
543
#define USE_UART6_TX FALSE
544
#define UART6_GPIO_PORT_RX PAL_PORT(LINE_RC2)
545
#define UART6_GPIO_RX PAL_PAD(LINE_RC2)
546
#define UART6_GPIO_AF RC2_USART_AF
547
548
/* The line that is pulled low at power up to initiate the bind process
549
* PB1: AUXb4
550
*/
551
#define SPEKTRUM_BIND_PIN PAL_PORT(LINE_AUX_B4)
552
#define SPEKTRUM_BIND_PIN_PORT PAL_PAD(LINE_AUX_B4)
553
554
// no wait with chibios as the RTC oscillator takes longer to stabilize
555
#define SPEKTRUM_BIND_WAIT 30000
556
562
#define RC_PPM_TICKS_PER_USEC 6
563
#define PPM_TIMER_FREQUENCY 6000000
564
#define PPM_CHANNEL CONCAT_BOARD_PARAM(ICU_CHANNEL_, RC2_TIM_CH)
565
#define PPM_TIMER CONCAT_BOARD_PARAM(ICUD, RC2_TIM)
566
567
/*
568
* PWM input
569
*/
570
// PWM_INPUT 1 on PA0 (AUXa1)
571
#define PWM_INPUT1_ICU ICUD2
572
#define PWM_INPUT1_CHANNEL ICU_CHANNEL_1
573
#define PWM_INPUT1_GPIO_PORT PAL_PORT(LINE_AUX_A1)
574
#define PWM_INPUT1_GPIO_PIN PAL_PAD(LINE_AUX_A1)
575
#define PWM_INPUT1_GPIO_AF GPIO_AF1
576
577
// PWM_INPUT 2 on PA1 (AUXa2)
578
#define PWM_INPUT2_ICU ICUD5
579
#define PWM_INPUT2_CHANNEL ICU_CHANNEL_2
580
#define PWM_INPUT2_GPIO_PORT PAL_PORT(LINE_AUX_A2)
581
#define PWM_INPUT2_GPIO_PIN PAL_PAD(LINE_AUX_A2)
582
#define PWM_INPUT2_GPIO_AF GPIO_AF2
583
587
// Digital noise filter: 0 disabled, [0x1 - 0xF] enable up to n t_I2CCLK
588
#define STM32_CR1_DNF(n) ((n & 0x0f) << 8)
589
// Timing register
590
#define I2C_FAST_400KHZ_DNF0_100NS_PCLK54MHZ_TIMINGR (STM32_TIMINGR_PRESC(0U) | \
591
STM32_TIMINGR_SCLDEL(10U) | STM32_TIMINGR_SDADEL(0U) | \
592
STM32_TIMINGR_SCLH(34U) | STM32_TIMINGR_SCLL(86U))
593
#define I2C_STD_100KHZ_DNF0_100NS_PCLK54MHZ_TIMINGR (STM32_TIMINGR_PRESC(1U) | \
594
STM32_TIMINGR_SCLDEL(9U) | STM32_TIMINGR_SDADEL(0U) | \
595
STM32_TIMINGR_SCLH(105U) | STM32_TIMINGR_SCLL(153U))
596
597
598
// Internal I2C (baro, magneto)
599
600
#ifndef I2C4_CLOCK_SPEED
601
#define I2C4_CLOCK_SPEED 400000
602
#endif
603
604
#if I2C4_CLOCK_SPEED == 400000
605
#define I2C4_CFG_DEF { \
606
.timingr = I2C_FAST_400KHZ_DNF0_100NS_PCLK54MHZ_TIMINGR, \
607
.cr1 = STM32_CR1_DNF(0), \
608
.cr2 = 0 \
609
}
610
#elif I2C4_CLOCK_SPEED == 100000
611
#define I2C4_CFG_DEF { \
612
.timingr = I2C_STD_100KHZ_DNF0_100NS_PCLK54MHZ_TIMINGR, \
613
.cr1 = STM32_CR1_DNF(0), \
614
.cr2 = 0 \
615
}
616
#else
617
#error "Unknown I2C4 clock speed"
618
#endif
619
620
// External I2C
621
622
#ifndef I2C2_CLOCK_SPEED
623
#define I2C2_CLOCK_SPEED 400000
624
#endif
625
626
#if I2C2_CLOCK_SPEED == 400000
627
#define I2C2_CFG_DEF { \
628
.timingr = I2C_FAST_400KHZ_DNF0_100NS_PCLK54MHZ_TIMINGR, \
629
.cr1 = STM32_CR1_DNF(0), \
630
.cr2 = 0 \
631
}
632
#elif I2C2_CLOCK_SPEED == 100000
633
#define I2C2_CFG_DEF { \
634
.timingr = I2C_STD_100KHZ_DNF0_100NS_PCLK54MHZ_TIMINGR, \
635
.cr1 = STM32_CR1_DNF(0), \
636
.cr2 = 0 \
637
}
638
#else
639
#error "Unknown I2C2 clock speed"
640
#endif
641
646
// Internal SPI (IMU)
647
#define SPI4_GPIO_AF AF_SPI4_INTERNAL_CLK
648
#define SPI4_GPIO_PORT_MISO PAL_PORT(LINE_SPI4_INTERNAL_MISO)
649
#define SPI4_GPIO_MISO PAL_PAD(LINE_SPI4_INTERNAL_MISO)
650
#define SPI4_GPIO_PORT_MOSI PAL_PORT(LINE_SPI4_INTERNAL_MOSI)
651
#define SPI4_GPIO_MOSI PAL_PAD(LINE_SPI4_INTERNAL_MOSI)
652
#define SPI4_GPIO_PORT_SCK PAL_PORT(LINE_SPI4_INTERNAL_CLK)
653
#define SPI4_GPIO_SCK PAL_PAD(LINE_SPI4_INTERNAL_CLK)
654
655
// External SPI
656
#define SPI2_GPIO_AF AF_SPI2_EXTERNAL_CLK
657
#define SPI2_GPIO_PORT_MISO PAL_PORT(LINE_SPI2_EXTERNAL_MISO)
658
#define SPI2_GPIO_MISO PAL_PAD(LINE_SPI2_EXTERNAL_MISO)
659
#define SPI2_GPIO_PORT_MOSI PAL_PORT(LINE_SPI2_EXTERNAL_MOSI)
660
#define SPI2_GPIO_MOSI PAL_PAD(LINE_SPI2_EXTERNAL_MOSI)
661
#define SPI2_GPIO_PORT_SCK PAL_PORT(LINE_SPI2_EXTERNAL_CLK)
662
#define SPI2_GPIO_SCK PAL_PAD(LINE_SPI2_EXTERNAL_CLK)
663
664
// SLAVE0 on SPI connector (NSS possible)
665
#define SPI_SELECT_SLAVE0_PORT PAL_PORT(LINE_SPI2_EXTERNAL_CS)
666
#define SPI_SELECT_SLAVE0_PIN PAL_PAD(LINE_SPI2_EXTERNAL_CS)
667
// SLAVE1 on AUXb1
668
#define SPI_SELECT_SLAVE1_PORT PAL_PORT(LINE_AUX_B1)
669
#define SPI_SELECT_SLAVE1_PIN PAL_PAD(LINE_AUX_B1)
670
// SLAVE2 on AUXb2
671
#define SPI_SELECT_SLAVE2_PORT PAL_PORT(LINE_AUX_B2)
672
#define SPI_SELECT_SLAVE2_PIN PAL_PAD(LINE_AUX_B2)
673
// SLAVE3 on AUXb3
674
//#define SPI_SELECT_SLAVE3_PORT PAL_PORT(LINE_AUX_B3)
675
//#define SPI_SELECT_SLAVE3_PIN PAL_PAD(LINE_AUX_B3)
676
// SLAVE4 on AUXb4
677
#define SPI_SELECT_SLAVE4_PORT PAL_PORT(LINE_AUX_B4)
678
#define SPI_SELECT_SLAVE4_PIN PAL_PAD(LINE_AUX_B4)
679
// SLAVE5 on PE4 (internal IMU)
680
#define SPI_SELECT_SLAVE5_PORT PAL_PORT(LINE_SPI4_INTERNAL_CS)
681
#define SPI_SELECT_SLAVE5_PIN PAL_PAD(LINE_SPI4_INTERNAL_CS)
682
689
#ifndef USE_BARO_BOARD
690
#define USE_BARO_BOARD 0
691
#endif
692
696
#define SDIO_D0_PORT PAL_PORT(LINE_SDMMC1_D0)
697
#define SDIO_D0_PIN PAL_PAD(LINE_SDMMC1_D0)
698
#define SDIO_D1_PORT PAL_PORT(LINE_SDMMC1_D1)
699
#define SDIO_D1_PIN PAL_PAD(LINE_SDMMC1_D1)
700
#define SDIO_D2_PORT PAL_PORT(LINE_SDMMC1_D2)
701
#define SDIO_D2_PIN PAL_PAD(LINE_SDMMC1_D2)
702
#define SDIO_D3_PORT PAL_PORT(LINE_SDMMC1_D3)
703
#define SDIO_D3_PIN PAL_PAD(LINE_SDMMC1_D3)
704
#define SDIO_CK_PORT PAL_PORT(LINE_SDMMC1_CK)
705
#define SDIO_CK_PIN PAL_PAD(LINE_SDMMC1_CK)
706
#define SDIO_CMD_PORT PAL_PORT(LINE_SDMMC1_CMD)
707
#define SDIO_CMD_PIN PAL_PAD(LINE_SDMMC1_CMD)
708
#define SDIO_AF AF_SDMMC1_CK
709
// bat monitoring for file closing
710
#define SDLOG_BAT_ADC CONCAT_BOARD_PARAM(ADCD, VBAT_MEAS_ADC)
711
#define SDLOG_BAT_CHAN CONCAT_BOARD_PARAM(ADC_CHANNEL_IN, VBAT_MEAS_ADC_IN)
712
// usb led status
713
#define SDLOG_USB_LED 4
714
#define SDLOG_USB_VBUS_PORT PAL_PORT(LINE_USB_VBUS)
715
#define SDLOG_USB_VBUS_PIN PAL_PAD(LINE_USB_VBUS)
716
717
718
/*
719
* Actuators for fixedwing
720
*/
721
/* Default actuators driver */
722
#define DEFAULT_ACTUATORS "modules/actuators/actuators_pwm.h"
723
#define ActuatorDefaultSet(_x,_y) ActuatorPwmSet(_x,_y)
724
#define ActuatorsDefaultInit() ActuatorsPwmInit()
725
#define ActuatorsDefaultCommit() ActuatorsPwmCommit()
726
730
#define WS2812D1_GPIO PAL_PORT(LINE_AUX_A1)
731
#define WS2812D1_PIN PAL_PAD(LINE_AUX_A1)
732
#define WS2812D1_AF 2
733
#define WS2812D1_CFG_DEF { \
734
.dma_stream = STM32_PWM5_UP_DMA_STREAM, \
735
.dma_channel = STM32_PWM5_UP_DMA_CHANNEL, \
736
.dma_priority = STM32_PWM5_UP_DMA_PRIORITY, \
737
.pwm_channel = 0, \
738
.pwmp = &PWMD5 \
739
}
740
741
#endif
/* CONFIG_NUCLEO144_F767ZI_1_00_H */
742
board.h
sw
airborne
boards
nucleo
144_f767zi
nucleo144_f767zi.h
Generated on Thu Dec 5 2024 13:05:29 for Paparazzi UAS by
1.9.1