AnsweredAssumed Answered

STM HAL Libraries HAL_Usart_Init() function for Asynchronous communication

Question asked by Ijaz Ahmad on Apr 24, 2018

Hi, I am trying to configure USART3 on STM324-Discovery for asynchronous communication. As i am configuring U(S)ART so I imported USART HAL libraries not UART libraries. But when i program USART with HAL_Usart_init function, the HAL_Usart_Receive() seems to be always receiving i.e. there is always some data in DR register. but when i do it with HAL_Uart_Init(), every thing seems to be working OK. The reference manual doesn't mention that HAL_USART_Init function can't be used for asynchronous communication.

However THIS port mentions:

 

- For HAL use, in order to use USART2 in Asynchronous mode, you should use HAL_UART_xxx APIs, with USART2 instance. 

 

Is it true? Is there a reason behined? 

I looked back into background register settings. both methods configure registers similarly except the OVER8 bit which is enabled in HAL_Usart_Init() function.  

Outcomes