2 ******************************************************************************
3 * @addtogroup OpenPilotSystem OpenPilot System
5 * @addtogroup OpenPilotCore OpenPilot Core
8 * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
9 * @brief Defines board hardware for the OpenPilot Version 1.1 hardware.
10 * @see The GNU Public License (GPL) Version 3
12 *****************************************************************************/
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 3 of the License, or
17 * (at your option) any later version.
19 * This program is distributed in the hope that it will be useful, but
20 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
21 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
24 * You should have received a copy of the GNU General Public License along
25 * with this program; if not, write to the Free Software Foundation, Inc.,
26 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
33 // ------------------------
34 // Timers and Channels Used
35 // ------------------------
37 Timer | Channel 1 | Channel 2 | Channel 3 | Channel 4
38 ------+-----------+-----------+-----------+----------
40 TIM2 | --------------- PIOS_DELAY -----------------
47 ------+-----------+-----------+-----------+----------
50 // ------------------------
52 // ------------------------
54 /* Channel 2 - SPI1 RX */
55 /* Channel 3 - SPI1 TX */
56 /* Channel 4 - SPI2 RX */
57 /* Channel 5 - SPI2 TX */
66 // ------------------------
67 // BOOTLOADER_SETTINGS
68 // ------------------------
69 #define BOARD_READABLE true
70 #define BOARD_WRITABLE true
71 #define MAX_DEL_RETRYS 3
73 // ------------------------
75 // ------------------------
76 #define PIOS_LED_HEARTBEAT 0
77 #define PIOS_LED_ALARM 1
84 // ------------------------
86 // See also pios_board.c
87 // ------------------------
88 #define PIOS_SPI_MAX_DEVS 3
89 extern uint32_t pios_spi_telem_flash_adapter_id
;
90 #define PIOS_SPI_RFM22B_ADAPTER (pios_spi_telem_flash_adapter_id)
91 extern uint32_t pios_spi_gyro_adapter_id
;
92 #define PIOS_SPI_MPU6000_ADAPTER (pios_spi_gyro_adapter_id)
94 // ------------------------
96 // ------------------------
97 #define PIOS_WATCHDOG_TIMEOUT 250
98 #define PIOS_WDG_REGISTER RTC_BKP_DR4
99 #define PIOS_WDG_ACTUATOR 0x0001
100 #define PIOS_WDG_STABILIZATION 0x0002
101 #define PIOS_WDG_ATTITUDE 0x0004
102 #define PIOS_WDG_MANUAL 0x0008
103 #define PIOS_WDG_SENSORS 0x0010
105 // ------------------------
107 // See also pios_board.c
108 // ------------------------
109 #define PIOS_I2C_MAX_DEVS 3
110 extern uint32_t pios_i2c_mag_pressure_adapter_id
;
111 #define PIOS_I2C_HMC5X83_INTERNAL_ADAPTER (pios_i2c_mag_pressure_adapter_id)
112 extern uint32_t pios_i2c_flexiport_adapter_id
;
113 #define PIOS_I2C_FLEXI_ADAPTER (pios_i2c_flexiport_adapter_id)
114 #define PIOS_I2C_ETASV3_ADAPTER (PIOS_I2C_FLEXI_ADAPTER)
115 #define PIOS_I2C_EXTERNAL_ADAPTER (PIOS_I2C_FLEXI_ADAPTER)
117 // -------------------------
120 // See also pios_board.c
121 // -------------------------
122 #define PIOS_USART_MAX_DEVS 5
123 // Inverter for SBUS handling
124 #define PIOS_USART_INVERTER_PORT USART1
125 #define PIOS_USART_INVERTER_GPIO GPIOC
126 #define PIOS_USART_INVERTER_PIN GPIO_Pin_0
127 #define PIOS_USART_INVERTER_ENABLE Bit_SET
128 #define PIOS_USART_INVERTER_DISABLE Bit_RESET
130 // -------------------------
133 // See also pios_board.c
134 // -------------------------
135 #define PIOS_COM_MAX_DEVS 4
137 #ifdef PIOS_INCLUDE_WS2811
138 extern uint32_t pios_ws2811_id
;
139 #define PIOS_WS2811_DEVICE (pios_ws2811_id)
142 // -------------------------
144 // -------------------------
145 #define RS_ECC_NPARITY 4
146 #define PIOS_PH_MAX_PACKET 255
147 #define PIOS_PH_WIN_SIZE 3
148 #define PIOS_PH_MAX_CONNECTIONS 1
149 extern uint32_t pios_packet_handler
;
150 #define PIOS_PACKET_HANDLER (pios_packet_handler)
152 // ------------------------
154 // ------------------------
155 #define TELEM_QUEUE_SIZE 80
156 #define PIOS_TELEM_STACK_SIZE 800
158 // -------------------------
161 // See also System_stm32f4xx.c
162 // -------------------------
163 // These macros are deprecated
164 // please use PIOS_PERIPHERAL_APBx_CLOCK According to the table below
165 // #define PIOS_MASTER_CLOCK
166 // #define PIOS_PERIPHERAL_CLOCK
167 // #define PIOS_PERIPHERAL_CLOCK
169 #define PIOS_SYSCLK 168000000
170 // Peripherals that belongs to APB1 are:
172 // I2C1,2,3 |UART4,5 |USART3,2
173 // I2S3Ext |SPI3/I2S3 |SPI2/I2S2
174 // I2S2Ext |IWDG |WWDG
176 // TIM2,3,4,5,6,7,12,13,14
178 // Calculated as SYSCLK / APBPresc * (APBPre == 1 ? 1 : 2)
179 // Default APB1 Prescaler = 4
180 #define PIOS_PERIPHERAL_APB1_CLOCK (PIOS_SYSCLK / 2)
182 // Peripherals belonging to APB2
183 // SDIO |EXTI |SYSCFG |SPI1
188 // Default APB2 Prescaler = 2
190 #define PIOS_PERIPHERAL_APB2_CLOCK PIOS_SYSCLK
192 // -------------------------
193 // Interrupt Priorities
194 // -------------------------
195 #define PIOS_IRQ_PRIO_LOW 12 // lower than RTOS
196 #define PIOS_IRQ_PRIO_MID 8 // higher than RTOS
197 #define PIOS_IRQ_PRIO_HIGH 5 // for SPI, ADC, I2C etc...
198 #define PIOS_IRQ_PRIO_HIGHEST 4 // for USART etc...
199 // ------------------------
201 // See also pios_board.c
202 // ------------------------
203 #define PIOS_RCVR_MAX_DEVS 3
204 #define PIOS_RCVR_MAX_CHANNELS 12
205 #define PIOS_GCSRCVR_TIMEOUT_MS 100
207 // -------------------------
208 // Receiver PPM input
209 // -------------------------
210 #define PIOS_PPM_MAX_DEVS 1
211 #define PIOS_PPM_NUM_INPUTS 16
213 // -------------------------
214 // Receiver PWM input
215 // -------------------------
216 #define PIOS_PWM_MAX_DEVS 1
217 #define PIOS_PWM_NUM_INPUTS 8
219 // -------------------------
220 // Receiver SPEKTRUM input
221 // -------------------------
222 #define PIOS_SPEKTRUM_MAX_DEVS 2
223 #define PIOS_SPEKTRUM_NUM_INPUTS 12
225 // -------------------------
226 // Receiver S.Bus input
227 // -------------------------
228 #define PIOS_SBUS_MAX_DEVS 1
229 #define PIOS_SBUS_NUM_INPUTS (16 + 2)
231 // -------------------------
232 // Receiver DSM input
233 // -------------------------
234 #define PIOS_DSM_MAX_DEVS 2
235 #define PIOS_DSM_NUM_INPUTS 12
237 // -------------------------
239 // -------------------------
240 #define PIOS_SERVO_UPDATE_HZ 50
241 #define PIOS_SERVOS_INITIAL_POSITION 0 /* dont want to start motors, have no pulse till settings loaded */
242 #define PIOS_SERVO_BANKS 6
244 // --------------------------
245 // Timer controller settings
246 // --------------------------
247 #define PIOS_TIM_MAX_DEVS 6
249 // -------------------------
251 // PIOS_ADC_PinGet(0) = Current sensor
252 // PIOS_ADC_PinGet(1) = Voltage sensor
253 // PIOS_ADC_PinGet(4) = VREF
254 // PIOS_ADC_PinGet(5) = Temperature sensor
255 // -------------------------
256 #define PIOS_DMA_PIN_CONFIG \
258 { GPIOC, GPIO_Pin_1, ADC_Channel_11, false }, \
259 { GPIOC, GPIO_Pin_2, ADC_Channel_12, false }, \
260 { NULL, 0, ADC_Channel_Vrefint, false }, /* Voltage reference */ \
261 { NULL, 0, ADC_Channel_TempSensor, false }, /* Temperature sensor */ \
264 /* we have to do all this to satisfy the PIOS_ADC_MAX_SAMPLES define in pios_adc.h */
265 /* which is annoying because this then determines the rate at which we generate buffer turnover events */
266 /* the objective here is to get enough buffer space to support 100Hz averaging rate */
267 #define PIOS_ADC_NUM_CHANNELS 4
268 #define PIOS_ADC_MAX_OVERSAMPLING 2
269 #define PIOS_ADC_USE_ADC2 0
271 #define PIOS_ADC_USE_TEMP_SENSOR
272 #define PIOS_ADC_TEMPERATURE_PIN 3
274 // -------------------------
276 // -------------------------
277 #define PIOS_USB_MAX_DEVS 1
278 #define PIOS_USB_ENABLED 1 /* Should remove all references to this */
279 #define PIOS_USB_HID_MAX_DEVS 1
281 #endif /* PIOS_BOARD_H */