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
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
80 // ------------------------
82 // See also pios_board.c
83 // ------------------------
84 #define PIOS_SPI_MAX_DEVS 3
86 // ------------------------
88 // ------------------------
89 #define PIOS_WATCHDOG_TIMEOUT 250
90 #define PIOS_WDG_REGISTER RTC_BKP_DR4
91 #define PIOS_WDG_ACTUATOR 0x0001
92 #define PIOS_WDG_STABILIZATION 0x0002
93 #define PIOS_WDG_ATTITUDE 0x0004
94 #define PIOS_WDG_MANUAL 0x0008
95 #define PIOS_WDG_SENSORS 0x0010
96 #define PIOS_WDG_AUTOTUNE 0x0020
98 // ------------------------
100 // See also pios_board.c
101 // ------------------------
102 #define PIOS_I2C_MAX_DEVS 3
103 extern uint32_t pios_i2c_mag_adapter_id
;
104 #define PIOS_I2C_MAIN_ADAPTER (pios_i2c_mag_adapter_id)
105 extern uint32_t pios_i2c_flexiport_adapter_id
;
106 #define PIOS_I2C_FLEXI_ADAPTER (pios_i2c_flexiport_adapter_id)
107 #define PIOS_I2C_ETASV3_ADAPTER (PIOS_I2C_FLEXI_ADAPTER)
109 // -------------------------
112 // See also pios_board.c
113 // -------------------------
114 #define PIOS_USART_MAX_DEVS 5
116 // -------------------------
119 // See also pios_board.c
120 // -------------------------
121 #define PIOS_COM_MAX_DEVS 4
122 extern uint32_t pios_com_telem_rf_id
;
123 extern uint32_t pios_com_gps_id
;
124 extern uint32_t pios_com_aux_id
;
125 extern uint32_t pios_com_telem_usb_id
;
126 extern uint32_t pios_com_bridge_id
;
127 extern uint32_t pios_com_vcp_id
;
128 extern uint32_t pios_com_hkosd_id
;
129 extern uint32_t pios_com_msp_id
;
130 extern uint32_t pios_com_mavlink_id
;
132 #define PIOS_COM_AUX (pios_com_aux_id)
133 #define PIOS_COM_GPS (pios_com_gps_id)
134 #define PIOS_COM_TELEM_USB (pios_com_telem_usb_id)
135 #define PIOS_COM_TELEM_RF (pios_com_telem_rf_id)
136 #define PIOS_COM_BRIDGE (pios_com_bridge_id)
137 #define PIOS_COM_VCP (pios_com_vcp_id)
138 #define PIOS_COM_DEBUG PIOS_COM_AUX
139 #define PIOS_COM_OSDHK (pios_com_hkosd_id)
140 #define PIOS_COM_MSP (pios_com_msp_id)
141 #define PIOS_COM_MAVLINK (pios_com_mavlink_id)
143 // ------------------------
145 // ------------------------
146 #define TELEM_QUEUE_SIZE 80
147 #define PIOS_TELEM_STACK_SIZE 800
149 // -------------------------
152 // See also System_stm32f4xx.c
153 // -------------------------
154 // These macros are deprecated
155 // please use PIOS_PERIPHERAL_APBx_CLOCK According to the table below
156 // #define PIOS_MASTER_CLOCK
157 // #define PIOS_PERIPHERAL_CLOCK
158 // #define PIOS_PERIPHERAL_CLOCK
160 #define PIOS_SYSCLK 168000000
161 // Peripherals that belongs to APB1 are:
163 // I2C1,2,3 |UART4,5 |USART3,2
164 // I2S3Ext |SPI3/I2S3 |SPI2/I2S2
165 // I2S2Ext |IWDG |WWDG
167 // TIM2,3,4,5,6,7,12,13,14
169 // Calculated as SYSCLK / APBPresc * (APBPre == 1 ? 1 : 2)
170 // Default APB1 Prescaler = 4
171 #define PIOS_PERIPHERAL_APB1_CLOCK (PIOS_SYSCLK / 2)
173 // Peripherals belonging to APB2
174 // SDIO |EXTI |SYSCFG |SPI1
179 // Default APB2 Prescaler = 2
181 #define PIOS_PERIPHERAL_APB2_CLOCK PIOS_SYSCLK
183 // -------------------------
184 // Interrupt Priorities
185 // -------------------------
186 #define PIOS_IRQ_PRIO_LOW 12 // lower than RTOS
187 #define PIOS_IRQ_PRIO_MID 8 // higher than RTOS
188 #define PIOS_IRQ_PRIO_HIGH 5 // for SPI, ADC, I2C etc...
189 #define PIOS_IRQ_PRIO_HIGHEST 4 // for USART etc...
190 // ------------------------
192 // See also pios_board.c
193 // ------------------------
194 #define PIOS_RCVR_MAX_DEVS 3
195 #define PIOS_RCVR_MAX_CHANNELS 12
196 #define PIOS_GCSRCVR_TIMEOUT_MS 100
198 // -------------------------
199 // Receiver PPM input
200 // -------------------------
201 #define PIOS_PPM_MAX_DEVS 1
202 #define PIOS_PPM_NUM_INPUTS 16
204 // -------------------------
205 // Receiver PWM input
206 // -------------------------
207 #define PIOS_PWM_MAX_DEVS 1
208 #define PIOS_PWM_NUM_INPUTS 8
210 // -------------------------
211 // Receiver SPEKTRUM input
212 // -------------------------
213 #define PIOS_SPEKTRUM_MAX_DEVS 2
214 #define PIOS_SPEKTRUM_NUM_INPUTS 12
216 // -------------------------
217 // Receiver S.Bus input
218 // -------------------------
219 #define PIOS_SBUS_MAX_DEVS 1
220 #define PIOS_SBUS_NUM_INPUTS (16 + 2)
222 // -------------------------
223 // Receiver DSM input
224 // -------------------------
225 #define PIOS_DSM_MAX_DEVS 2
226 #define PIOS_DSM_NUM_INPUTS 12
228 // -------------------------
230 // -------------------------
231 #define PIOS_SERVO_UPDATE_HZ 50
232 #define PIOS_SERVOS_INITIAL_POSITION 0 /* dont want to start motors, have no pulse till settings loaded */
233 #define PIOS_SERVO_BANKS 6
235 // --------------------------
236 // Timer controller settings
237 // --------------------------
238 #define PIOS_TIM_MAX_DEVS 6
240 // -------------------------
242 // PIOS_ADC_PinGet(0) = Current sensor
243 // PIOS_ADC_PinGet(1) = Voltage sensor
244 // PIOS_ADC_PinGet(2) = VREF
245 // PIOS_ADC_PinGet(3) = Temperature sensor
246 // PIOS_ADC_PinGet(4) = Board Power
247 // -------------------------
248 #define PIOS_DMA_PIN_CONFIG \
250 { GPIOC, GPIO_Pin_0, ADC_Channel_10, true }, \
251 { GPIOC, GPIO_Pin_1, ADC_Channel_11, true }, \
252 { NULL, 0, ADC_Channel_Vrefint, true }, /* Voltage reference */ \
253 { NULL, 0, ADC_Channel_TempSensor, true }, /* Temperature sensor */ \
254 { GPIOC, GPIO_Pin_2, ADC_Channel_12, true } \
257 /* we have to do all this to satisfy the PIOS_ADC_MAX_SAMPLES define in pios_adc.h */
258 /* which is annoying because this then determines the rate at which we generate buffer turnover events */
259 /* the objective here is to get enough buffer space to support 100Hz averaging rate */
260 #define PIOS_ADC_NUM_CHANNELS 4
261 #define PIOS_ADC_MAX_OVERSAMPLING 2
262 #define PIOS_ADC_USE_ADC2 0
264 #define PIOS_ADC_USE_TEMP_SENSOR
265 #define PIOS_ADC_TEMPERATURE_PIN 3 /* V */
267 // -------------------------
269 // -------------------------
270 #define PIOS_USB_MAX_DEVS 1
271 #define PIOS_USB_ENABLED 1 /* Should remove all references to this */
272 #define PIOS_USB_HID_MAX_DEVS 1
274 #endif /* PIOS_BOARD_H */