dRonin  adbada4
dRonin firmware
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
pios_board.h
Go to the documentation of this file.
1 
15 /*
16  * This program is free software; you can redistribute it and/or modify
17  * it under the terms of the GNU General Public License as published by
18  * the Free Software Foundation; either version 3 of the License, or
19  * (at your option) any later version.
20  *
21  * This program is distributed in the hope that it will be useful, but
22  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
23  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
24  * for more details.
25  *
26  * You should have received a copy of the GNU General Public License along
27  * with this program; if not, see <http://www.gnu.org/licenses/>
28  */
29 
30 
31 #ifndef STM3210E_INS_H_
32 #define STM3210E_INS_H_
33 
34 #include <stdbool.h>
35 
36 #if defined(PIOS_INCLUDE_DEBUG_CONSOLE)
37 #define DEBUG_LEVEL 0
38 #define DEBUG_PRINTF(level, ...) {if(level <= DEBUG_LEVEL && pios_com_debug_id > 0) { PIOS_COM_SendFormattedStringNonBlocking(pios_com_debug_id, __VA_ARGS__); }}
39 #else
40 #define DEBUG_PRINTF(level, ...)
41 #endif /* PIOS_INCLUDE_DEBUG_CONSOLE */
42 
43 //------------------------
44 // Timers and Channels Used
45 //------------------------
46 /*
47 Timer | Channel 1 | Channel 2 | Channel 3 | Channel 4
48 ------+-----------+-----------+-----------+----------
49 TIM1 | | | |
50 TIM2 | --------------- PIOS_DELAY -----------------
51 TIM3 | | | |
52 TIM4 | | | |
53 TIM5 | | | |
54 TIM6 | | | |
55 TIM7 | | | |
56 TIM8 | | | |
57 ------+-----------+-----------+-----------+----------
58 */
59 
60 //------------------------
61 // DMA Channels Used
62 //------------------------
63 /* Channel 1 - */
64 /* Channel 2 - */
65 /* Channel 3 - */
66 /* Channel 4 - */
67 /* Channel 5 - */
68 /* Channel 6 - */
69 /* Channel 7 - */
70 /* Channel 8 - */
71 /* Channel 9 - */
72 /* Channel 10 - */
73 /* Channel 11 - */
74 /* Channel 12 - */
75 
76 //------------------------
77 // BOOTLOADER_SETTINGS
78 //------------------------
79 #define BOARD_READABLE true
80 #define BOARD_WRITABLE true
81 #define MAX_DEL_RETRYS 3
82 
83 
84 //------------------------
85 // PIOS_LED
86 //------------------------
87 #define PIOS_LED_BLUE 0
88 #define PIOS_LED_RED 1
89 
90 #define PIOS_LED_HEARTBEAT PIOS_LED_BLUE
91 #define PIOS_LED_ALARM PIOS_LED_RED
92 
93 
94 //------------------------
95 // PIOS_WDG
96 //------------------------
97 #define PIOS_WATCHDOG_TIMEOUT 250
98 #define PIOS_WDG_REGISTER RTC_BKP_DR4
99 
100 //-------------------------
101 // PIOS_COM
102 //
103 // See also pios_board.c
104 //-------------------------
105 extern uintptr_t pios_com_telem_serial_id;
106 extern uintptr_t pios_com_gps_id;
107 extern uintptr_t pios_com_telem_usb_id;
108 extern uintptr_t pios_com_bridge_id;
109 extern uintptr_t pios_com_vcp_id;
110 extern uintptr_t pios_com_mavlink_id;
111 extern uintptr_t pios_com_frsky_sensor_hub_id;
112 extern uintptr_t pios_com_frsky_sport_id;
113 extern uintptr_t pios_com_lighttelemetry_id;
114 extern uintptr_t pios_com_hott_id;
115 extern uintptr_t pios_com_openlog_logging_id;
116 extern uintptr_t pios_com_storm32bgc_id;
117 extern uintptr_t pios_com_tbsvtxconfig_id;
118 
119 #define PIOS_COM_GPS (pios_com_gps_id)
120 #define PIOS_COM_TELEM_USB (pios_com_telem_usb_id)
121 #define PIOS_COM_BRIDGE (pios_com_bridge_id)
122 #define PIOS_COM_VCP (pios_com_vcp_id)
123 #define PIOS_COM_MAVLINK (pios_com_mavlink_id)
124 #define PIOS_COM_HOTT (pios_com_hott_id)
125 #define PIOS_COM_FRSKY_SENSOR_HUB (pios_com_frsky_sensor_hub_id)
126 #define PIOS_COM_FRSKY_SPORT (pios_com_frsky_sport_id)
127 #define PIOS_COM_LIGHTTELEMETRY (pios_com_lighttelemetry_id)
128 #define PIOS_COM_OPENLOG (pios_com_openlog_logging_id)
129 #define PIOS_COM_STORM32BGC (pios_com_storm32bgc_id)
130 #define PIOS_COM_TBSVTXCONFIG (pios_com_tbsvtxconfig_id)
131 
132 #if defined(PIOS_INCLUDE_DEBUG_CONSOLE)
133 extern uintptr_t pios_com_debug_id;
134 #define PIOS_COM_DEBUG (pios_com_debug_id)
135 #endif /* PIOS_INCLUDE_DEBUG_CONSOLE */
136 
137 
138 #define PIOS_SYSCLK 168000000
139 // Peripherals that belongs to APB1 are:
140 // DAC |PWR |CAN1,2
141 // I2C1,2,3 |UART4,5 |USART3,2
142 // I2S3Ext |SPI3/I2S3 |SPI2/I2S2
143 // I2S2Ext |IWDG |WWDG
144 // RTC/BKP reg
145 // TIM2,3,4,5,6,7,12,13,14
146 
147 // Calculated as SYSCLK / APBPresc * (APBPre == 1 ? 1 : 2)
148 // Default APB1 Prescaler = 4
149 #define PIOS_PERIPHERAL_APB1_CLOCK (PIOS_SYSCLK / 4)
150 
151 // Peripherals belonging to APB2
152 // SDIO |EXTI |SYSCFG |SPI1
153 // ADC1,2,3
154 // USART1,6
155 // TIM1,8,9,10,11
156 //
157 // Default APB2 Prescaler = 2
158 //
159 #define PIOS_PERIPHERAL_APB2_CLOCK (PIOS_SYSCLK / 2)
160 
161 
162 //-------------------------
163 // Interrupt Priorities
164 //-------------------------
165 #define PIOS_IRQ_PRIO_LOW 12 // lower than RTOS
166 #define PIOS_IRQ_PRIO_MID 8 // higher than RTOS
167 #define PIOS_IRQ_PRIO_HIGH 5 // for SPI, ADC, I2C etc...
168 #define PIOS_IRQ_PRIO_HIGHEST 4 // for USART etc...
169 
170 
171 //------------------------
172 // PIOS_RCVR
173 // See also pios_board.c
174 //------------------------
175 #define PIOS_RCVR_MAX_CHANNELS 12
176 
177 //-------------------------
178 // Receiver PPM input
179 //-------------------------
180 #define PIOS_PPM_NUM_INPUTS 12
181 
182 //-------------------------
183 // Receiver PWM input
184 //-------------------------
185 #define PIOS_PWM_NUM_INPUTS 8
186 
187 //-------------------------
188 // Receiver DSM input
189 //-------------------------
190 #define PIOS_DSM_NUM_INPUTS 12
191 
192 //-------------------------
193 // Receiver HSUM input
194 //-------------------------
195 #define PIOS_HSUM_MAX_DEVS 2
196 #define PIOS_HSUM_NUM_INPUTS 32
197 
198 //-------------------------
199 // Receiver S.Bus input
200 //-------------------------
201 #define PIOS_SBUS_NUM_INPUTS (16+2)
202 
203 //-------------------------
204 // Servo outputs
205 //-------------------------
206 #define PIOS_SERVO_UPDATE_HZ 50
207 #define PIOS_SERVOS_INITIAL_POSITION 0 /* dont want to start motors, have no pulse till settings loaded */
208 
209 //--------------------------
210 // Timer controller settings
211 //--------------------------
212 #define PIOS_TIM_MAX_DEVS 8
213 
214 //-------------------------
215 // ADC
216 #define PIOS_ADC_MAX_OVERSAMPLING 2
217 #define VREF_PLUS 3.3
218 
219 //-------------------------
220 // USB
221 //-------------------------
222 #define PIOS_USB_ENABLED 1 /* Should remove all references to this */
223 
224 #if defined(PIOS_INCLUDE_VIDEO)
225 #include <pios.h>
226 #include <pios_stm32.h>
227 #include <pios_tim_priv.h>
228 
229 struct pios_osd_bw_cfg_t {
230  TIM_TimeBaseInitTypeDef tim_base_init;
231  TIM_OCInitTypeDef tim_oc_init;
232  GPIO_InitTypeDef gpio_init;
233  uint32_t remap;
234  const struct pios_tim_channel * bw_channels;
235 };
236 #endif /* PIOS_INCLUDE_VIDEO */
237 
238 #endif /* STM3210E_INS_H_ */
239 
uintptr_t pios_com_frsky_sport_id
Types that are specific to the STM32 peripherals.
uintptr_t pios_com_frsky_sensor_hub_id
Main PiOS header to include all the compiled in PiOS options.
uintptr_t pios_com_tbsvtxconfig_id
uintptr_t pios_com_telem_serial_id
Definition: pios_hal.c:127
uintptr_t pios_com_debug_id
Definition: pios_board.c:76
uintptr_t pios_com_hott_id
uintptr_t pios_com_mavlink_id
uintptr_t pios_com_lighttelemetry_id
uintptr_t pios_com_openlog_logging_id
Definition: pios_board.c:49
uintptr_t pios_com_telem_usb_id
Definition: pios_board.c:42
uintptr_t pios_com_bridge_id
Definition: pios_hal.c:81
uintptr_t pios_com_storm32bgc_id
uintptr_t pios_com_gps_id
Definition: pios_hal.c:80
uintptr_t pios_com_vcp_id