Skip to main content
Ijaz Ahmad
Associate II
April 24, 2018
Question

STM HAL Libraries HAL_Usart_Init() function for Asynchronous communication

  • April 24, 2018
  • 0 replies
  • 620 views
Posted on April 24, 2018 at 12:30

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

https://community.st.com/0D50X00009XkYJ8SAN

 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.  

#kit-stm32f4-discovery #hal-usart
This topic has been closed for replies.