rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
mcuconf.h
Go to the documentation of this file.
1/*
2 ChibiOS - Copyright (C) 2006..2018 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
17#ifndef MCUCONF_H
18#define MCUCONF_H
19
20/*
21 * STM32H7xx drivers configuration.
22 * The following settings override the default settings present in
23 * the various device driver implementation headers.
24 * Note that the settings for each driver only have effect if the whole
25 * driver is enabled in halconf.h.
26 *
27 * IRQ priorities:
28 * 15...0 Lowest...Highest.
29 *
30 * DMA priorities:
31 * 0...3 Lowest...Highest.
32 */
33
34#define STM32H7xx_MCUCONF
35
36// See hw_ports.mk
37#ifdef STM32H743xx
38 #define STM32H742_MCUCONF
39 #define STM32H743_MCUCONF
40 #define STM32H753_MCUCONF
41 #define STM32H745_MCUCONF
42 #define STM32H755_MCUCONF
43 #define STM32H747_MCUCONF
44 #define STM32H757_MCUCONF
45
46 #include "mcuconf_stm32h743.h"
47#endif
48#ifdef STM32H723xx
49 #define STM32H723_MCUCONF
50 #define STM32H723_MCUCONF
51 #define STM32H733_MCUCONF
52 #define STM32H725_MCUCONF
53 #define STM32H735_MCUCONF
54
55 #include "mcuconf_stm32h723.h"
56#endif
57
58// Allows LSE init to timeout and configure fallback RTC clock source in case
59#define RUSEFI_STM32_LSE_WAIT_MAX 1000000
60#define RUSEFI_STM32_LSE_WAIT_MAX_RTCSEL STM32_RTCSEL_LSI_CK
61
62/*
63 * General settings.
64 */
65#define STM32_NO_INIT FALSE
66#define STM32_TARGET_CORE 1
67
68/*
69 * IRQ system settings.
70 */
71
72#define STM32_DISABLE_EXTI0_HANDLER
73#define STM32_DISABLE_EXTI1_HANDLER
74#define STM32_DISABLE_EXTI2_HANDLER
75#define STM32_DISABLE_EXTI3_HANDLER
76#define STM32_DISABLE_EXTI4_HANDLER
77#define STM32_DISABLE_EXTI5_9_HANDLER
78#define STM32_DISABLE_EXTI10_15_HANDLER
79
80// we hijack this interrupt handler as the EXTI chained handler, see digital_input_exti.cpp
81#define STM32_I2C_I2C1_IRQ_PRIORITY 6
82
83#define STM32_IRQ_EXTI_PRIORITY CORTEX_MAXIMUM_PRIORITY
84#define STM32_IRQ_EXTI0_PRIORITY STM32_IRQ_EXTI_PRIORITY
85#define STM32_IRQ_EXTI1_PRIORITY STM32_IRQ_EXTI_PRIORITY
86#define STM32_IRQ_EXTI2_PRIORITY STM32_IRQ_EXTI_PRIORITY
87#define STM32_IRQ_EXTI3_PRIORITY STM32_IRQ_EXTI_PRIORITY
88#define STM32_IRQ_EXTI4_PRIORITY STM32_IRQ_EXTI_PRIORITY
89#define STM32_IRQ_EXTI5_9_PRIORITY STM32_IRQ_EXTI_PRIORITY
90#define STM32_IRQ_EXTI10_15_PRIORITY STM32_IRQ_EXTI_PRIORITY
91
92#define STM32_IRQ_EXTI16_PRIORITY 6
93#define STM32_IRQ_EXTI17_PRIORITY 6
94#define STM32_IRQ_EXTI18_PRIORITY 6
95#define STM32_IRQ_EXTI19_PRIORITY 6
96#define STM32_IRQ_EXTI20_21_PRIORITY 6
97
98#define STM32_IRQ_FDCAN1_PRIORITY 10
99#define STM32_IRQ_FDCAN2_PRIORITY 10
100#define STM32_IRQ_FDCAN3_PRIORITY 10
101
102#define STM32_IRQ_MDMA_PRIORITY 9
103
104#define STM32_IRQ_OCTOSPI1_PRIORITY 10
105#define STM32_IRQ_OCTOSPI2_PRIORITY 10
106
107#define STM32_IRQ_QUADSPI1_PRIORITY 10
108
109#define STM32_IRQ_SDMMC1_PRIORITY 9
110#define STM32_IRQ_SDMMC2_PRIORITY 9
111
112#define STM32_IRQ_TIM1_UP_PRIORITY 7
113#define STM32_IRQ_TIM1_CC_PRIORITY 7
114#define STM32_IRQ_TIM2_PRIORITY 7
115#define STM32_IRQ_TIM3_PRIORITY 7
116#define STM32_IRQ_TIM4_PRIORITY 7
117#define STM32_IRQ_TIM5_PRIORITY 7
118#define STM32_IRQ_TIM6_PRIORITY 7
119#define STM32_IRQ_TIM7_PRIORITY 7
120#define STM32_IRQ_TIM8_BRK_TIM12_PRIORITY 7
121#define STM32_IRQ_TIM8_UP_TIM13_PRIORITY 7
122#define STM32_IRQ_TIM8_TRGCO_TIM14_PRIORITY 7
123#define STM32_IRQ_TIM8_CC_PRIORITY 7
124#define STM32_IRQ_TIM15_PRIORITY 7
125#define STM32_IRQ_TIM16_PRIORITY 7
126#define STM32_IRQ_TIM17_PRIORITY 7
127
128#define STM32_IRQ_USART1_PRIORITY 12
129#define STM32_IRQ_USART2_PRIORITY 12
130#define STM32_IRQ_USART3_PRIORITY 12
131#define STM32_IRQ_UART4_PRIORITY 12
132#define STM32_IRQ_UART5_PRIORITY 12
133#define STM32_IRQ_USART6_PRIORITY 12
134#define STM32_IRQ_UART7_PRIORITY 12
135#define STM32_IRQ_UART8_PRIORITY 12
136#define STM32_IRQ_UART9_PRIORITY 12
137#define STM32_IRQ_USART10_PRIORITY 12
138#define STM32_IRQ_LPUART1_PRIORITY 12
139
140/*
141 * ADC driver system settings.
142 */
143#define STM32_ADC_DUAL_MODE FALSE
144#define STM32_ADC_COMPACT_SAMPLES FALSE
145#define STM32_ADC_USE_ADC12 TRUE
146
147#ifndef STM32_ADC_USE_ADC3
148#define STM32_ADC_USE_ADC3 FALSE
149#endif /* STM32_ADC_USE_ADC3 */
150
151#define STM32_ADC_ADC12_DMA_STREAM STM32_DMA_STREAM_ID_ANY
152#define STM32_ADC_ADC3_BDMA_STREAM STM32_BDMA_STREAM_ID_ANY
153#define STM32_ADC_ADC12_DMA_PRIORITY 2
154#define STM32_ADC_ADC3_DMA_PRIORITY 2
155#define STM32_ADC_ADC12_IRQ_PRIORITY 5
156#define STM32_ADC_ADC3_IRQ_PRIORITY 5
157#define STM32_ADC_ADC12_CLOCK_MODE ADC_CCR_CKMODE_AHB_DIV4
158#define STM32_ADC_ADC3_CLOCK_MODE ADC_CCR_CKMODE_AHB_DIV4
159
160/*
161 * CAN driver system settings.
162 */
163#define STM32_CAN_USE_FDCAN1 TRUE
164#define STM32_CAN_USE_FDCAN2 TRUE
165
166/*
167 * DAC driver system settings.
168 */
169#define STM32_DAC_DUAL_MODE FALSE
170#define STM32_DAC_USE_DAC1_CH1 FALSE
171#define STM32_DAC_USE_DAC1_CH2 FALSE
172#define STM32_DAC_DAC1_CH1_IRQ_PRIORITY 10
173#define STM32_DAC_DAC1_CH2_IRQ_PRIORITY 10
174#define STM32_DAC_DAC1_CH1_DMA_PRIORITY 2
175#define STM32_DAC_DAC1_CH2_DMA_PRIORITY 2
176#define STM32_DAC_DAC1_CH1_DMA_STREAM STM32_DMA_STREAM_ID_ANY
177#define STM32_DAC_DAC1_CH2_DMA_STREAM STM32_DMA_STREAM_ID_ANY
178
179/*
180 * GPT driver system settings.
181 */
182#define STM32_GPT_USE_TIM1 FALSE
183#define STM32_GPT_USE_TIM2 FALSE
184#define STM32_GPT_USE_TIM3 TRUE
185#define STM32_GPT_USE_TIM4 FALSE
186#define STM32_GPT_USE_TIM5 FALSE
187#define STM32_GPT_USE_TIM6 TRUE
188#define STM32_GPT_USE_TIM7 FALSE
189#define STM32_GPT_USE_TIM8 FALSE
190#define STM32_GPT_USE_TIM12 FALSE
191#define STM32_GPT_USE_TIM13 FALSE
192#define STM32_GPT_USE_TIM14 FALSE
193#define STM32_GPT_USE_TIM15 FALSE
194#define STM32_GPT_USE_TIM16 FALSE
195#define STM32_GPT_USE_TIM17 FALSE
196
197/*
198 * I2C driver system settings.
199 */
200#define STM32_I2C_USE_I2C1 FALSE
201#define STM32_I2C_USE_I2C2 FALSE
202#define STM32_I2C_USE_I2C3 FALSE
203#define STM32_I2C_USE_I2C4 FALSE
204#define STM32_I2C_BUSY_TIMEOUT 50
205#define STM32_I2C_I2C1_RX_DMA_STREAM STM32_DMA_STREAM_ID_ANY
206#define STM32_I2C_I2C1_TX_DMA_STREAM STM32_DMA_STREAM_ID_ANY
207#define STM32_I2C_I2C2_RX_DMA_STREAM STM32_DMA_STREAM_ID_ANY
208#define STM32_I2C_I2C2_TX_DMA_STREAM STM32_DMA_STREAM_ID_ANY
209#define STM32_I2C_I2C3_RX_DMA_STREAM STM32_DMA_STREAM_ID_ANY
210#define STM32_I2C_I2C3_TX_DMA_STREAM STM32_DMA_STREAM_ID_ANY
211#define STM32_I2C_I2C4_RX_BDMA_STREAM STM32_BDMA_STREAM_ID_ANY
212#define STM32_I2C_I2C4_TX_BDMA_STREAM STM32_BDMA_STREAM_ID_ANY
213// STM32_I2C_I2C1_IRQ_PRIORITY is defined above, reused for fast EXTI handoff
214#define STM32_I2C_I2C2_IRQ_PRIORITY 5
215#define STM32_I2C_I2C3_IRQ_PRIORITY 5
216#define STM32_I2C_I2C4_IRQ_PRIORITY 5
217#define STM32_I2C_I2C1_DMA_PRIORITY 3
218#define STM32_I2C_I2C2_DMA_PRIORITY 3
219#define STM32_I2C_I2C3_DMA_PRIORITY 3
220#define STM32_I2C_I2C4_DMA_PRIORITY 3
221#define STM32_I2C_DMA_ERROR_HOOK(i2cp) osalSysHalt("DMA failure")
222
223/*
224 * ICU driver system settings.
225 */
226#ifndef STM32_ICU_USE_TIM1
227#define STM32_ICU_USE_TIM1 FALSE
228#endif
229
230#ifndef STM32_ICU_USE_TIM2
231#define STM32_ICU_USE_TIM2 TRUE
232#endif
233
234#ifndef STM32_ICU_USE_TIM3
235#define STM32_ICU_USE_TIM3 FALSE
236#endif
237
238#ifndef STM32_ICU_USE_TIM4
239#define STM32_ICU_USE_TIM4 FALSE
240#endif
241
242#ifndef STM32_ICU_USE_TIM5
243#define STM32_ICU_USE_TIM5 FALSE
244#endif
245
246#ifndef STM32_ICU_USE_TIM8
247#define STM32_ICU_USE_TIM8 FALSE
248#endif
249
250#ifndef STM32_ICU_USE_TIM9
251#define STM32_ICU_USE_TIM9 FALSE
252#endif
253
254#define STM32_ICU_USE_TIM12 FALSE
255#define STM32_ICU_USE_TIM13 FALSE
256#define STM32_ICU_USE_TIM14 FALSE
257#define STM32_ICU_USE_TIM15 FALSE
258#define STM32_ICU_USE_TIM16 FALSE
259#define STM32_ICU_USE_TIM17 FALSE
260
261/*
262 * MAC driver system settings.
263 */
264#define STM32_MAC_TRANSMIT_BUFFERS 4
265#define STM32_MAC_RECEIVE_BUFFERS 4
266#define STM32_MAC_BUFFERS_SIZE 1522
267#define STM32_MAC_PHY_TIMEOUT 100
268#define STM32_MAC_ETH1_CHANGE_PHY_STATE TRUE
269#define STM32_MAC_ETH1_IRQ_PRIORITY 13
270#define STM32_MAC_IP_CHECKSUM_OFFLOAD 0
271
272/*
273 * PWM driver system settings.
274 */
275#define STM32_PWM_USE_TIM1 FALSE
276#define STM32_PWM_USE_TIM2 FALSE
277
278#ifndef STM32_PWM_USE_TIM3
279#define STM32_PWM_USE_TIM3 FALSE
280#endif
281
282#ifndef STM32_PWM_USE_TIM4
283#define STM32_PWM_USE_TIM4 TRUE
284#endif
285
286#ifndef STM32_PWM_USE_TIM5
287#define STM32_PWM_USE_TIM5 TRUE
288#endif
289
290#ifndef STM32_PWM_USE_TIM8
291#define STM32_PWM_USE_TIM8 TRUE
292#endif
293
294#define STM32_PWM_USE_TIM12 FALSE
295#define STM32_PWM_USE_TIM13 FALSE
296#define STM32_PWM_USE_TIM14 FALSE
297#define STM32_PWM_USE_TIM15 FALSE
298#define STM32_PWM_USE_TIM16 FALSE
299#define STM32_PWM_USE_TIM17 FALSE
300
301/*
302 * RTC driver system settings.
303 */
304#define STM32_RTC_PRESA_VALUE 32
305#define STM32_RTC_PRESS_VALUE 1024
306#define STM32_RTC_CR_INIT 0
307#define STM32_RTC_TAMPCR_INIT 0
308
309/*
310 * SDC driver system settings.
311 */
312#define STM32_SDC_USE_SDMMC1 TRUE
313#define STM32_SDC_USE_SDMMC2 FALSE
314#define STM32_SDC_SDMMC_UNALIGNED_SUPPORT TRUE
315#define STM32_SDC_SDMMC_WRITE_TIMEOUT 1000000
316#define STM32_SDC_SDMMC_READ_TIMEOUT 1000000
317#define STM32_SDC_SDMMC_CLOCK_DELAY 10
318#define STM32_SDC_SDMMC_PWRSAV TRUE
319
320/*
321 * SERIAL driver system settings.
322 */
323#define STM32_SERIAL_USE_USART1 TRUE
324#define STM32_SERIAL_USE_USART2 FALSE
325#define STM32_SERIAL_USE_USART3 FALSE
326#define STM32_SERIAL_USE_UART4 FALSE
327#define STM32_SERIAL_USE_UART5 FALSE
328#define STM32_SERIAL_USE_USART6 TRUE
329#define STM32_SERIAL_USE_UART7 FALSE
330#define STM32_SERIAL_USE_UART8 FALSE
331#define STM32_SERIAL_USE_LPUART1 FALSE
332
333/*
334 * SPI driver system settings.
335 */
336#ifndef STM32_SPI_USE_SPI1
337#define STM32_SPI_USE_SPI1 TRUE
338#endif
339#ifndef STM32_SPI_USE_SPI2
340#define STM32_SPI_USE_SPI2 TRUE
341#endif
342#ifndef STM32_SPI_USE_SPI3
343#define STM32_SPI_USE_SPI3 TRUE
344#endif
345#ifndef STM32_SPI_USE_SPI4
346#define STM32_SPI_USE_SPI4 FALSE
347#endif
348#ifndef STM32_SPI_USE_SPI5
349#define STM32_SPI_USE_SPI5 FALSE
350#endif
351#ifndef STM32_SPI_USE_SPI6
352#define STM32_SPI_USE_SPI6 FALSE
353#endif
354
355#define STM32_SPI_SPI1_RX_DMA_STREAM STM32_DMA_STREAM_ID_ANY
356#define STM32_SPI_SPI1_TX_DMA_STREAM STM32_DMA_STREAM_ID_ANY
357#define STM32_SPI_SPI2_RX_DMA_STREAM STM32_DMA_STREAM_ID_ANY
358#define STM32_SPI_SPI2_TX_DMA_STREAM STM32_DMA_STREAM_ID_ANY
359#define STM32_SPI_SPI3_RX_DMA_STREAM STM32_DMA_STREAM_ID_ANY
360#define STM32_SPI_SPI3_TX_DMA_STREAM STM32_DMA_STREAM_ID_ANY
361#define STM32_SPI_SPI4_RX_DMA_STREAM STM32_DMA_STREAM_ID_ANY
362#define STM32_SPI_SPI4_TX_DMA_STREAM STM32_DMA_STREAM_ID_ANY
363#define STM32_SPI_SPI5_RX_DMA_STREAM STM32_DMA_STREAM_ID_ANY
364#define STM32_SPI_SPI5_TX_DMA_STREAM STM32_DMA_STREAM_ID_ANY
365#define STM32_SPI_SPI6_RX_BDMA_STREAM STM32_BDMA_STREAM_ID_ANY
366#define STM32_SPI_SPI6_TX_BDMA_STREAM STM32_BDMA_STREAM_ID_ANY
367#define STM32_SPI_SPI1_DMA_PRIORITY 1
368#define STM32_SPI_SPI2_DMA_PRIORITY 1
369#define STM32_SPI_SPI3_DMA_PRIORITY 1
370#define STM32_SPI_SPI4_DMA_PRIORITY 1
371#define STM32_SPI_SPI5_DMA_PRIORITY 1
372#define STM32_SPI_SPI6_DMA_PRIORITY 1
373#define STM32_SPI_SPI1_IRQ_PRIORITY 10
374#define STM32_SPI_SPI2_IRQ_PRIORITY 10
375#define STM32_SPI_SPI3_IRQ_PRIORITY 10
376#define STM32_SPI_SPI4_IRQ_PRIORITY 10
377#define STM32_SPI_SPI5_IRQ_PRIORITY 10
378#define STM32_SPI_SPI6_IRQ_PRIORITY 10
379#define STM32_SPI_DMA_ERROR_HOOK(spip) osalSysHalt("DMA failure")
380
381/*
382 * ST driver system settings.
383 */
384#define STM32_ST_IRQ_PRIORITY 8
385#define STM32_ST_USE_TIMER 2
386
387/*
388 * TRNG driver system settings.
389 */
390#define STM32_TRNG_USE_RNG1 FALSE
391
392/*
393 * UART driver system settings.
394 */
395#define STM32_UART_USE_USART1 FALSE
396
397#ifndef STM32_UART_USE_USART2
398#define STM32_UART_USE_USART2 FALSE
399#endif
400
401#define STM32_UART_USE_USART3 TRUE
402#define STM32_UART_USE_UART4 FALSE
403#define STM32_UART_USE_UART5 FALSE
404#define STM32_UART_USE_USART6 FALSE
405#define STM32_UART_USE_UART7 FALSE
406#define STM32_UART_USE_UART8 FALSE
407#define STM32_UART_USART1_RX_DMA_STREAM STM32_DMA_STREAM_ID_ANY
408#define STM32_UART_USART1_TX_DMA_STREAM STM32_DMA_STREAM_ID_ANY
409#define STM32_UART_USART2_RX_DMA_STREAM STM32_DMA_STREAM_ID_ANY
410#define STM32_UART_USART2_TX_DMA_STREAM STM32_DMA_STREAM_ID_ANY
411#define STM32_UART_USART3_RX_DMA_STREAM STM32_DMA_STREAM_ID_ANY
412#define STM32_UART_USART3_TX_DMA_STREAM STM32_DMA_STREAM_ID_ANY
413#define STM32_UART_UART4_RX_DMA_STREAM STM32_DMA_STREAM_ID_ANY
414#define STM32_UART_UART4_TX_DMA_STREAM STM32_DMA_STREAM_ID_ANY
415#define STM32_UART_UART5_RX_DMA_STREAM STM32_DMA_STREAM_ID_ANY
416#define STM32_UART_UART5_TX_DMA_STREAM STM32_DMA_STREAM_ID_ANY
417#define STM32_UART_USART6_RX_DMA_STREAM STM32_DMA_STREAM_ID_ANY
418#define STM32_UART_USART6_TX_DMA_STREAM STM32_DMA_STREAM_ID_ANY
419#define STM32_UART_UART7_RX_DMA_STREAM STM32_DMA_STREAM_ID_ANY
420#define STM32_UART_UART7_TX_DMA_STREAM STM32_DMA_STREAM_ID_ANY
421#define STM32_UART_UART8_RX_DMA_STREAM STM32_DMA_STREAM_ID_ANY
422#define STM32_UART_UART8_TX_DMA_STREAM STM32_DMA_STREAM_ID_ANY
423#define STM32_UART_USART1_DMA_PRIORITY 0
424#define STM32_UART_USART2_DMA_PRIORITY 0
425#define STM32_UART_USART3_DMA_PRIORITY 0
426#define STM32_UART_UART4_DMA_PRIORITY 0
427#define STM32_UART_UART5_DMA_PRIORITY 0
428#define STM32_UART_USART6_DMA_PRIORITY 0
429#define STM32_UART_UART7_DMA_PRIORITY 0
430#define STM32_UART_UART8_DMA_PRIORITY 0
431#define STM32_UART_DMA_ERROR_HOOK(uartp) osalSysHalt("DMA failure")
432
433/*
434 * WDG driver system settings.
435 */
436#define STM32_WDG_USE_IWDG TRUE
437
438/*
439 * WSPI driver system settings.
440 */
441#define STM32_WSPI_USE_QUADSPI1 FALSE
442#define STM32_WSPI_QUADSPI1_PRESCALER_VALUE 1
443#define STM32_WSPI_QUADSPI1_MDMA_CHANNEL STM32_MDMA_CHANNEL_ID_ANY
444#define STM32_WSPI_QUADSPI1_MDMA_PRIORITY 1
445#define STM32_WSPI_MDMA_ERROR_HOOK(qspip) osalSysHalt("MDMA failure")
446
447#define STM32_SYSCLK STM32_SYS_CK
448
449#ifndef ENABLE_AUTO_DETECT_HSE
450 #define ENABLE_AUTO_DETECT_HSE TRUE
451#endif
452
453#endif /* MCUCONF_H */