AnsweredAssumed Answered

HAL_UART_Receive() timeout issue

Question asked by Dick Lin on May 24, 2018
Latest reply on May 25, 2018 by Dick Lin

Hi,

I am using Nucleo-144 board connecting UART to my TI device using 250000 baudrate. I always got timeout no matter what timeout using.

Seems the issue is UART_WaitOnFlagUntilTimeout() failed and return HAL_TIMEOUT.

 

if(UART_WaitOnFlagUntilTimeout(huart, UART_FLAG_RXNE, RESET, tickstart, Timeout) != HAL_OK)
{
return HAL_TIMEOUT;
}

 

  while((__HAL_UART_GET_FLAG(huart, Flag) ? SET : RESET) == Status)

 

#define __HAL_UART_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->ISR & (__FLAG__)) == (__FLAG__))

 

Above are the code checking timeout. 

 

Reading the HAL user's manual, seems HAL_UART_Receive() need to enable FIFO mode. Is there any reference code to enable FIFO mode or DMA mode? I am using the Cube generated code, and reference to other code. Haven't found any useful example yet.

 

Thanks,

****

Outcomes