AnsweredAssumed Answered

Bug in USART_GetITStatus() re/ USART_IT_ORE?

Question asked by raymond.alexandre on Jun 18, 2014
Latest reply on Sep 30, 2014 by waclawek.jan
Could someone please confirm the following issue ?

DM00031936-Cortex-M0_manual.pdf, p.706/914 states that:
"ORE: Overrun error (...) An interrupt is generated if RXNEIE=1 or EIE = 1 in the USARTx_CR1 register."

The hardware indeed appears to work that way, as I do indeed get ORE interrupts when only RXNEIE is enabled.

Now, in stm32f0xx_usart.c/.h:
since USART_IT_ORE is defined as 0x00030300, USART_GetITStatus() gets its itmask from USARTx->CR3, bit 0 (which corresponds to EIE).

Therefore, contrary to what is stated in the documentation, RXNEIE is never checked, and USART_GetITStatus(..., USART_IT_ORE) will always return RESET when called from an ISR triggered by an ORE condition while EIE is disabled, even if RXNEIE is enabled.

Now, if EIE=0 and RXNEIE=1, this is a big problem if USART_GetITStatus(..., USART_IT_ORE) is used to detect and reset the pending ORE interrupt: it will never catch the interrupt condition and the ISR will keep being called, freezing the MCU.

I believe this is the problem being encountered in the following threads:

- [DEAD LINK /public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/USART%20ORE%3D1%2c%20but%20RXNE%3D0&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=1049]thread 1
- [DEAD LINK /public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/two%20usart%20problem&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=3891]thread 2