AnsweredAssumed Answered

Stuck in UART_WaitOnFlagUntilTimeout HAL lib

Question asked by kecskes.gergely on Jan 4, 2016
Latest reply on Jan 6, 2016 by kecskes.gergely
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 the UART_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!