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
85 extern uint32_t pios_spi_gyro_id
;
86 extern uint32_t pios_spi_accel_id
;
87 #define PIOS_SPI_L3GD20_ADAPTER (pios_spi_gyro_id)
88 #define PIOS_SPI_BMA180_ADAPTER (pios_spi_accel_id)
89 #define PIOS_SPI_MPU6000_ADAPTER (pios_spi_gyro_id)
91 // ------------------------
93 // ------------------------
94 #define PIOS_WATCHDOG_TIMEOUT 250
95 #define PIOS_WDG_REGISTER RTC_BKP_DR4
96 #define PIOS_WDG_ACTUATOR 0x0001
97 #define PIOS_WDG_STABILIZATION 0x0002
98 #define PIOS_WDG_ATTITUDE 0x0004
99 #define PIOS_WDG_MANUAL 0x0008
100 #define PIOS_WDG_SENSORS 0x0010
101 #define PIOS_WDG_AUTOTUNE 0x0020
103 // ------------------------
105 // See also pios_board.c
106 // ------------------------
107 #define PIOS_I2C_MAX_DEVS 3
108 extern uint32_t pios_i2c_mag_adapter_id
;
109 extern uint32_t pios_i2c_pressure_adapter_id
;
111 #define PIOS_I2C_MS56XX_INTERNAL_ADAPTER (pios_i2c_pressure_adapter_id)
112 #define PIOS_I2C_HMC5X83_INTERNAL_ADAPTER (pios_i2c_mag_adapter_id)
114 extern uint32_t pios_i2c_flexiport_adapter_id
;
115 #define PIOS_I2C_FLEXI_ADAPTER (pios_i2c_flexiport_adapter_id)
116 #define PIOS_I2C_ETASV3_ADAPTER (PIOS_I2C_FLEXI_ADAPTER)
117 #define PIOS_I2C_EXTERNAL_ADAPTER (pios_i2c_flexiport_adapter_id)
120 // -------------------------
123 // See also pios_board.c
124 // -------------------------
125 #define PIOS_USART_MAX_DEVS 5
126 // Inverter for SBUS handling
127 #define PIOS_USART_INVERTER_PORT UART4
128 #define PIOS_USART_INVERTER_GPIO GPIOC
129 #define PIOS_USART_INVERTER_PIN GPIO_Pin_3
130 #define PIOS_USART_INVERTER_ENABLE Bit_SET
131 #define PIOS_USART_INVERTER_DISABLE Bit_RESET
133 // -------------------------
136 // See also pios_board.c
137 // -------------------------
138 #define PIOS_COM_MAX_DEVS 4
140 #ifdef PIOS_INCLUDE_WS2811
141 extern uint32_t pios_ws2811_id
;
142 #define PIOS_WS2811_DEVICE (pios_ws2811_id)
145 // ------------------------
147 // ------------------------
148 #define TELEM_QUEUE_SIZE 80
149 #define PIOS_TELEM_STACK_SIZE 800
151 // -------------------------
154 // See also System_stm32f4xx.c
155 // -------------------------
156 // These macros are deprecated
157 // please use PIOS_PERIPHERAL_APBx_CLOCK According to the table below
158 // #define PIOS_MASTER_CLOCK
159 // #define PIOS_PERIPHERAL_CLOCK
160 // #define PIOS_PERIPHERAL_CLOCK
162 #define PIOS_SYSCLK 168000000
163 // Peripherals that belongs to APB1 are:
165 // I2C1,2,3 |UART4,5 |USART3,2
166 // I2S3Ext |SPI3/I2S3 |SPI2/I2S2
167 // I2S2Ext |IWDG |WWDG
169 // TIM2,3,4,5,6,7,12,13,14
171 // Calculated as SYSCLK / APBPresc * (APBPre == 1 ? 1 : 2)
172 // Default APB1 Prescaler = 4
173 #define PIOS_PERIPHERAL_APB1_CLOCK (PIOS_SYSCLK / 2)
175 // Peripherals belonging to APB2
176 // SDIO |EXTI |SYSCFG |SPI1
181 // Default APB2 Prescaler = 2
183 #define PIOS_PERIPHERAL_APB2_CLOCK PIOS_SYSCLK
185 // -------------------------
186 // Interrupt Priorities
187 // -------------------------
188 #define PIOS_IRQ_PRIO_LOW 12 // lower than RTOS
189 #define PIOS_IRQ_PRIO_MID 8 // higher than RTOS
190 #define PIOS_IRQ_PRIO_HIGH 5 // for SPI, ADC, I2C etc...
191 #define PIOS_IRQ_PRIO_HIGHEST 4 // for USART etc...
192 // ------------------------
194 // See also pios_board.c
195 // ------------------------
196 #define PIOS_RCVR_MAX_DEVS 3
197 #define PIOS_RCVR_MAX_CHANNELS 12
198 #define PIOS_GCSRCVR_TIMEOUT_MS 100
200 // -------------------------
201 // Receiver PPM input
202 // -------------------------
203 #define PIOS_PPM_MAX_DEVS 1
204 #define PIOS_PPM_NUM_INPUTS 16
206 // -------------------------
207 // Receiver PWM input
208 // -------------------------
209 #define PIOS_PWM_MAX_DEVS 1
210 #define PIOS_PWM_NUM_INPUTS 8
212 // -------------------------
213 // Receiver SPEKTRUM input
214 // -------------------------
215 #define PIOS_SPEKTRUM_MAX_DEVS 2
216 #define PIOS_SPEKTRUM_NUM_INPUTS 12
218 // -------------------------
219 // Receiver S.Bus input
220 // -------------------------
221 #define PIOS_SBUS_MAX_DEVS 1
222 #define PIOS_SBUS_NUM_INPUTS (16 + 2)
224 // -------------------------
225 // Receiver DSM input
226 // -------------------------
227 #define PIOS_DSM_MAX_DEVS 2
228 #define PIOS_DSM_NUM_INPUTS 12
230 // -------------------------
232 // -------------------------
233 #define PIOS_SERVO_UPDATE_HZ 50
234 #define PIOS_SERVOS_INITIAL_POSITION 0 /* dont want to start motors, have no pulse till settings loaded */
235 #define PIOS_SERVO_BANKS 6
237 // --------------------------
238 // Timer controller settings
239 // --------------------------
240 #define PIOS_TIM_MAX_DEVS 6
242 // -------------------------
244 // PIOS_ADC_PinGet(0) = Current sensor
245 // PIOS_ADC_PinGet(1) = Voltage sensor
246 // PIOS_ADC_PinGet(2) = VREF
247 // PIOS_ADC_PinGet(3) = Temperature sensor
248 // PIOS_ADC_PinGet(4) = Board Power
249 // -------------------------
250 #define PIOS_DMA_PIN_CONFIG \
252 { GPIOC, GPIO_Pin_0, ADC_Channel_10, true }, \
253 { GPIOC, GPIO_Pin_1, ADC_Channel_11, true }, \
254 { NULL, 0, ADC_Channel_Vrefint, true }, /* Voltage reference */ \
255 { NULL, 0, ADC_Channel_TempSensor, true }, /* Temperature sensor */ \
256 { GPIOC, GPIO_Pin_2, ADC_Channel_12, true } \
259 /* we have to do all this to satisfy the PIOS_ADC_MAX_SAMPLES define in pios_adc.h */
260 /* which is annoying because this then determines the rate at which we generate buffer turnover events */
261 /* the objective here is to get enough buffer space to support 100Hz averaging rate */
262 #define PIOS_ADC_NUM_CHANNELS 4
263 #define PIOS_ADC_MAX_OVERSAMPLING 2
264 #define PIOS_ADC_USE_ADC2 0
266 #define PIOS_ADC_USE_TEMP_SENSOR
267 #define PIOS_ADC_TEMPERATURE_PIN 3 /* V */
269 // -------------------------
271 // -------------------------
272 #define PIOS_USB_MAX_DEVS 1
273 #define PIOS_USB_ENABLED 1 /* Should remove all references to this */
274 #define PIOS_USB_HID_MAX_DEVS 1
276 #endif /* PIOS_BOARD_H */