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