dRonin  adbada4
dRonin firmware
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
mcuconf.h
Go to the documentation of this file.
1 /*
2  ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio
3 
4  Licensed under the Apache License, Version 2.0 (the "License");
5  you may not use this file except in compliance with the License.
6  You may obtain a copy of the License at
7 
8  http://www.apache.org/licenses/LICENSE-2.0
9 
10  Unless required by applicable law or agreed to in writing, software
11  distributed under the License is distributed on an "AS IS" BASIS,
12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  See the License for the specific language governing permissions and
14  limitations under the License.
15 */
16 
26 /*
27  * STM32F4xx drivers configuration.
28  * The following settings override the default settings present in
29  * the various device driver implementation headers.
30  * Note that the settings for each driver only have effect if the whole
31  * driver is enabled in halconf.h.
32  *
33  * IRQ priorities:
34  * 15...0 Lowest...Highest.
35  *
36  * DMA priorities:
37  * 0...3 Lowest...Highest.
38  */
39 
40 #define STM32F4xx_MCUCONF
41 
42 /*
43  * HAL driver system settings.
44  */
45 #define STM32_NO_INIT FALSE
46 #define STM32_HSI_ENABLED TRUE
47 #define STM32_LSI_ENABLED TRUE
48 #define STM32_HSE_ENABLED TRUE
49 #define STM32_LSE_ENABLED FALSE
50 #define STM32_CLOCK48_REQUIRED TRUE
51 #define STM32_SW STM32_SW_PLL
52 #define STM32_PLLSRC STM32_PLLSRC_HSE
53 
54 #if (HSE_VALUE == 8000000) && (SYSCLK_FREQ == 168000000)
55 #define STM32_PLLM_VALUE 8
56 #define STM32_PLLN_VALUE 336
57 #define STM32_PLLP_VALUE 2
58 #define STM32_PLLQ_VALUE 7
59 #define STM32_CLOCK48_PLLSAI FALSE
60 #elif (HSE_VALUE == 16000000) && (SYSCLK_FREQ == 168000000)
61 #define STM32_PLLM_VALUE 16
62 #define STM32_PLLN_VALUE 336
63 #define STM32_PLLP_VALUE 2
64 #define STM32_PLLQ_VALUE 7
65 #define STM32_CLOCK48_PLLSAI FALSE
66 #elif (HSE_VALUE == 16000000) && (SYSCLK_FREQ == 180000000)
67 #define STM32_PLLM_VALUE 8
68 #define STM32_PLLN_VALUE 180
69 #define STM32_PLLP_VALUE 2
70 #define STM32_PLLQ_VALUE 2
71 #define STM32_CLOCK48_PLLSAI TRUE
72 #define STM32_PLLSAI_M_VALUE 8
73 #define STM32_PLLSAI_N_VALUE 192
74 #define STM32_PLLSAI_P_VALUE 8
75 #define STM32_PLLSAI_Q_VALUE 2
76 #else
77 #error unsupported clock combination
78 #endif
79 
80 #define STM32_HPRE STM32_HPRE_DIV1
81 #define STM32_PPRE1 STM32_PPRE1_DIV4
82 #define STM32_PPRE2 STM32_PPRE2_DIV2
83 #define STM32_RTCSEL STM32_RTCSEL_LSI
84 #define STM32_RTCPRE_VALUE 8
85 #define STM32_MCO1SEL STM32_MCO1SEL_HSI
86 #define STM32_MCO1PRE STM32_MCO1PRE_DIV1
87 #define STM32_MCO2SEL STM32_MCO2SEL_SYSCLK
88 #define STM32_MCO2PRE STM32_MCO2PRE_DIV5
89 #define STM32_I2SSRC STM32_I2SSRC_CKIN
90 #define STM32_PLLI2SN_VALUE 192
91 #define STM32_PLLI2SR_VALUE 5
92 #define STM32_PVD_ENABLE FALSE
93 #define STM32_PLS STM32_PLS_LEV0
94 #define STM32_BKPRAM_ENABLE FALSE
95 
96 /*
97  * ADC driver system settings.
98  */
99 #define STM32_ADC_ADCPRE ADC_CCR_ADCPRE_DIV4
100 #define STM32_ADC_USE_ADC1 FALSE
101 #define STM32_ADC_USE_ADC2 FALSE
102 #define STM32_ADC_USE_ADC3 FALSE
103 #define STM32_ADC_ADC1_DMA_STREAM STM32_DMA_STREAM_ID(2, 4)
104 #define STM32_ADC_ADC2_DMA_STREAM STM32_DMA_STREAM_ID(2, 2)
105 #define STM32_ADC_ADC3_DMA_STREAM STM32_DMA_STREAM_ID(2, 1)
106 #define STM32_ADC_ADC1_DMA_PRIORITY 2
107 #define STM32_ADC_ADC2_DMA_PRIORITY 2
108 #define STM32_ADC_ADC3_DMA_PRIORITY 2
109 #define STM32_ADC_IRQ_PRIORITY 6
110 #define STM32_ADC_ADC1_DMA_IRQ_PRIORITY 6
111 #define STM32_ADC_ADC2_DMA_IRQ_PRIORITY 6
112 #define STM32_ADC_ADC3_DMA_IRQ_PRIORITY 6
113 
114 /*
115  * CAN driver system settings.
116  */
117 #define STM32_CAN_USE_CAN1 FALSE
118 #define STM32_CAN_USE_CAN2 FALSE
119 #define STM32_CAN_CAN1_IRQ_PRIORITY 11
120 #define STM32_CAN_CAN2_IRQ_PRIORITY 11
121 
122 /*
123  * EXT driver system settings.
124  */
125 #define STM32_EXT_EXTI0_IRQ_PRIORITY 6
126 #define STM32_EXT_EXTI1_IRQ_PRIORITY 6
127 #define STM32_EXT_EXTI2_IRQ_PRIORITY 6
128 #define STM32_EXT_EXTI3_IRQ_PRIORITY 6
129 #define STM32_EXT_EXTI4_IRQ_PRIORITY 6
130 #define STM32_EXT_EXTI5_9_IRQ_PRIORITY 6
131 #define STM32_EXT_EXTI10_15_IRQ_PRIORITY 6
132 #define STM32_EXT_EXTI16_IRQ_PRIORITY 6
133 #define STM32_EXT_EXTI17_IRQ_PRIORITY 15
134 #define STM32_EXT_EXTI18_IRQ_PRIORITY 6
135 #define STM32_EXT_EXTI19_IRQ_PRIORITY 6
136 #define STM32_EXT_EXTI20_IRQ_PRIORITY 6
137 #define STM32_EXT_EXTI21_IRQ_PRIORITY 15
138 #define STM32_EXT_EXTI22_IRQ_PRIORITY 15
139 
140 /*
141  * GPT driver system settings.
142  */
143 #define STM32_GPT_USE_TIM1 FALSE
144 #define STM32_GPT_USE_TIM2 FALSE
145 #define STM32_GPT_USE_TIM3 FALSE
146 #define STM32_GPT_USE_TIM4 FALSE
147 #define STM32_GPT_USE_TIM5 FALSE
148 #define STM32_GPT_USE_TIM6 FALSE
149 #define STM32_GPT_USE_TIM7 FALSE
150 #define STM32_GPT_USE_TIM8 FALSE
151 #define STM32_GPT_USE_TIM9 FALSE
152 #define STM32_GPT_USE_TIM11 FALSE
153 #define STM32_GPT_USE_TIM12 FALSE
154 #define STM32_GPT_USE_TIM14 FALSE
155 #define STM32_GPT_TIM1_IRQ_PRIORITY 7
156 #define STM32_GPT_TIM2_IRQ_PRIORITY 7
157 #define STM32_GPT_TIM3_IRQ_PRIORITY 7
158 #define STM32_GPT_TIM4_IRQ_PRIORITY 7
159 #define STM32_GPT_TIM5_IRQ_PRIORITY 7
160 #define STM32_GPT_TIM6_IRQ_PRIORITY 7
161 #define STM32_GPT_TIM7_IRQ_PRIORITY 7
162 #define STM32_GPT_TIM8_IRQ_PRIORITY 7
163 #define STM32_GPT_TIM9_IRQ_PRIORITY 7
164 #define STM32_GPT_TIM11_IRQ_PRIORITY 7
165 #define STM32_GPT_TIM12_IRQ_PRIORITY 7
166 #define STM32_GPT_TIM14_IRQ_PRIORITY 7
167 
168 /*
169  * I2C driver system settings.
170  */
171 #define STM32_I2C_USE_I2C1 FALSE
172 #define STM32_I2C_USE_I2C2 FALSE
173 #define STM32_I2C_USE_I2C3 FALSE
174 #define STM32_I2C_I2C1_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 0)
175 #define STM32_I2C_I2C1_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 6)
176 #define STM32_I2C_I2C2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 2)
177 #define STM32_I2C_I2C2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7)
178 #define STM32_I2C_I2C3_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 2)
179 #define STM32_I2C_I2C3_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4)
180 #define STM32_I2C_I2C1_IRQ_PRIORITY 5
181 #define STM32_I2C_I2C2_IRQ_PRIORITY 5
182 #define STM32_I2C_I2C3_IRQ_PRIORITY 5
183 #define STM32_I2C_I2C1_DMA_PRIORITY 3
184 #define STM32_I2C_I2C2_DMA_PRIORITY 3
185 #define STM32_I2C_I2C3_DMA_PRIORITY 3
186 #define STM32_I2C_I2C1_DMA_ERROR_HOOK() chSysHalt()
187 #define STM32_I2C_I2C2_DMA_ERROR_HOOK() chSysHalt()
188 #define STM32_I2C_I2C3_DMA_ERROR_HOOK() chSysHalt()
189 
190 /*
191  * ICU driver system settings.
192  */
193 #define STM32_ICU_USE_TIM1 FALSE
194 #define STM32_ICU_USE_TIM2 FALSE
195 #define STM32_ICU_USE_TIM3 FALSE
196 #define STM32_ICU_USE_TIM4 FALSE
197 #define STM32_ICU_USE_TIM5 FALSE
198 #define STM32_ICU_USE_TIM8 FALSE
199 #define STM32_ICU_USE_TIM9 FALSE
200 #define STM32_ICU_TIM1_IRQ_PRIORITY 7
201 #define STM32_ICU_TIM2_IRQ_PRIORITY 7
202 #define STM32_ICU_TIM3_IRQ_PRIORITY 7
203 #define STM32_ICU_TIM4_IRQ_PRIORITY 7
204 #define STM32_ICU_TIM5_IRQ_PRIORITY 7
205 #define STM32_ICU_TIM8_IRQ_PRIORITY 7
206 #define STM32_ICU_TIM9_IRQ_PRIORITY 7
207 
208 /*
209  * MAC driver system settings.
210  */
211 #define STM32_MAC_TRANSMIT_BUFFERS 2
212 #define STM32_MAC_RECEIVE_BUFFERS 4
213 #define STM32_MAC_BUFFERS_SIZE 1522
214 #define STM32_MAC_PHY_TIMEOUT 100
215 #define STM32_MAC_ETH1_CHANGE_PHY_STATE TRUE
216 #define STM32_MAC_ETH1_IRQ_PRIORITY 13
217 #define STM32_MAC_IP_CHECKSUM_OFFLOAD 0
218 
219 /*
220  * PWM driver system settings.
221  */
222 #define STM32_PWM_USE_ADVANCED FALSE
223 #define STM32_PWM_USE_TIM1 FALSE
224 #define STM32_PWM_USE_TIM2 FALSE
225 #define STM32_PWM_USE_TIM3 FALSE
226 #define STM32_PWM_USE_TIM4 FALSE
227 #define STM32_PWM_USE_TIM5 FALSE
228 #define STM32_PWM_USE_TIM8 FALSE
229 #define STM32_PWM_USE_TIM9 FALSE
230 #define STM32_PWM_TIM1_IRQ_PRIORITY 7
231 #define STM32_PWM_TIM2_IRQ_PRIORITY 7
232 #define STM32_PWM_TIM3_IRQ_PRIORITY 7
233 #define STM32_PWM_TIM4_IRQ_PRIORITY 7
234 #define STM32_PWM_TIM5_IRQ_PRIORITY 7
235 #define STM32_PWM_TIM8_IRQ_PRIORITY 7
236 #define STM32_PWM_TIM9_IRQ_PRIORITY 7
237 
238 /*
239  * SERIAL driver system settings.
240  */
241 #define STM32_SERIAL_USE_USART1 FALSE
242 #define STM32_SERIAL_USE_USART2 FALSE
243 #define STM32_SERIAL_USE_USART3 FALSE
244 #define STM32_SERIAL_USE_UART4 FALSE
245 #define STM32_SERIAL_USE_UART5 FALSE
246 #define STM32_SERIAL_USE_USART6 FALSE
247 #define STM32_SERIAL_USART1_PRIORITY 12
248 #define STM32_SERIAL_USART2_PRIORITY 12
249 #define STM32_SERIAL_USART3_PRIORITY 12
250 #define STM32_SERIAL_UART4_PRIORITY 12
251 #define STM32_SERIAL_UART5_PRIORITY 12
252 #define STM32_SERIAL_USART6_PRIORITY 12
253 
254 /*
255  * SPI driver system settings.
256  */
257 #define STM32_SPI_USE_SPI1 FALSE
258 #define STM32_SPI_USE_SPI2 FALSE
259 #define STM32_SPI_USE_SPI3 FALSE
260 #define STM32_SPI_SPI1_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 0)
261 #define STM32_SPI_SPI1_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 3)
262 #define STM32_SPI_SPI2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3)
263 #define STM32_SPI_SPI2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4)
264 #define STM32_SPI_SPI3_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 0)
265 #define STM32_SPI_SPI3_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7)
266 #define STM32_SPI_SPI1_DMA_PRIORITY 1
267 #define STM32_SPI_SPI2_DMA_PRIORITY 1
268 #define STM32_SPI_SPI3_DMA_PRIORITY 1
269 #define STM32_SPI_SPI1_IRQ_PRIORITY 10
270 #define STM32_SPI_SPI2_IRQ_PRIORITY 10
271 #define STM32_SPI_SPI3_IRQ_PRIORITY 10
272 #define STM32_SPI_DMA_ERROR_HOOK(spip) chSysHalt()
273 
274 /*
275  * UART driver system settings.
276  */
277 #define STM32_UART_USE_USART1 FALSE
278 #define STM32_UART_USE_USART2 FALSE
279 #define STM32_UART_USE_USART3 FALSE
280 #define STM32_UART_USE_UART4 FALSE
281 #define STM32_UART_USE_UART5 FALSE
282 #define STM32_UART_USE_USART6 FALSE
283 #define STM32_UART_USART1_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 5)
284 #define STM32_UART_USART1_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 7)
285 #define STM32_UART_USART2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 5)
286 #define STM32_UART_USART2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 6)
287 #define STM32_UART_USART3_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 1)
288 #define STM32_UART_USART3_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 3)
289 #define STM32_UART_UART4_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 2)
290 #define STM32_UART_UART4_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 4)
291 #define STM32_UART_UART5_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 0)
292 #define STM32_UART_UART5_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7)
293 #define STM32_UART_USART6_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 2)
294 #define STM32_UART_USART6_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 7)
295 #define STM32_UART_USART1_IRQ_PRIORITY 12
296 #define STM32_UART_USART2_IRQ_PRIORITY 12
297 #define STM32_UART_USART3_IRQ_PRIORITY 12
298 #define STM32_UART_UART4_IRQ_PRIORITY 12
299 #define STM32_UART_UART5_IRQ_PRIORITY 12
300 #define STM32_UART_USART6_IRQ_PRIORITY 12
301 #define STM32_UART_USART1_DMA_PRIORITY 0
302 #define STM32_UART_USART2_DMA_PRIORITY 0
303 #define STM32_UART_USART3_DMA_PRIORITY 0
304 #define STM32_UART_UART4_DMA_PRIORITY 0
305 #define STM32_UART_UART5_DMA_PRIORITY 0
306 #define STM32_UART_USART6_DMA_PRIORITY 0
307 #define STM32_UART_DMA_ERROR_HOOK(uartp) chSysHalt()
308 
309 /*
310  * USB driver system settings.
311  */
312 #define STM32_USB_USE_OTG1 FALSE
313 #define STM32_USB_USE_OTG2 FALSE
314 #define STM32_USB_OTG1_IRQ_PRIORITY 14
315 #define STM32_USB_OTG2_IRQ_PRIORITY 14
316 #define STM32_USB_OTG1_RX_FIFO_SIZE 512
317 #define STM32_USB_OTG2_RX_FIFO_SIZE 1024
318 #define STM32_USB_OTG_THREAD_PRIO LOWPRIO
319 #define STM32_USB_OTG_THREAD_STACK_SIZE 128
320 #define STM32_USB_OTGFIFO_FILL_BASEPRI 0
321