cancel
Showing results for 
Search instead for 
Did you mean: 

Can't find LL function to clear USART_ISR_RXNE_RXFNE

yuanyuan
Associate II

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

1 ACCEPTED SOLUTION

Accepted Solutions
Pavel A.
Evangelist III

LL_USART_ReceiveData8 or LL_USART_ReceiveData9

To discard received data: LL_USART_RequestRxDataFlush

 

View solution in original post

6 REPLIES 6
Sarra.S
ST Employee

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.

TDK
Guru

Typically, RXNE is cleared by reading the data in the FIFO.

If you feel a post has answered your question, please click "Accept as Solution".
Pavel A.
Evangelist III

LL_USART_ReceiveData8 or LL_USART_ReceiveData9

To discard received data: LL_USART_RequestRxDataFlush

 

Thank you for your prompt reply.

thank you for your kind reply.

that's good design.

your kind reply helped me on my confusion.

thanks