Skip to main content
Associate
March 13, 2024
Solved

Can't find LL function to clear USART_ISR_RXNE_RXFNE

  • March 13, 2024
  • 3 replies
  • 1783 views

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

Best answer by Pavel A.

LL_USART_ReceiveData8 or LL_USART_ReceiveData9

To discard received data: LL_USART_RequestRxDataFlush

 

3 replies

ST Employee
March 13, 2024

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.
yuanyuanAuthor
Associate
March 13, 2024

Thank you for your prompt reply.

TDK
Super User
March 13, 2024

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""."
yuanyuanAuthor
Associate
March 13, 2024

that's good design.

your kind reply helped me on my confusion.

thanks

Pavel A.
Pavel A.Answer
Super User
March 13, 2024

LL_USART_ReceiveData8 or LL_USART_ReceiveData9

To discard received data: LL_USART_RequestRxDataFlush

 

yuanyuanAuthor
Associate
March 13, 2024

thank you for your kind reply.