Skip to main content
msemegen
Associate III
May 28, 2024
Question

UART_CheckIdleState

  • May 28, 2024
  • 2 replies
  • 1033 views

Hi,

Recently, while reviewing the code for USART handling, I came across the function UART_CheckIdleState. It is called at the end of the peripheral initialization. The name suggests that it checks the IDLE state, but the implementation does something else (checking the TEACK and REACK flag states). I looked a bit deeper and, apart from some differences in implementation, this pattern is repeated across different families of microcontrollers. So why such a name for this function?

Best,
msemegen

2 replies

Pavel A.
Super User
May 28, 2024

This function is not related to "RX idle" or "receive timeout" feature. It just checks that the initialization of the UART is complete and it is ready to work. No idea why they named it so. See in the RM what exactly the TEACK and REACK flags mean.

 

 

 

Guenael Cadier
ST Employee
May 29, 2024

I confirm @Pavel A. statement. This function aims to check TEACK/REACK status in order to conclude initialisation is properly done. No link with Idle line detection on RX.
I acknowledge that function name might not be the most appropriate one.
Regards