2 ******************************************************************************
3 * @addtogroup OpenPilotSystem OpenPilot System
5 * @addtogroup OpenPilotCore OpenPilot Core
8 * @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2015.
9 * The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
10 * @brief Defines board hardware for the OpenPilot Version 1.1 hardware.
11 * @see The GNU Public License (GPL) Version 3
13 *****************************************************************************/
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 3 of the License, or
18 * (at your option) any later version.
20 * This program is distributed in the hope that it will be useful, but
21 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
22 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
25 * You should have received a copy of the GNU General Public License along
26 * with this program; if not, write to the Free Software Foundation, Inc.,
27 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
34 // ------------------------
35 // Timers and Channels Used
36 // ------------------------
38 Timer | Channel 1 | Channel 2 | Channel 3 | Channel 4
39 ------+-----------+-----------+-----------+----------
41 TIM2 | --------------- PIOS_DELAY -----------------
48 ------+-----------+-----------+-----------+----------
51 // ------------------------
53 // ------------------------
55 /* Channel 2 - SPI1 RX */
56 /* Channel 3 - SPI1 TX */
57 /* Channel 4 - SPI2 RX */
58 /* Channel 5 - SPI2 TX */
67 // ------------------------
68 // BOOTLOADER_SETTINGS
69 // ------------------------
70 #define BOARD_READABLE true
71 #define BOARD_WRITABLE true
72 #define MAX_DEL_RETRYS 3
74 // ------------------------
76 // ------------------------
77 #define PIOS_LED_HEARTBEAT 0
78 #define PIOS_LED_ALARM 1
79 #ifdef PIOS_RFM22B_DEBUG_ON_TELEM
85 #define D1_LED_ON PIOS_LED_On(PIOS_LED_D1)
86 #define D1_LED_OFF PIOS_LED_Off(PIOS_LED_D1)
87 #define D1_LED_TOGGLE PIOS_LED_Toggle(PIOS_LED_D1)
89 #define D2_LED_ON PIOS_LED_On(PIOS_LED_D2)
90 #define D2_LED_OFF PIOS_LED_Off(PIOS_LED_D2)
91 #define D2_LED_TOGGLE PIOS_LED_Toggle(PIOS_LED_D2)
93 #define D3_LED_ON PIOS_LED_On(PIOS_LED_D3)
94 #define D3_LED_OFF PIOS_LED_Off(PIOS_LED_D3)
95 #define D3_LED_TOGGLE PIOS_LED_Toggle(PIOS_LED_D3)
97 #define D4_LED_ON PIOS_LED_On(PIOS_LED_D4)
98 #define D4_LED_OFF PIOS_LED_Off(PIOS_LED_D4)
99 #define D4_LED_TOGGLE PIOS_LED_Toggle(PIOS_LED_D4)
100 #endif /* PIOS_RFM22B_DEBUG_ON_TELEM */
102 // ------------------------
104 // See also pios_board.c
105 // ------------------------
106 #define PIOS_SPI_MAX_DEVS 3
107 extern uint32_t pios_spi_gyro_adapter_id
;
108 #define PIOS_SPI_MPU9250_ADAPTER (pios_spi_gyro_adapter_id)
109 // ------------------------
111 // ------------------------
112 #define PIOS_WATCHDOG_TIMEOUT 500
113 #define PIOS_WDG_REGISTER RTC_BKP_DR4
114 #define PIOS_WDG_ACTUATOR 0x0001
115 #define PIOS_WDG_STABILIZATION 0x0002
116 #define PIOS_WDG_ATTITUDE 0x0004
117 #define PIOS_WDG_MANUAL 0x0008
118 #define PIOS_WDG_SENSORS 0x0010
120 // ------------------------
122 // See also pios_board.c
123 // ------------------------
124 #define PIOS_I2C_MAX_DEVS 3
125 extern uint32_t pios_i2c_eeprom_pressure_adapter_id
;
126 #define PIOS_I2C_MS56XX_INTERNAL_ADAPTER (pios_i2c_eeprom_pressure_adapter_id)
127 extern uint32_t pios_i2c_flexiport_adapter_id
;
128 #define PIOS_I2C_FLEXI_ADAPTER (pios_i2c_flexiport_adapter_id)
129 #define PIOS_I2C_ETASV3_ADAPTER (PIOS_I2C_FLEXI_ADAPTER)
130 #define PIOS_I2C_MS4525DO_ADAPTER (PIOS_I2C_FLEXI_ADAPTER)
131 #define PIOS_I2C_EXTERNAL_ADAPTER (PIOS_I2C_FLEXI_ADAPTER)
133 #ifdef PIOS_INCLUDE_WS2811
134 extern uint32_t pios_ws2811_id
;
135 #define PIOS_WS2811_DEVICE (pios_ws2811_id)
138 // -------------------------
141 // See also pios_board.c
142 // -------------------------
143 #define PIOS_USART_MAX_DEVS 5
144 // Inverter for SBUS handling
145 #define PIOS_USART_INVERTER_PORT USART2
146 #define PIOS_USART_INVERTER_GPIO GPIOC
147 #define PIOS_USART_INVERTER_PIN GPIO_Pin_15
148 #define PIOS_USART_INVERTER_ENABLE Bit_SET
149 #define PIOS_USART_INVERTER_DISABLE Bit_RESET
151 // -------------------------
154 // See also pios_board.c
155 // -------------------------
156 #define PIOS_COM_MAX_DEVS 4
157 // -------------------------
159 // -------------------------
160 #define RS_ECC_NPARITY 4
161 #define PIOS_PH_MAX_PACKET 255
162 #define PIOS_PH_WIN_SIZE 3
163 #define PIOS_PH_MAX_CONNECTIONS 1
164 extern uint32_t pios_packet_handler
;
165 #define PIOS_PACKET_HANDLER (pios_packet_handler)
167 // ------------------------
169 // ------------------------
170 #define TELEM_QUEUE_SIZE 80
171 #define PIOS_TELEM_STACK_SIZE 800
173 // -------------------------
176 // See also System_stm32f4xx.c
177 // -------------------------
178 // These macros are deprecated
179 // please use PIOS_PERIPHERAL_APBx_CLOCK According to the table below
180 // #define PIOS_MASTER_CLOCK
181 // #define PIOS_PERIPHERAL_CLOCK
182 // #define PIOS_PERIPHERAL_CLOCK
184 #define PIOS_SYSCLK SYSCLK_FREQ
185 // Peripherals that belongs to APB1 are:
187 // I2C1,2,3 |UART4,5 |USART3,2
188 // I2S3Ext |SPI3/I2S3 |SPI2/I2S2
189 // I2S2Ext |IWDG |WWDG
191 // TIM2,3,4,5,6,7,12,13,14
193 // Calculated as SYSCLK / APBPresc * (APBPre == 1 ? 1 : 2)
194 // Default APB1 Prescaler = 2
195 #define PIOS_PERIPHERAL_APB1_CLOCK PIOS_SYSCLK
197 // Peripherals belonging to APB2
198 // SDIO |EXTI |SYSCFG |SPI1
203 // Default APB2 Prescaler = 1
205 #define PIOS_PERIPHERAL_APB2_CLOCK PIOS_SYSCLK
207 // -------------------------
208 // Interrupt Priorities
209 // -------------------------
210 #define PIOS_IRQ_PRIO_LOW 12 // lower than RTOS
211 #define PIOS_IRQ_PRIO_MID 8 // higher than RTOS
212 #define PIOS_IRQ_PRIO_HIGH 5 // for SPI, ADC, I2C etc...
213 #define PIOS_IRQ_PRIO_HIGHEST 4 // for USART etc...
214 // ------------------------
216 // See also pios_board.c
217 // ------------------------
218 #define PIOS_RCVR_MAX_DEVS 3
219 #define PIOS_RCVR_MAX_CHANNELS 12
220 #define PIOS_GCSRCVR_TIMEOUT_MS 100
222 // -------------------------
223 // Receiver PPM input
224 // -------------------------
225 #define PIOS_PPM_MAX_DEVS 1
226 #define PIOS_PPM_NUM_INPUTS 16
228 // -------------------------
229 // Receiver PWM input
230 // -------------------------
231 #define PIOS_PWM_MAX_DEVS 1
232 #define PIOS_PWM_NUM_INPUTS 8
234 // -------------------------
235 // Receiver SPEKTRUM input
236 // -------------------------
237 #define PIOS_SPEKTRUM_MAX_DEVS 2
238 #define PIOS_SPEKTRUM_NUM_INPUTS 12
240 // -------------------------
241 // Receiver S.Bus input
242 // -------------------------
243 #define PIOS_SBUS_MAX_DEVS 1
244 #define PIOS_SBUS_NUM_INPUTS (16 + 2)
245 #define PIOS_SBUS_BAUD_RATE 99999 /* f411 / 96mhz sysclk / usart2 baud rate weirdness */
246 // -------------------------
247 // Receiver HOTT input
248 // -------------------------
249 #define PIOS_HOTT_MAX_DEVS 1
250 #define PIOS_HOTT_NUM_INPUTS 32
252 // -------------------------
253 // Receiver EX.Bus input
254 // -------------------------
255 #define PIOS_EXBUS_MAX_DEVS 1
256 #define PIOS_EXBUS_NUM_INPUTS 16
258 // -------------------------
259 // Receiver Multiplex SRXL input
260 // -------------------------
261 #define PIOS_SRXL_MAX_DEVS 1
262 #define PIOS_SRXL_NUM_INPUTS 16
264 // -------------------------
265 // Receiver DSM input
266 // -------------------------
267 #define PIOS_DSM_MAX_DEVS 2
268 #define PIOS_DSM_NUM_INPUTS 12
270 // -------------------------
271 // Receiver FlySky IBus input
272 // -------------------------
273 #define PIOS_IBUS_MAX_DEVS 1
274 #define PIOS_IBUS_NUM_INPUTS 10
276 // -------------------------
278 // -------------------------
279 #define PIOS_SERVO_UPDATE_HZ 50
280 #define PIOS_SERVOS_INITIAL_POSITION 0 /* dont want to start motors, have no pulse till settings loaded */
281 #define PIOS_SERVO_BANKS 6
283 // --------------------------
284 // Timer controller settings
285 // --------------------------
286 #define PIOS_TIM_MAX_DEVS 6
288 // -------------------------
290 // PIOS_ADC_PinGet(0) = Current sensor
291 // PIOS_ADC_PinGet(1) = Voltage sensor
292 // PIOS_ADC_PinGet(4) = VREF
293 // PIOS_ADC_PinGet(5) = Temperature sensor
294 // -------------------------
295 #define PIOS_DMA_PIN_CONFIG \
297 { GPIOB, GPIO_Pin_1, ADC_Channel_9, false }, /* FLEXI-IO PIN 4 */ \
298 { GPIOB, GPIO_Pin_0, ADC_Channel_8, false }, /* FLEXI-IO PIN 5 */ \
299 { GPIOA, GPIO_Pin_7, ADC_Channel_7, false }, /* FLEXI-IO PIN 6 */ \
300 { GPIOA, GPIO_Pin_6, ADC_Channel_6, false }, /* FLEXI-IO PIN 7 */ \
301 { GPIOA, GPIO_Pin_5, ADC_Channel_5, false }, /* FLEXI-IO PIN 8 */ \
303 { GPIOA, GPIO_Pin_0, ADC_Channel_0, false }, /* SERVO PIN 5 */ \
304 { GPIOA, GPIO_Pin_1, ADC_Channel_1, false }, /* SERVO PIN 6 */ \
306 { NULL, 0, ADC_Channel_Vrefint, false }, /* Voltage reference */ \
307 { NULL, 0, ADC_Channel_TempSensor, false }, /* Temperature sensor */ \
310 /* we have to do all this to satisfy the PIOS_ADC_MAX_SAMPLES define in pios_adc.h */
311 /* which is annoying because this then determines the rate at which we generate buffer turnover events */
312 /* the objective here is to get enough buffer space to support 100Hz averaging rate */
313 #define PIOS_ADC_NUM_CHANNELS 9
314 #define PIOS_ADC_MAX_OVERSAMPLING 2
315 #define PIOS_ADC_USE_ADC2 0
317 #define PIOS_ADC_USE_TEMP_SENSOR
318 #define PIOS_ADC_TEMPERATURE_PIN 8
320 // -------------------------
322 // -------------------------
323 #define PIOS_USB_MAX_DEVS 1
324 #define PIOS_USB_ENABLED 1 /* Should remove all references to this */
325 #define PIOS_USB_HID_MAX_DEVS 1
327 #endif /* PIOS_BOARD_H */