2019-09-04 12:21 AM
Hello, ST experts
STM32F415 runs at 168MHz speed on custom board. And UART1 is used between MCU and a peripheral. The UART baudrate is 460800bps. And UART1 global interrupt is the highest priority interrupt except Non maskable interrupt and Hard Fault interrupt. HAL_UART_Receive_IT keeps running to receive data one byte a time from peripharal. But overrun error keeps on happening, what might be the reason?
Best Regards
Yang
Solved! Go to Solution.
2019-09-04 01:21 AM
No, they have same pre-emption priority so one can not pre-empt the other.
2019-09-04 12:56 AM
With those frequency and baudrate the MCU has ~3600 cycles to execute HAL's interrupt code and your callback function for each byte. If one of those takes too long then overruns will happen. Try to optimize your callback, or if it's HAL's issue try to use the LL library instead, or use DMA.
2019-09-04 01:06 AM
Hello
But the question is if another GPIO interrupt raises at an interval of 4ms, there is no Overrun error at all. But if the GPIO interrupt raises at an interval of 0.5ms, the overrun error appears, I really don't know why. This GPIO interrupt has a low priority than UART.
BR
Yang
2019-09-04 01:13 AM
What priority group are you using in NVIC settings? I mean, give attention to interrupt pre-emption settings. E.g. maybe your low priority GPIO interrupt is running and the UART interrupt occurs and it can not pre-empt GPIO interrupt because of priority group settings.
2019-09-04 01:18 AM
Hello
The USART1 pre-emption priority is 0, sub priority is 0. The GPIO pre-emption priority is 0, sub priority is 1. Is that correct?
BR
Yang
2019-09-04 01:21 AM
No, they have same pre-emption priority so one can not pre-empt the other.