cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F303 UART 3 receiver hang without RX interrupt after run 1-2 hours.

Jiannong Zhou
Associate II

I am using my boards with STM32F303VBT6, There is a UART 3 hang after run for 1-2 hours. There is no UART interrupt of the receiver. I monitored the RS232 signal is there.

After reset the receiver board, the receiving date can be recovered.

What is the possible reason to cause no UART 3 interrupt?

Best regards,

Jiannong

11 REPLIES 11

>>What is the possible reason to cause no UART 3 interrupt?

Some error status' flagged which you fail to clear.

Show USART3->SR in these situations

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Jiannong Zhou
Associate II

Thanks Tesla for your suggestion. I will check it.

Things like framing, parity, noise, etc

Get flagged, and need clearing indivdually.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Jiannong Zhou
Associate II

Hi Tesla,

When the issue happened, HAL_UART_RxCpltCallback() does not call back again.

// UART call back

void HAL_UART_RxCpltCallback (UART_HandleTypeDef *huart)

{

if(huart->Instance == USART3)

{

....

}

}

How to check ISR, NE, ORE, FE and clear them?

Jiannong

Jiannong Zhou
Associate II

Hi Tesla,

  1. Normal work: ISR = 0x6210D0
  2. Issue happens: ISR = 0x6210F8

Jiannong

Jiannong Zhou
Associate II

Hi Tesla,

The difference is D3 and D5 set.

USART_ISR_ORE  ((uint32_t)0x00000008) /*!< OverRun Error */

USART_ISR_RXNE ((uint32_t)0x00000020) /*!< Read Data Register Not Empty */

I try to set USART3->ISR = 0. but it does not work.

  1. How to clear these bits?
  2. Any bits to be cleared in void HAL_UART_RxCpltCallback (UART_HandleTypeDef *huart) function

Jiannong

I believe all of this is covered in the Reference Manual for the parts

char GetChar(void)
{
  if (USART_RS232->ISR & USART_ISR_ORE) // Overrun Error
    USART_RS232->ICR = USART_ICR_ORECF;
  if (USART_RS232->ISR & USART_ISR_NE) // Noise Err
    USART_RS232->ICR = USART_ICR_NCF;
  if (USART_RS232->ISR & USART_ISR_FE) // Framing Error
    USART_RS232->ICR = USART_ICR_FECF;
 
  if ((USART_RS232->ISR & USART_ISR_RXNE) == 0)
    return(0);
 
  return((char)(USART_RS232->RDR & 0xFF));
} 

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Jiannong Zhou
Associate II

Hi Tesla,

Thank you so much for your detailed information. I will try it out.

Jiannong

Jiannong Zhou
Associate II

Hi Tesla,

I tested it to clear the error bits - USART_ISR_ORE and USART_ISR_RXNE. it can run over night. No problems.

I have two questions,

  1. What does cause USART_ISR_ORE - over run error?
  2. Is it correct that USART_ISR_RXNE error is caused by USART_ISR_ORE error?

Jiannong