2022-08-31 06:33 AM
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
2022-08-31 06:37 AM
>>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
2022-08-31 04:36 PM
Thanks Tesla for your suggestion. I will check it.
2022-08-31 04:55 PM
Things like framing, parity, noise, etc
Get flagged, and need clearing indivdually.
2022-09-01 06:31 AM
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
2022-09-01 07:12 AM
Hi Tesla,
Jiannong
2022-09-01 07:57 AM
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.
Jiannong
2022-09-01 08:14 AM
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));
}
2022-09-01 08:25 AM
Hi Tesla,
Thank you so much for your detailed information. I will try it out.
Jiannong
2022-09-02 07:01 PM
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,
Jiannong