Paparazzi UAS
v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
Loading...
Searching...
No Matches
px4fmu.h
Go to the documentation of this file.
1
#ifndef CONFIG_PX4FMU_4_00_H
2
#define CONFIG_PX4FMU_4_00_H
3
4
#define BOARD_PX4FMU
5
9
#include "
boards/px4fmu/chibios/v4.0/board.h
"
10
15
/*
16
* Concat macro
17
*/
18
#define _CONCAT_BOARD_PARAM(_s1, _s2) _s1 ## _s2
19
#define CONCAT_BOARD_PARAM(_s1, _s2) _CONCAT_BOARD_PARAM(_s1, _s2)
20
21
/*
22
* Onboard LEDs
23
*/
24
/* red, on PE12 */
25
#ifndef USE_LED_1
26
#define USE_LED_1 1
27
#endif
28
#define LED_1_GPIO GPIOB
29
#define LED_1_GPIO_PIN GPIO11
30
#define LED_1_GPIO_ON gpio_clear
31
#define LED_1_GPIO_OFF gpio_set
32
#define LED_1_AFIO_REMAP ((void)0)
33
34
/* green, on PB1 */
35
#ifndef USE_LED_2
36
#define USE_LED_2 1
37
#endif
38
#define LED_2_GPIO GPIOB
39
#define LED_2_GPIO_PIN GPIO1
40
#define LED_2_GPIO_ON gpio_clear
41
#define LED_2_GPIO_OFF gpio_set
42
#define LED_2_AFIO_REMAP ((void)0)
43
44
/* blue, on PB3 */
45
#ifndef USE_LED_3
46
#define USE_LED_3 1
47
#endif
48
#define LED_3_GPIO GPIOB
49
#define LED_3_GPIO_PIN GPIO3
50
#define LED_3_GPIO_ON gpio_clear
51
#define LED_3_GPIO_OFF gpio_set
52
#define LED_3_AFIO_REMAP ((void)0)
53
54
/*
55
* ADCs
56
*/
57
// VOLT_SENS
58
#ifndef USE_ADC_1
59
#define USE_ADC_1 1
60
#endif
61
#if USE_ADC_1
62
#define AD1_1_CHANNEL ADC_CHANNEL_IN2
63
#define ADC_1 AD1_1
64
#define ADC_1_GPIO_PORT GPIOA
65
#define ADC_1_GPIO_PIN GPIO2
66
#endif
67
68
// CUR_SENS
69
#ifndef USE_ADC_2
70
#define USE_ADC_2 1
71
#endif
72
#if USE_ADC_2
73
#define AD1_2_CHANNEL ADC_CHANNEL_IN3
74
#define ADC_2 AD1_2
75
#define ADC_2_GPIO_PORT GPIOA
76
#define ADC_2_GPIO_PIN GPIO3
77
#endif
78
79
// VDD_V5_SENS
80
#if USE_ADC_3
81
#define AD1_3_CHANNEL ADC_CHANNEL_IN4
82
#define ADC_3 AD1_3
83
#define ADC_3_GPIO_PORT GPIOA
84
#define ADC_3_GPIO_PIN GPIO4
85
#endif
86
87
//ADC_pin_RSSI_IN
88
#ifndef USE_ADC_4
89
#define USE_ADC_4 1
90
#endif
91
#if USE_ADC_4
92
#define AD1_4_CHANNEL ADC_CHANNEL_IN11
93
#define ADC_4 AD1_4
94
#define ADC_4_GPIO_PORT GPIOC
95
#define ADC_4_GPIO_PIN GPIO1
96
#endif
97
98
/* allow to define ADC_CHANNEL_VSUPPLY in the airframe file*/
99
#ifndef ADC_CHANNEL_VSUPPLY
100
#define ADC_CHANNEL_VSUPPLY ADC_1
101
#endif
102
103
/* allow to define ADC_CHANNEL_CURRENT in the airframe file*/
104
#ifndef ADC_CHANNEL_CURRENT
105
#define ADC_CHANNEL_CURRENT ADC_2
106
#endif
107
108
#ifndef ADC_CHANNEL_RSSI
109
#define ADC_CHANNEL_RSSI ADC_4
110
#endif
111
112
113
/* Default powerbrick values */
114
#define DefaultVoltageOfAdc(adc) ((3.3f/4096.0f) * 10.27708149f * adc)
115
#define DefaultMilliAmpereOfAdc(adc) ((3.3f/4096.0f) * 36367.51556f * adc)
116
117
/*
118
* PWM TIM defines
119
* enable TIM1 and TIM4 by default
120
*/
121
#ifndef USE_PWM_TIM1
122
#define USE_PWM_TIM1 1
123
#endif
124
125
#ifndef USE_PWM_TIM4
126
#define USE_PWM_TIM4 1
127
#endif
128
129
/*
130
* PWM defines
131
*/
132
#if defined(LINE_SERVO1)
133
#ifndef USE_PWM1
134
#define USE_PWM1 1
135
#endif
136
#if USE_PWM1
137
#define PWM_SERVO_1 0
138
#define PWM_SERVO_1_GPIO PAL_PORT(LINE_SERVO1)
139
#define PWM_SERVO_1_PIN PAL_PAD(LINE_SERVO1)
140
#define PWM_SERVO_1_AF AF_LINE_SERVO1
141
#define PWM_SERVO_1_DRIVER CONCAT_BOARD_PARAM(PWMD, SERVO1_TIM)
142
#define PWM_SERVO_1_CHANNEL (SERVO1_TIM_CH-1)
143
#define PWM_SERVO_1_CONF CONCAT_BOARD_PARAM(pwmcfg, SERVO1_TIM)
144
#endif
145
#endif
146
147
#if defined(LINE_SERVO2)
148
#ifndef USE_PWM2
149
#define USE_PWM2 1
150
#endif
151
#if USE_PWM2
152
#define PWM_SERVO_2 1
153
#define PWM_SERVO_2_GPIO PAL_PORT(LINE_SERVO2)
154
#define PWM_SERVO_2_PIN PAL_PAD(LINE_SERVO2)
155
#define PWM_SERVO_2_AF AF_LINE_SERVO2
156
#define PWM_SERVO_2_DRIVER CONCAT_BOARD_PARAM(PWMD, SERVO2_TIM)
157
#define PWM_SERVO_2_CHANNEL (SERVO2_TIM_CH-1)
158
#define PWM_SERVO_2_CONF CONCAT_BOARD_PARAM(pwmcfg, SERVO2_TIM)
159
#endif
160
#endif
161
162
#if defined(LINE_SERVO3)
163
#ifndef USE_PWM3
164
#define USE_PWM3 1
165
#endif
166
#if USE_PWM3
167
#define PWM_SERVO_3 2
168
#define PWM_SERVO_3_GPIO PAL_PORT(LINE_SERVO3)
169
#define PWM_SERVO_3_PIN PAL_PAD(LINE_SERVO3)
170
#define PWM_SERVO_3_AF AF_LINE_SERVO3
171
#define PWM_SERVO_3_DRIVER CONCAT_BOARD_PARAM(PWMD, SERVO3_TIM)
172
#define PWM_SERVO_3_CHANNEL (SERVO3_TIM_CH-1)
173
#define PWM_SERVO_3_CONF CONCAT_BOARD_PARAM(pwmcfg, SERVO3_TIM)
174
#endif
175
#endif
176
177
#if defined(LINE_SERVO4)
178
#ifndef USE_PWM4
179
#define USE_PWM4 1
180
#endif
181
#if USE_PWM4
182
#define PWM_SERVO_4 3
183
#define PWM_SERVO_4_GPIO PAL_PORT(LINE_SERVO4)
184
#define PWM_SERVO_4_PIN PAL_PAD(LINE_SERVO4)
185
#define PWM_SERVO_4_AF AF_LINE_SERVO4
186
#define PWM_SERVO_4_DRIVER CONCAT_BOARD_PARAM(PWMD, SERVO4_TIM)
187
#define PWM_SERVO_4_CHANNEL (SERVO4_TIM_CH-1)
188
#define PWM_SERVO_4_CONF CONCAT_BOARD_PARAM(pwmcfg, SERVO4_TIM)
189
#endif
190
#endif
191
192
#if defined(LINE_SERVO5)
193
#ifndef USE_PWM5
194
#define USE_PWM5 1
195
#endif
196
#if USE_PWM5
197
#define PWM_SERVO_5 4
198
#define PWM_SERVO_5_GPIO PAL_PORT(LINE_SERVO5)
199
#define PWM_SERVO_5_PIN PAL_PAD(LINE_SERVO5)
200
#define PWM_SERVO_5_AF AF_LINE_SERVO5
201
#define PWM_SERVO_5_DRIVER CONCAT_BOARD_PARAM(PWMD, SERVO5_TIM)
202
#define PWM_SERVO_5_CHANNEL (SERVO5_TIM_CH-1)
203
#define PWM_SERVO_5_CONF CONCAT_BOARD_PARAM(pwmcfg, SERVO5_TIM)
204
#endif
205
#endif
206
207
#if defined(LINE_SERVO6)
208
#ifndef USE_PWM6
209
#define USE_PWM6 1
210
#endif
211
#if USE_PWM6
212
#define PWM_SERVO_6 5
213
#define PWM_SERVO_6_GPIO PAL_PORT(LINE_SERVO6)
214
#define PWM_SERVO_6_PIN PAL_PAD(LINE_SERVO6)
215
#define PWM_SERVO_6_AF AF_LINE_SERVO6
216
#define PWM_SERVO_6_DRIVER CONCAT_BOARD_PARAM(PWMD, SERVO6_TIM)
217
#define PWM_SERVO_6_CHANNEL (SERVO6_TIM_CH-1)
218
#define PWM_SERVO_6_CONF CONCAT_BOARD_PARAM(pwmcfg, SERVO6_TIM)
219
#endif
220
#endif
221
222
#if defined(LINE_SERVO7)
223
#ifndef USE_PWM7
224
#define USE_PWM7 1
225
#endif
226
#if USE_PWM7
227
#define PWM_SERVO_7 6
228
#define PWM_SERVO_7_GPIO PAL_PORT(LINE_SERVO7)
229
#define PWM_SERVO_7_PIN PAL_PAD(LINE_SERVO7)
230
#define PWM_SERVO_7_AF AF_LINE_SERVO7
231
#define PWM_SERVO_7_DRIVER CONCAT_BOARD_PARAM(PWMD, SERVO7_TIM)
232
#define PWM_SERVO_7_CHANNEL (SERVO7_TIM_CH-1)
233
#define PWM_SERVO_7_CONF CONCAT_BOARD_PARAM(pwmcfg, SERVO7_TIM)
234
#endif
235
#endif
236
237
#if defined(LINE_SERVO8)
238
#ifndef USE_PWM8
239
#define USE_PWM8 1
240
#endif
241
#if USE_PWM8
242
#define PWM_SERVO_8 7
243
#define PWM_SERVO_8_GPIO PAL_PORT(LINE_SERVO8)
244
#define PWM_SERVO_8_PIN PAL_PAD(LINE_SERVO8)
245
#define PWM_SERVO_8_AF AF_LINE_SERVO8
246
#define PWM_SERVO_8_DRIVER CONCAT_BOARD_PARAM(PWMD, SERVO8_TIM)
247
#define PWM_SERVO_8_CHANNEL (SERVO8_TIM_CH-1)
248
#define PWM_SERVO_8_CONF CONCAT_BOARD_PARAM(pwmcfg, SERVO8_TIM)
249
#endif
250
#endif
251
252
/*
253
* PWM input
254
*/
255
// On Header 8266 PD pin using TIM9 CH1
256
#ifdef USE_PWM_INPUT1
257
#define PWM_INPUT1_ICU ICUD9
258
#define PWM_INPUT1_CHANNEL ICU_CHANNEL_1
259
#define PWM_INPUT1_GPIO_PORT GPIOE
260
#define PWM_INPUT1_GPIO_PIN GPIO5
261
#define PWM_INPUT1_GPIO_AF GPIO_AF3
262
#endif
263
// On Header 8266 GPIO2 pin using TIM3 CH1
264
#ifdef USE_PWM_INPUT2
265
#define PWM_INPUT2_ICU ICUD3
266
#define PWM_INPUT2_CHANNEL ICU_CHANNEL_1
267
#define PWM_INPUT2_GPIO_PORT GPIOB
268
#define PWM_INPUT2_GPIO_PIN GPIO4
269
#define PWM_INPUT2_GPIO_AF GPIO_AF2
270
#endif
271
275
#define UART1_GPIO_PORT_TX GPIOB
276
#define UART1_GPIO_TX GPIO6
277
#define UART1_GPIO_PORT_RX GPIOB
278
#define UART1_GPIO_RX GPIO7
279
#define UART1_GPIO_AF 7
280
281
#define UART2_GPIO_PORT_TX GPIOD
282
#define UART2_GPIO_TX GPIO5
283
#define UART2_GPIO_PORT_RX GPIOD
284
#define UART2_GPIO_RX GPIO6
285
#define UART2_GPIO_AF 7
286
287
#define UART3_GPIO_PORT_TX GPIOD
288
#define UART3_GPIO_TX GPIO8
289
#define UART3_GPIO_PORT_RX GPIOD
290
#define UART3_GPIO_RX GPIO9
291
#define UART3_GPIO_AF 7
292
293
#define UART4_GPIO_PORT_TX GPIOA
294
#define UART4_GPIO_TX GPIO0
295
#define UART4_GPIO_PORT_RX GPIOA
296
#define UART4_GPIO_RX GPIO1
297
#define UART4_GPIO_AF 8
298
299
#define UART6_GPIO_PORT_RX GPIOC
300
#define UART6_GPIO_RX GPIO7
301
#define UART6_GPIO_AF 8
302
303
#define UART7_GPIO_PORT_TX GPIOE
304
#define UART7_GPIO_TX GPIO8
305
#define UART7_GPIO_PORT_RX GPIOE
306
#define UART7_GPIO_RX GPIO7
307
#define UART7_GPIO_AF 8
308
309
#define UART8_GPIO_PORT_TX GPIOE
310
#define UART8_GPIO_TX GPIO1
311
#define UART8_GPIO_PORT_RX GPIOE
312
#define UART8_GPIO_RX GPIO0
313
#define UART8_GPIO_AF 8
314
315
/* Soft binding Spektrum */
316
#define RADIO_CONTROL_POWER_PORT GPIOE
317
#define RADIO_CONTROL_POWER_PIN GPIO4
//SPEKTRUM POWER
318
#define RADIO_CONTROL_POWER_ON gpio_clear
// yes, inverted
319
#define RADIO_CONTROL_POWER_OFF gpio_set
320
321
//A receiver on powered on 3.3v
322
#define PERIPHERAL3V3_ENABLE_PORT GPIOC
//VDD_3V3_PERIPHERAL_EN
323
#define PERIPHERAL3V3_ENABLE_PIN GPIO5
324
#define PERIPHERAL3V3_ENABLE_ON gpio_set
325
#define PERIPHERAL3V3_ENABLE_OFF gpio_clear
326
330
#ifndef I2C1_CLOCK_SPEED
331
#define I2C1_CLOCK_SPEED 400000
332
#endif
333
#if I2C1_CLOCK_SPEED == 400000
334
#define I2C1_DUTY_CYCLE FAST_DUTY_CYCLE_2
335
#elif I2C1_CLOCK_SPEED == 100000
336
#define I2C1_DUTY_CYCLE STD_DUTY_CYCLE
337
#else
338
#error Invalid I2C1 clock speed
339
#endif
340
#define I2C1_CFG_DEF { \
341
OPMODE_I2C, \
342
I2C1_CLOCK_SPEED, \
343
I2C1_DUTY_CYCLE, \
344
}
345
346
#ifndef I2C2_CLOCK_SPEED
347
#define I2C2_CLOCK_SPEED 400000
348
#endif
349
#if I2C2_CLOCK_SPEED == 400000
350
#define I2C2_DUTY_CYCLE FAST_DUTY_CYCLE_2
351
#elif I2C2_CLOCK_SPEED == 100000
352
#define I2C2_DUTY_CYCLE STD_DUTY_CYCLE
353
#else
354
#error Invalid I2C2 clock speed
355
#endif
356
#define I2C2_CFG_DEF { \
357
OPMODE_I2C, \
358
I2C2_CLOCK_SPEED, \
359
I2C2_DUTY_CYCLE, \
360
}
361
362
368
#define SPI1_GPIO_AF GPIO_AF5
369
#define SPI1_GPIO_PORT_MISO GPIOA
370
#define SPI1_GPIO_MISO GPIO6
371
#define SPI1_GPIO_PORT_MOSI GPIOA
372
#define SPI1_GPIO_MOSI GPIO7
373
#define SPI1_GPIO_PORT_SCK GPIOA
374
#define SPI1_GPIO_SCK GPIO5
375
376
#define SPI2_GPIO_AF GPIO_AF5
377
#define SPI2_GPIO_PORT_MISO GPIOB
378
#define SPI2_GPIO_MISO GPIO14
379
#define SPI2_GPIO_PORT_MOSI GPIOB
380
#define SPI2_GPIO_MOSI GPIO15
381
#define SPI2_GPIO_PORT_SCK GPIOB
382
#define SPI2_GPIO_SCK GPIO10
383
384
/* SPI1_SLAVE1 -> slave select pin for the ICM 20609-G*/
385
#define SPI_SELECT_SLAVE0_PORT GPIOC
386
#define SPI_SELECT_SLAVE0_PIN GPIO15
387
/* SPI1_SLAVE1 -> slave select pin for the HMC5983 */
388
#define SPI_SELECT_SLAVE1_PORT GPIOE
389
#define SPI_SELECT_SLAVE1_PIN GPIO15
390
// SPI1_SLAVE2 -> slave select pin for the MPU9250
391
#define SPI_SELECT_SLAVE2_PORT GPIOC
392
#define SPI_SELECT_SLAVE2_PIN GPIO2
393
// SPI1_SLAVE3 -> slave select pin for the ms5611
394
#define SPI_SELECT_SLAVE3_PORT GPIOD
395
#define SPI_SELECT_SLAVE3_PIN GPIO7
396
// SPI1_SLAVE4 -> slave select pin for the FRAM
397
#define SPI_SELECT_SLAVE4_PORT GPIOD
398
#define SPI_SELECT_SLAVE4_PIN GPIO10
399
406
#ifndef USE_BARO_BOARD
407
#define USE_BARO_BOARD 1
408
#endif
409
413
#define SDIO_D0_PORT GPIOC
414
#define SDIO_D0_PIN GPIO8
415
#define SDIO_D1_PORT GPIOC
416
#define SDIO_D1_PIN GPIO9
417
#define SDIO_D2_PORT GPIOC
418
#define SDIO_D2_PIN GPIO10
419
#define SDIO_D3_PORT GPIOC
420
#define SDIO_D3_PIN GPIO11
421
#define SDIO_CK_PORT GPIOC
422
#define SDIO_CK_PIN GPIO12
423
#define SDIO_CMD_PORT GPIOD
424
#define SDIO_CMD_PIN GPIO2
425
#define SDIO_AF 12
426
// bat monitoring for file closing
427
#define SDLOG_BAT_ADC ADCD1
428
#define SDLOG_BAT_CHAN AD1_1_CHANNEL
429
// usb led status
430
#define SDLOG_USB_LED 3
431
#define SDLOG_USB_VBUS_PORT GPIOA
432
#define SDLOG_USB_VBUS_PIN GPIO9
433
434
/*
435
* Actuators for fixedwing
436
*/
437
/* Default actuators driver */
438
#define DEFAULT_ACTUATORS "modules/actuators/actuators_pwm.h"
439
#define ActuatorDefaultSet(_x,_y) ActuatorPwmSet(_x,_y)
440
#define ActuatorsDefaultInit() ActuatorsPwmInit()
441
#define ActuatorsDefaultCommit() ActuatorsPwmCommit()
442
443
#endif
/* CONFIG_PX4FMU_4_00_H */
444
board.h
sw
airborne
boards
px4fmu
chibios
v4.0
px4fmu.h
Generated on Thu Sep 4 2025 16:19:41 for Paparazzi UAS by
1.9.8