amiro-os / modules / NUCLEO-F103RB / board.h @ 7e674331
History | View | Annotate | Download (12.608 KB)
1 | f4da707a | Thomas Schöpping | /*
|
---|---|---|---|
2 | 0f60c8ad | Thomas Schöpping | AMiRo-OS is an operating system designed for the Autonomous Mini Robot (AMiRo) platform.
|
3 | Copyright (C) 2016..2019 Thomas Schöpping et al.
|
||
4 | f4da707a | Thomas Schöpping | |
5 | 0f60c8ad | Thomas Schöpping | This program is free software: you can redistribute it and/or modify
|
6 | it under the terms of the GNU General Public License as published by
|
||
7 | the Free Software Foundation, either version 3 of the License, or
|
||
8 | (at your option) any later version.
|
||
9 | f4da707a | Thomas Schöpping | |
10 | 0f60c8ad | Thomas Schöpping | This program is distributed in the hope that it will be useful,
|
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
13 | GNU General Public License for more details.
|
||
14 | f4da707a | Thomas Schöpping | |
15 | 0f60c8ad | Thomas Schöpping | You should have received a copy of the GNU General Public License
|
16 | along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||
17 | f4da707a | Thomas Schöpping | */
|
18 | |||
19 | 6ff06bbf | Thomas Schöpping | #ifndef BOARD_H
|
20 | #define BOARD_H
|
||
21 | f4da707a | Thomas Schöpping | |
22 | 4c72a54c | Thomas Schöpping | /*===========================================================================*/
|
23 | /* Driver constants. */
|
||
24 | /*===========================================================================*/
|
||
25 | |||
26 | f4da707a | Thomas Schöpping | /*
|
27 | * Setup for the ST NUCLEO64-F103RB board.
|
||
28 | */
|
||
29 | |||
30 | /*
|
||
31 | * Board identifier.
|
||
32 | */
|
||
33 | #define BOARD_ST_NUCLEO64_F103RB
|
||
34 | #define BOARD_NAME "STMicroelectronics NUCLEO-F103RB" |
||
35 | |||
36 | /*
|
||
37 | * Board frequencies.
|
||
38 | */
|
||
39 | #define STM32_LSECLK 0 |
||
40 | |||
41 | #if defined(NUCLEO_EXTERNAL_OSCILLATOR)
|
||
42 | #define STM32_HSECLK 8000000 |
||
43 | #define STM32_HSE_BYPASS
|
||
44 | |||
45 | #elif defined(NUCLEO_HSE_CRYSTAL)
|
||
46 | #define STM32_HSECLK 8000000 |
||
47 | |||
48 | #else
|
||
49 | #define STM32_HSECLK 0 |
||
50 | #endif
|
||
51 | |||
52 | /*
|
||
53 | * MCU type, supported types are defined in ./os/hal/platforms/hal_lld.h.
|
||
54 | */
|
||
55 | #define STM32F103xB
|
||
56 | |||
57 | /*
|
||
58 | 4c72a54c | Thomas Schöpping | * Identifiers for optional peripherals.
|
59 | */
|
||
60 | #define BOARD_DW1000_CONNECTED false |
||
61 | |||
62 | /*
|
||
63 | f4da707a | Thomas Schöpping | * IO pins assignments.
|
64 | */
|
||
65 | #define GPIOA_ARD_A0 0U |
||
66 | #define GPIOA_ADC1_IN0 0U |
||
67 | #define GPIOA_ARD_A1 1U |
||
68 | #define GPIOA_ADC1_IN1 1U |
||
69 | #define GPIOA_ARD_D1 2U |
||
70 | #define GPIOA_USART2_TX 2U |
||
71 | #define GPIOA_ARD_D0 3U |
||
72 | #define GPIOA_USART2_RX 3U |
||
73 | #define GPIOA_ARD_A2 4U |
||
74 | #define GPIOA_ADC1_IN4 4U |
||
75 | #define GPIOA_ARD_D13 5U |
||
76 | 3106e8cc | Thomas Schöpping | #define GPIOA_LED_GREEN 5U |
77 | f4da707a | Thomas Schöpping | #define GPIOA_ARD_D12 6U |
78 | #define GPIOA_ARD_D11 7U |
||
79 | #define GPIOA_ARD_D7 8U |
||
80 | #define GPIOA_ARD_D8 9U |
||
81 | #define GPIOA_ARD_D2 10U |
||
82 | #define GPIOA_PIN11 11U |
||
83 | #define GPIOA_PIN12 12U |
||
84 | #define GPIOA_SWDIO 13U |
||
85 | #define GPIOA_SWCLK 14U |
||
86 | #define GPIOA_PIN15 15U |
||
87 | |||
88 | #define GPIOB_ARD_A3 0U |
||
89 | #define GPIOB_ADC1_IN8 0U |
||
90 | #define GPIOB_PIN1 1U |
||
91 | #define GPIOB_PIN2 2U |
||
92 | #define GPIOB_ARD_D3 3U |
||
93 | 3106e8cc | Thomas Schöpping | #define GPIOB_SWO 3U |
94 | f4da707a | Thomas Schöpping | #define GPIOB_ARD_D5 4U |
95 | #define GPIOB_ARD_D4 5U |
||
96 | #define GPIOB_ARD_D10 6U |
||
97 | #define GPIOB_PIN7 7U |
||
98 | #define GPIOB_ARD_D15 8U |
||
99 | #define GPIOB_ARD_D14 9U |
||
100 | #define GPIOB_ARD_D6 10U |
||
101 | #define GPIOB_PIN11 11U |
||
102 | #define GPIOB_PIN12 12U |
||
103 | #define GPIOB_PIN13 13U |
||
104 | #define GPIOB_PIN14 14U |
||
105 | #define GPIOB_PIN15 15U |
||
106 | |||
107 | #define GPIOC_ARD_A5 0U |
||
108 | #define GPIOC_ADC1_IN11 0U |
||
109 | #define GPIOC_ARD_A4 1U |
||
110 | #define GPIOC_ADC1_IN10 1U |
||
111 | #define GPIOC_PIN2 2U |
||
112 | #define GPIOC_PIN3 3U |
||
113 | #define GPIOC_PIN4 4U |
||
114 | #define GPIOC_PIN5 5U |
||
115 | #define GPIOC_PIN6 6U |
||
116 | #define GPIOC_ARD_D9 7U |
||
117 | #define GPIOC_PIN8 8U |
||
118 | #define GPIOC_PIN9 9U |
||
119 | #define GPIOC_PIN10 10U |
||
120 | #define GPIOC_PIN11 11U |
||
121 | #define GPIOC_PIN12 12U |
||
122 | #define GPIOC_BUTTON 13U |
||
123 | #define GPIOC_PIN14 14U |
||
124 | #define GPIOC_PIN15 15U |
||
125 | |||
126 | #define GPIOD_OSC_IN 0U |
||
127 | #define GPIOD_PIN0 0U |
||
128 | #define GPIOD_OSC_OUT 1U |
||
129 | #define GPIOD_PIN1 1U |
||
130 | #define GPIOD_PIN2 2U |
||
131 | #define GPIOD_PIN3 3U |
||
132 | #define GPIOD_PIN4 4U |
||
133 | #define GPIOD_PIN5 5U |
||
134 | #define GPIOD_PIN6 6U |
||
135 | #define GPIOD_PIN7 7U |
||
136 | #define GPIOD_PIN8 8U |
||
137 | #define GPIOD_PIN9 9U |
||
138 | #define GPIOD_PIN10 10U |
||
139 | #define GPIOD_PIN11 11U |
||
140 | #define GPIOD_PIN12 12U |
||
141 | #define GPIOD_PIN13 13U |
||
142 | #define GPIOD_PIN14 14U |
||
143 | #define GPIOD_PIN15 15U |
||
144 | |||
145 | #define GPIOE_PIN0 0U |
||
146 | #define GPIOE_PIN1 1U |
||
147 | #define GPIOE_PIN2 2U |
||
148 | #define GPIOE_PIN3 3U |
||
149 | #define GPIOE_PIN4 4U |
||
150 | #define GPIOE_PIN5 5U |
||
151 | #define GPIOE_PIN6 6U |
||
152 | #define GPIOE_PIN7 7U |
||
153 | #define GPIOE_PIN8 8U |
||
154 | #define GPIOE_PIN9 9U |
||
155 | #define GPIOE_PIN10 10U |
||
156 | #define GPIOE_PIN11 11U |
||
157 | #define GPIOE_PIN12 12U |
||
158 | #define GPIOE_PIN13 13U |
||
159 | #define GPIOE_PIN14 14U |
||
160 | #define GPIOE_PIN15 15U |
||
161 | |||
162 | #define GPIOF_PIN0 0U |
||
163 | #define GPIOF_PIN1 1U |
||
164 | #define GPIOF_PIN2 2U |
||
165 | #define GPIOF_PIN3 3U |
||
166 | #define GPIOF_PIN4 4U |
||
167 | #define GPIOF_PIN5 5U |
||
168 | #define GPIOF_PIN6 6U |
||
169 | #define GPIOF_PIN7 7U |
||
170 | #define GPIOF_PIN8 8U |
||
171 | #define GPIOF_PIN9 9U |
||
172 | #define GPIOF_PIN10 10U |
||
173 | #define GPIOF_PIN11 11U |
||
174 | #define GPIOF_PIN12 12U |
||
175 | #define GPIOF_PIN13 13U |
||
176 | #define GPIOF_PIN14 14U |
||
177 | #define GPIOF_PIN15 15U |
||
178 | 3106e8cc | Thomas Schöpping | |
179 | /*
|
||
180 | * IO lines assignments.
|
||
181 | */
|
||
182 | #define LINE_ARD_A0 PAL_LINE(GPIOA, GPIOA_ARD_A0)
|
||
183 | #define LINE_ADC1_IN0 PAL_LINE(GPIOA, GPIOA_ADC1_IN0)
|
||
184 | #define LINE_ARD_A1 PAL_LINE(GPIOA, GPIOA_ARD_A1)
|
||
185 | #define LINE_ADC1_IN1 PAL_LINE(GPIOA, GPIOA_ADC1_IN1)
|
||
186 | #define LINE_ARD_D1 PAL_LINE(GPIOA, GPIOA_ARD_D1)
|
||
187 | #define LINE_USART2_TX PAL_LINE(GPIOA, GPIOA_USART2_TX)
|
||
188 | #define LINE_ARD_D0 PAL_LINE(GPIOA, GPIOA_ARD_D0)
|
||
189 | #define LINE_USART2_RX PAL_LINE(GPIOA, GPIOA_USART2_RX)
|
||
190 | #define LINE_ARD_A2 PAL_LINE(GPIOA, GPIOA_ARD_A2)
|
||
191 | #define LINE_ADC1_IN4 PAL_LINE(GPIOA, GPIOA_ADC1_IN4)
|
||
192 | #define LINE_ARD_D13 PAL_LINE(GPIOA, GPIOA_ARD_D13)
|
||
193 | #define LINE_LED_GREEN PAL_LINE(GPIOA, GPIOA_LED_GREEN)
|
||
194 | #define LINE_ARD_D12 PAL_LINE(GPIOA, GPIOA_ARD_D12)
|
||
195 | #define LINE_ARD_D11 PAL_LINE(GPIOA, GPIOA_ARD_D11)
|
||
196 | #define LINE_ARD_D7 PAL_LINE(GPIOA, GPIOA_ARD_D7)
|
||
197 | #define LINE_ARD_D8 PAL_LINE(GPIOA, GPIOA_ARD_D8)
|
||
198 | #define LINE_ARD_D2 PAL_LINE(GPIOA, GPIOA_ARD_D2)
|
||
199 | #define LINE_SWDIO PAL_LINE(GPIOA, GPIOA_SWDIO)
|
||
200 | #define LINE_SWCLK PAL_LINE(GPIOA, GPIOA_SWCLK)
|
||
201 | |||
202 | #define LINE_ARD_A3 PAL_LINE(GPIOB, GPIOB_ARD_A3)
|
||
203 | #define LINE_ADC1_IN8 PAL_LINE(GPIOB, GPIOB_ADC1_IN8)
|
||
204 | #define LINE_ARD_D3 PAL_LINE(GPIOB, GPIOB_ARD_D3)
|
||
205 | #define LINE_SWO PAL_LINE(GPIOB, GPIOB_SWO)
|
||
206 | #define LINE_ARD_D5 PAL_LINE(GPIOB, GPIOB_ARD_D5)
|
||
207 | #define LINE_ARD_D4 PAL_LINE(GPIOB, GPIOB_ARD_D4)
|
||
208 | #define LINE_ARD_D10 PAL_LINE(GPIOB, GPIOB_ARD_D10)
|
||
209 | #define LINE_ARD_D15 PAL_LINE(GPIOB, GPIOB_ARD_D15)
|
||
210 | #define LINE_ARD_D14 PAL_LINE(GPIOB, GPIOB_ARD_D14)
|
||
211 | #define LINE_ARD_D6 PAL_LINE(GPIOB, GPIOB_ARD_D6)
|
||
212 | |||
213 | #define LINE_ARD_A5 PAL_LINE(GPIOC, GPIOC_ARD_A5)
|
||
214 | #define LINE_ADC1_IN11 PAL_LINE(GPIOC, GPIOC_ADC1_IN11)
|
||
215 | #define LINE_ARD_A4 PAL_LINE(GPIOC, GPIOC_ARD_A4)
|
||
216 | #define LINE_ADC1_IN10 PAL_LINE(GPIOC, GPIOC_ADC1_IN10)
|
||
217 | #define LINE_ARD_D9 PAL_LINE(GPIOC, GPIOC_ARD_D9)
|
||
218 | #define LINE_BUTTON PAL_LINE(GPIOC, GPIOC_BUTTON)
|
||
219 | |||
220 | #define LINE_OSC_IN PAL_LINE(GPIOD, GPIOH_OSC_IN)
|
||
221 | #define LINE_OSC_OUT PAL_LINE(GPIOD, GPIOH_OSC_OUT)
|
||
222 | |||
223 | 4c72a54c | Thomas Schöpping | /*===========================================================================*/
|
224 | /* Driver pre-compile time settings. */
|
||
225 | /*===========================================================================*/
|
||
226 | |||
227 | /*===========================================================================*/
|
||
228 | /* Derived constants and error checks. */
|
||
229 | /*===========================================================================*/
|
||
230 | |||
231 | /*===========================================================================*/
|
||
232 | /* Driver data structures and types. */
|
||
233 | /*===========================================================================*/
|
||
234 | |||
235 | /*===========================================================================*/
|
||
236 | /* Driver macros. */
|
||
237 | /*===========================================================================*/
|
||
238 | 3106e8cc | Thomas Schöpping | |
239 | f4da707a | Thomas Schöpping | /*
|
240 | * I/O ports initial setup, this configuration is established soon after reset
|
||
241 | * in the initialization code.
|
||
242 | *
|
||
243 | * The digits have the following meaning:
|
||
244 | * 0 - Analog input.
|
||
245 | * 1 - Push Pull output 10MHz.
|
||
246 | * 2 - Push Pull output 2MHz.
|
||
247 | * 3 - Push Pull output 50MHz.
|
||
248 | * 4 - Digital input.
|
||
249 | * 5 - Open Drain output 10MHz.
|
||
250 | * 6 - Open Drain output 2MHz.
|
||
251 | * 7 - Open Drain output 50MHz.
|
||
252 | * 8 - Digital input with PullUp or PullDown resistor depending on ODR.
|
||
253 | * 9 - Alternate Push Pull output 10MHz.
|
||
254 | * A - Alternate Push Pull output 2MHz.
|
||
255 | * B - Alternate Push Pull output 50MHz.
|
||
256 | * C - Reserved.
|
||
257 | * D - Alternate Open Drain output 10MHz.
|
||
258 | * E - Alternate Open Drain output 2MHz.
|
||
259 | * F - Alternate Open Drain output 50MHz.
|
||
260 | * Please refer to the STM32 Reference Manual for details.
|
||
261 | */
|
||
262 | |||
263 | /*
|
||
264 | * Port A setup.
|
||
265 | * Everything input with pull-up except:
|
||
266 | * PA2 - Alternate output (GPIOA_ARD_D1, GPIOA_USART2_TX).
|
||
267 | * PA3 - Normal input (GPIOA_ARD_D0, GPIOA_USART2_RX).
|
||
268 | * PA5 - Push Pull output (GPIOA_LED_GREEN).
|
||
269 | * PA13 - Pull-up input (GPIOA_SWDIO).
|
||
270 | * PA14 - Pull-down input (GPIOA_SWCLK).
|
||
271 | */
|
||
272 | #define VAL_GPIOACRL 0x88384B88 /* PA7...PA0 */ |
||
273 | #define VAL_GPIOACRH 0x88888888 /* PA15...PA8 */ |
||
274 | #define VAL_GPIOAODR 0xFFFFBFDF |
||
275 | |||
276 | /*
|
||
277 | * Port B setup.
|
||
278 | * Everything input with pull-up except:
|
||
279 | * PB3 - Pull-up input (GPIOA_SWO).
|
||
280 | */
|
||
281 | #define VAL_GPIOBCRL 0x88888888 /* PB7...PB0 */ |
||
282 | #define VAL_GPIOBCRH 0x88888888 /* PB15...PB8 */ |
||
283 | #define VAL_GPIOBODR 0xFFFFFFFF |
||
284 | |||
285 | /*
|
||
286 | * Port C setup.
|
||
287 | * Everything input with pull-up except:
|
||
288 | * PC13 - Normal input (GPIOC_BUTTON).
|
||
289 | */
|
||
290 | #define VAL_GPIOCCRL 0x88888888 /* PC7...PC0 */ |
||
291 | #define VAL_GPIOCCRH 0x88488888 /* PC15...PC8 */ |
||
292 | #define VAL_GPIOCODR 0xFFFFFFFF |
||
293 | |||
294 | /*
|
||
295 | * Port D setup.
|
||
296 | * Everything input with pull-up except:
|
||
297 | * PD0 - Normal input (GPIOD_OSC_IN).
|
||
298 | * PD1 - Normal input (GPIOD_OSC_OUT).
|
||
299 | */
|
||
300 | #define VAL_GPIODCRL 0x88888844 /* PD7...PD0 */ |
||
301 | #define VAL_GPIODCRH 0x88888888 /* PD15...PD8 */ |
||
302 | #define VAL_GPIODODR 0xFFFFFFFF |
||
303 | |||
304 | /*
|
||
305 | * Port E setup.
|
||
306 | * Everything input with pull-up except:
|
||
307 | */
|
||
308 | #define VAL_GPIOECRL 0x88888888 /* PE7...PE0 */ |
||
309 | #define VAL_GPIOECRH 0x88888888 /* PE15...PE8 */ |
||
310 | #define VAL_GPIOEODR 0xFFFFFFFF |
||
311 | |||
312 | /*
|
||
313 | * USB bus activation macro, required by the USB driver.
|
||
314 | */
|
||
315 | #define usb_lld_connect_bus(usbp)
|
||
316 | |||
317 | /*
|
||
318 | * USB bus de-activation macro, required by the USB driver.
|
||
319 | */
|
||
320 | #define usb_lld_disconnect_bus(usbp)
|
||
321 | |||
322 | 4c72a54c | Thomas Schöpping | /*===========================================================================*/
|
323 | /* External declarations. */
|
||
324 | /*===========================================================================*/
|
||
325 | |||
326 | f4da707a | Thomas Schöpping | #if !defined(_FROM_ASM_)
|
327 | #ifdef __cplusplus
|
||
328 | extern "C" { |
||
329 | #endif
|
||
330 | void boardInit(void); |
||
331 | #ifdef __cplusplus
|
||
332 | } |
||
333 | #endif
|
||
334 | #endif /* _FROM_ASM_ */ |
||
335 | |||
336 | 6ff06bbf | Thomas Schöpping | #endif /* BOARD_H */ |