Paparazzi UAS  v6.2_unstable
Paparazzi is a free software Unmanned Aircraft System.
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 
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 2
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 /* allow to define ADC_CHANNEL_VSUPPLY in the airframe file*/
88 #ifndef ADC_CHANNEL_VSUPPLY
89 #define ADC_CHANNEL_VSUPPLY ADC_1
90 #endif
91 
92 /* allow to define ADC_CHANNEL_CURRENT in the airframe file*/
93 #ifndef ADC_CHANNEL_CURRENT
94 #define ADC_CHANNEL_CURRENT ADC_2
95 #endif
96 
97 /* Default powerbrick values */
98 #define DefaultVoltageOfAdc(adc) ((3.3f/4096.0f) * 10.27708149f * adc)
99 #define MilliAmpereOfAdc(adc) ((3.3f/4096.0f) * 36367.51556f * adc)
100 
101 /*
102  * PWM defines
103  */
104 #if defined(LINE_SERVO1)
105 #ifndef USE_PWM1
106 #define USE_PWM1 1
107 #endif
108 #if USE_PWM1
109 #define PWM_SERVO_1 0
110 #define PWM_SERVO_1_GPIO PAL_PORT(LINE_SERVO1)
111 #define PWM_SERVO_1_PIN PAL_PAD(LINE_SERVO1)
112 #define PWM_SERVO_1_AF AF_LINE_SERVO1
113 #define PWM_SERVO_1_DRIVER CONCAT_BOARD_PARAM(PWMD, SERVO1_TIM)
114 #define PWM_SERVO_1_CHANNEL (SERVO1_TIM_CH-1)
115 #define PWM_SERVO_1_CONF CONCAT_BOARD_PARAM(pwmcfg, SERVO1_TIM)
116 #endif
117 #endif
118 
119 #if defined(LINE_SERVO2)
120 #ifndef USE_PWM2
121 #define USE_PWM2 1
122 #endif
123 #if USE_PWM2
124 #define PWM_SERVO_2 1
125 #define PWM_SERVO_2_GPIO PAL_PORT(LINE_SERVO2)
126 #define PWM_SERVO_2_PIN PAL_PAD(LINE_SERVO2)
127 #define PWM_SERVO_2_AF AF_LINE_SERVO2
128 #define PWM_SERVO_2_DRIVER CONCAT_BOARD_PARAM(PWMD, SERVO2_TIM)
129 #define PWM_SERVO_2_CHANNEL (SERVO2_TIM_CH-1)
130 #define PWM_SERVO_2_CONF CONCAT_BOARD_PARAM(pwmcfg, SERVO2_TIM)
131 #endif
132 #endif
133 
134 #if defined(LINE_SERVO3)
135 #ifndef USE_PWM3
136 #define USE_PWM3 1
137 #endif
138 #if USE_PWM3
139 #define PWM_SERVO_3 2
140 #define PWM_SERVO_3_GPIO PAL_PORT(LINE_SERVO3)
141 #define PWM_SERVO_3_PIN PAL_PAD(LINE_SERVO3)
142 #define PWM_SERVO_3_AF AF_LINE_SERVO3
143 #define PWM_SERVO_3_DRIVER CONCAT_BOARD_PARAM(PWMD, SERVO3_TIM)
144 #define PWM_SERVO_3_CHANNEL (SERVO3_TIM_CH-1)
145 #define PWM_SERVO_3_CONF CONCAT_BOARD_PARAM(pwmcfg, SERVO3_TIM)
146 #endif
147 #endif
148 
149 #if defined(LINE_SERVO4)
150 #ifndef USE_PWM4
151 #define USE_PWM4 1
152 #endif
153 #if USE_PWM4
154 #define PWM_SERVO_4 3
155 #define PWM_SERVO_4_GPIO PAL_PORT(LINE_SERVO4)
156 #define PWM_SERVO_4_PIN PAL_PAD(LINE_SERVO4)
157 #define PWM_SERVO_4_AF AF_LINE_SERVO4
158 #define PWM_SERVO_4_DRIVER CONCAT_BOARD_PARAM(PWMD, SERVO4_TIM)
159 #define PWM_SERVO_4_CHANNEL (SERVO4_TIM_CH-1)
160 #define PWM_SERVO_4_CONF CONCAT_BOARD_PARAM(pwmcfg, SERVO4_TIM)
161 #endif
162 #endif
163 
164 #if defined(LINE_SERVO5)
165 #ifndef USE_PWM5
166 #define USE_PWM5 1
167 #endif
168 #if USE_PWM5
169 #define PWM_SERVO_5 4
170 #define PWM_SERVO_5_GPIO PAL_PORT(LINE_SERVO5)
171 #define PWM_SERVO_5_PIN PAL_PAD(LINE_SERVO5)
172 #define PWM_SERVO_5_AF AF_LINE_SERVO5
173 #define PWM_SERVO_5_DRIVER CONCAT_BOARD_PARAM(PWMD, SERVO5_TIM)
174 #define PWM_SERVO_5_CHANNEL (SERVO5_TIM_CH-1)
175 #define PWM_SERVO_5_CONF CONCAT_BOARD_PARAM(pwmcfg, SERVO5_TIM)
176 #endif
177 #endif
178 
179 #if defined(LINE_SERVO6)
180 #ifndef USE_PWM6
181 #define USE_PWM6 1
182 #endif
183 #if USE_PWM6
184 #define PWM_SERVO_6 5
185 #define PWM_SERVO_6_GPIO PAL_PORT(LINE_SERVO6)
186 #define PWM_SERVO_6_PIN PAL_PAD(LINE_SERVO6)
187 #define PWM_SERVO_6_AF AF_LINE_SERVO6
188 #define PWM_SERVO_6_DRIVER CONCAT_BOARD_PARAM(PWMD, SERVO6_TIM)
189 #define PWM_SERVO_6_CHANNEL (SERVO6_TIM_CH-1)
190 #define PWM_SERVO_6_CONF CONCAT_BOARD_PARAM(pwmcfg, SERVO6_TIM)
191 #endif
192 #endif
193 
194 #if defined(LINE_SERVO7)
195 #ifndef USE_PWM7
196 #define USE_PWM7 1
197 #endif
198 #if USE_PWM7
199 #define PWM_SERVO_7 6
200 #define PWM_SERVO_7_GPIO PAL_PORT(LINE_SERVO7)
201 #define PWM_SERVO_7_PIN PAL_PAD(LINE_SERVO7)
202 #define PWM_SERVO_7_AF AF_LINE_SERVO7
203 #define PWM_SERVO_7_DRIVER CONCAT_BOARD_PARAM(PWMD, SERVO7_TIM)
204 #define PWM_SERVO_7_CHANNEL (SERVO7_TIM_CH-1)
205 #define PWM_SERVO_7_CONF CONCAT_BOARD_PARAM(pwmcfg, SERVO7_TIM)
206 #endif
207 #endif
208 
209 #if defined(LINE_SERVO8)
210 #ifndef USE_PWM8
211 #define USE_PWM8 1
212 #endif
213 #if USE_PWM8
214 #define PWM_SERVO_8 7
215 #define PWM_SERVO_8_GPIO PAL_PORT(LINE_SERVO8)
216 #define PWM_SERVO_8_PIN PAL_PAD(LINE_SERVO8)
217 #define PWM_SERVO_8_AF AF_LINE_SERVO8
218 #define PWM_SERVO_8_DRIVER CONCAT_BOARD_PARAM(PWMD, SERVO8_TIM)
219 #define PWM_SERVO_8_CHANNEL (SERVO8_TIM_CH-1)
220 #define PWM_SERVO_8_CONF CONCAT_BOARD_PARAM(pwmcfg, SERVO8_TIM)
221 #endif
222 #endif
223 
227 #define UART1_GPIO_PORT_TX GPIOB
228 #define UART1_GPIO_TX GPIO6
229 #define UART1_GPIO_PORT_RX GPIOB
230 #define UART1_GPIO_RX GPIO7
231 #define UART1_GPIO_AF 7
232 
233 #define UART2_GPIO_PORT_TX GPIOD
234 #define UART2_GPIO_TX GPIO5
235 #define UART2_GPIO_PORT_RX GPIOD
236 #define UART2_GPIO_RX GPIO6
237 #define UART2_GPIO_AF 7
238 
239 #define UART3_GPIO_PORT_TX GPIOD
240 #define UART3_GPIO_TX GPIO8
241 #define UART3_GPIO_PORT_RX GPIOD
242 #define UART3_GPIO_RX GPIO9
243 #define UART3_GPIO_AF 7
244 
245 #define UART4_GPIO_PORT_TX GPIOA
246 #define UART4_GPIO_TX GPIO0
247 #define UART4_GPIO_PORT_RX GPIOA
248 #define UART4_GPIO_RX GPIO1
249 #define UART4_GPIO_AF 8
250 
251 #define UART6_GPIO_PORT_RX GPIOC
252 #define UART6_GPIO_RX GPIO7
253 #define UART6_GPIO_AF 8
254 
255 #define UART7_GPIO_PORT_TX GPIOE
256 #define UART7_GPIO_TX GPIO8
257 #define UART7_GPIO_PORT_RX GPIOE
258 #define UART7_GPIO_RX GPIO7
259 #define UART7_GPIO_AF 8
260 
261 #define UART8_GPIO_PORT_TX GPIOE
262 #define UART8_GPIO_TX GPIO1
263 #define UART8_GPIO_PORT_RX GPIOE
264 #define UART8_GPIO_RX GPIO0
265 #define UART8_GPIO_AF 8
266 
267 /* Soft binding Spektrum */
268 #define RADIO_CONTROL_POWER_PORT GPIOE
269 #define RADIO_CONTROL_POWER_PIN GPIO4 //SPEKTRUM POWER
270 #define RADIO_CONTROL_POWER_ON gpio_clear // yes, inverted
271 #define RADIO_CONTROL_POWER_OFF gpio_set
272 
273 //A receiver on powered on 3.3v
274 #define PERIPHERAL3V3_ENABLE_PORT GPIOC //VDD_3V3_PERIPHERAL_EN
275 #define PERIPHERAL3V3_ENABLE_PIN GPIO5
276 #define PERIPHERAL3V3_ENABLE_ON gpio_set
277 #define PERIPHERAL3V3_ENABLE_OFF gpio_clear
278 
279 // /**
280 // * PPM radio defines TODO
281 // */
282 // #define RC_PPM_TICKS_PER_USEC 2
283 // #define PPM_TIMER_FREQUENCY 2000000
284 // #define PPM_CHANNEL ICU_CHANNEL_1
285 // #define PPM_TIMER ICUD1
286 
287 // /*
288 // * PWM input TODO
289 // */
290 // // PWM_INPUT 1 on PA8 (also PPM IN)
291 // #define PWM_INPUT1_ICU ICUD1
292 // #define PWM_INPUT1_CHANNEL ICU_CHANNEL_1
293 // // PPM in (aka PA8) is used: not compatible with PPM RC receiver
294 // #define PWM_INPUT1_GPIO_PORT GPIOA
295 // #define PWM_INPUT1_GPIO_PIN GPIO8
296 // #define PWM_INPUT1_GPIO_AF GPIO_AF1
297 
298 
302 #ifndef I2C1_CLOCK_SPEED
303 #define I2C1_CLOCK_SPEED 400000
304 #endif
305 #if I2C1_CLOCK_SPEED == 400000
306 #define I2C1_DUTY_CYCLE FAST_DUTY_CYCLE_2
307 #elif I2C1_CLOCK_SPEED == 100000
308 #define I2C1_DUTY_CYCLE STD_DUTY_CYCLE
309 #else
310 #error Invalid I2C1 clock speed
311 #endif
312 #define I2C1_CFG_DEF { \
313  OPMODE_I2C, \
314  I2C1_CLOCK_SPEED, \
315  I2C1_DUTY_CYCLE, \
316  }
317 
318 #ifndef I2C2_CLOCK_SPEED
319 #define I2C2_CLOCK_SPEED 400000
320 #endif
321 #if I2C2_CLOCK_SPEED == 400000
322 #define I2C2_DUTY_CYCLE FAST_DUTY_CYCLE_2
323 #elif I2C2_CLOCK_SPEED == 100000
324 #define I2C2_DUTY_CYCLE STD_DUTY_CYCLE
325 #else
326 #error Invalid I2C2 clock speed
327 #endif
328 #define I2C2_CFG_DEF { \
329  OPMODE_I2C, \
330  I2C2_CLOCK_SPEED, \
331  I2C2_DUTY_CYCLE, \
332  }
333 
334 
340 #define SPI1_GPIO_AF GPIO_AF5
341 #define SPI1_GPIO_PORT_MISO GPIOA
342 #define SPI1_GPIO_MISO GPIO6
343 #define SPI1_GPIO_PORT_MOSI GPIOA
344 #define SPI1_GPIO_MOSI GPIO7
345 #define SPI1_GPIO_PORT_SCK GPIOA
346 #define SPI1_GPIO_SCK GPIO5
347 
348 #define SPI2_GPIO_AF GPIO_AF5
349 #define SPI2_GPIO_PORT_MISO GPIOB
350 #define SPI2_GPIO_MISO GPIO14
351 #define SPI2_GPIO_PORT_MOSI GPIOB
352 #define SPI2_GPIO_MOSI GPIO15
353 #define SPI2_GPIO_PORT_SCK GPIOB
354 #define SPI2_GPIO_SCK GPIO10
355 
356 /* SPI1_SLAVE1 -> slave select pin for the ICM 20609-G*/
357 #define SPI_SELECT_SLAVE0_PORT GPIOC
358 #define SPI_SELECT_SLAVE0_PIN GPIO15
359 /* SPI1_SLAVE1 -> slave select pin for the HMC5983 */
360 #define SPI_SELECT_SLAVE1_PORT GPIOE
361 #define SPI_SELECT_SLAVE1_PIN GPIO15
362 // SPI1_SLAVE2 -> slave select pin for the MPU9250
363 #define SPI_SELECT_SLAVE2_PORT GPIOC
364 #define SPI_SELECT_SLAVE2_PIN GPIO2
365 // SPI1_SLAVE3 -> slave select pin for the ms5611
366 #define SPI_SELECT_SLAVE3_PORT GPIOD
367 #define SPI_SELECT_SLAVE3_PIN GPIO7
368 // SPI1_SLAVE4 -> slave select pin for the FRAM
369 #define SPI_SELECT_SLAVE4_PORT GPIOD
370 #define SPI_SELECT_SLAVE4_PIN GPIO10
371 
378 #ifndef USE_BARO_BOARD
379 #define USE_BARO_BOARD 1
380 #endif
381 
385 #define SDIO_D0_PORT GPIOC
386 #define SDIO_D0_PIN GPIO8
387 #define SDIO_D1_PORT GPIOC
388 #define SDIO_D1_PIN GPIO9
389 #define SDIO_D2_PORT GPIOC
390 #define SDIO_D2_PIN GPIO10
391 #define SDIO_D3_PORT GPIOC
392 #define SDIO_D3_PIN GPIO11
393 #define SDIO_CK_PORT GPIOC
394 #define SDIO_CK_PIN GPIO12
395 #define SDIO_CMD_PORT GPIOD
396 #define SDIO_CMD_PIN GPIO2
397 #define SDIO_AF 12
398 // bat monitoring for file closing
399 #define SDLOG_BAT_ADC ADCD1
400 #define SDLOG_BAT_CHAN AD1_1_CHANNEL
401 // usb led status
402 #define SDLOG_USB_LED 3
403 #define SDLOG_USB_VBUS_PORT GPIOA
404 #define SDLOG_USB_VBUS_PIN GPIO9
405 
406 /*
407  * Actuators for fixedwing
408  */
409  /* Default actuators driver */
410 #define DEFAULT_ACTUATORS "modules/actuators/actuators_pwm.h"
411 #define ActuatorDefaultSet(_x,_y) ActuatorPwmSet(_x,_y)
412 #define ActuatorsDefaultInit() ActuatorsPwmInit()
413 #define ActuatorsDefaultCommit() ActuatorsPwmCommit()
414 
415 #endif /* CONFIG_PX4FMU_4_00_H */
416 
board.h