Skip to main content
Explorer
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

    This topic has been closed for replies.
    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!

    yuanyuanAuthor
    Explorer
    March 13, 2024

    Thank you for your prompt reply.

    Super User
    March 13, 2024

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

    yuanyuanAuthor
    Explorer
    March 13, 2024

    that's good design.

    your kind reply helped me on my confusion.

    thanks

    Pavel A.Answer
    Super User
    March 13, 2024

    LL_USART_ReceiveData8 or LL_USART_ReceiveData9

    To discard received data: LL_USART_RequestRxDataFlush

     

    yuanyuanAuthor
    Explorer
    March 13, 2024

    thank you for your kind reply.