12222 views|1 replies

2865

Posts

4

Resources
The OP
 

Is the STM32 library function HAL_UART_Receive blocking? [Copy link]

Today I am testing STM32H743, mainly testing the reception of UART3 serial port, referring to ST company's routine material "UART communication on STM32 Microcontrollers using HAL"
  1. /* USER CODE END Header_StartTask04 */ void StartTask04(void const * argument) { /* USER CODE BEGIN StartTask04 */ /* Infinite loop */ for(;;) { HAL_GPIO_TogglePin(LED3_GPIO_Port,LED3_Pin); char in[8]; HAL_UART_Receive(&huart3, (uint8_t *)in, 8, 0); HAL_UART_Transmit(&huart3, (uint8_t *)in, 8, 1); } /* USER CODE END StartTask04 */ }
复制代码
I found that this function is being executed continuously. It is said on the Internet that the HAL_UART_Receive function is blocked. Why does it keep executing?

This post is from stm32/stm8

Latest reply

1. The HAL library communication transceiver has two interfaces. For example, the receiving interface is HAL_XXXX_Receive, which is a polling blocking interface. The parameter input Timeout is the polling blocking time. The other is HAL_XXXX_Receive_IT or _DMA, which is not an interrupt interface and needs to be completed with handle. 2. The HAL_UART_Receive(&huart3, (uint8_t *)in, 8, 0); posted by the original poster has Timeout of 0, which means that each tick only checks once whether the receiving completion flag is set.  Details Published on 2019-2-26 13:38
 

1366

Posts

6

Resources
2
 
1. The HAL library communication transceiver has two interfaces. For example, the receiving interface is HAL_XXXX_Receive, which is a polling blocking interface. The parameter input Timeout is the polling blocking time. The other is HAL_XXXX_Receive_IT or _DMA, which is not an interrupt interface and needs to be completed with handle. 2. The HAL_UART_Receive(&huart3, (uint8_t *)in, 8, 0); posted by the original poster has Timeout of 0, which means that each tick only checks once whether the receiving completion flag is set.
This post is from stm32/stm8
 
Personal signature

1084534438 欢迎交流  [加油,一切皆有可能]

 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list