Skip to main content
kecskesgery
Associate III
January 4, 2016
Question

Stuck in UART_WaitOnFlagUntilTimeout HAL lib

  • January 4, 2016
  • 13 replies
  • 8615 views
Posted on January 04, 2016 at 18:38

Hello there!

I'm trying to communicate with the STM spwf01sa wifi module via UART. At first, it works for about 10-15 minutes, then the software stucks, right after the HAL_UART_Receive, in theUART_WaitOnFlagUntilTimeout function. What is actually happening, is that it never quits the while loop, because, for some reason, the HAL_GetTick()'s value wont change (HAL_Init gets called up uppon software start).

static HAL_StatusTypeDef UART_WaitOnFlagUntilTimeout(UART_HandleTypeDef *huart, uint32_t Flag, FlagStatus Status, uint32_t Timeout)
{
uint32_t tickstart = 0;
/* Get tick */ 
tickstart = HAL_GetTick();
/* Wait until flag is set */
if(Status == RESET)
{
while(__HAL_UART_GET_FLAG(huart, Flag) == RESET)
{
/* Check for the Timeout */
if(Timeout != HAL_MAX_DELAY)
{
if((Timeout == 0)||((HAL_GetTick() - tickstart ) > Timeout))
{
/* Disable TXE, RXNE, PE and ERR (Frame error, noise error, overrun error) interrupts for the interrupt process */

See, because the last IF condition never recieves true value, the whole wait cycle wont quit this way. My question is that, is it a known issue, a bug in the Cube lib? Or can I bypass it somehow? Also, why does not work the HAL_GetTick function? Thanks for the help in advanced! #uart #irq #clive1 #uartwait
This topic has been closed for replies.

13 replies

BRutt.1
Visitor II
February 10, 2023

I was able to solve my issue by updating the stm32f4xx_hal_msp.c. Make sure the peripherals are being enabled correctly.