2024-03-13 02:22 AM
Dear Mr. or Ms.
When I tried to clear IT flag of USART_ISR_RXNE_RXFNE, I can't find any fuction to do it.
In stm32g4xxx_ll_usart.h, I can find fuction named LL_USART_IsActiveFlag_RXNE_RXFNE() but there's no function like LL_USART_ClearFlag_RXNE_RXFNE() .
Do I need to clear corresponding IT flag ? Or it would be cleared automatically?
Thanks and Wishes
Solved! Go to Solution.
2024-03-13 06:58 AM - edited 2024-03-13 06:59 AM
LL_USART_ReceiveData8 or LL_USART_ReceiveData9
To discard received data: LL_USART_RequestRxDataFlush
2024-03-13 03:00 AM
Hello @yuanyuan, welcome to ST Community,
According to RM: "RXFNE is cleared when the RXFIFO is empty. The RXFNE flag can also be cleared by writing 1 to the RXFRQ in the USART_RQR register"
So by writing 1 to USART_RQR_RXFRQ, you can clear the flag.
You can use SET_BIT(USARTx->RQR, (uint16_t)USART_RQR_RXFRQ) in stm32g4xxx_ll_usart.h.
Hope that helps!
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2024-03-13 06:44 AM
Typically, RXNE is cleared by reading the data in the FIFO.
2024-03-13 06:58 AM - edited 2024-03-13 06:59 AM
LL_USART_ReceiveData8 or LL_USART_ReceiveData9
To discard received data: LL_USART_RequestRxDataFlush
2024-03-13 07:07 AM
Thank you for your prompt reply.
2024-03-13 07:08 AM
thank you for your kind reply.
2024-03-13 07:11 AM
that's good design.
your kind reply helped me on my confusion.
thanks