AnsweredAssumed Answered

STM32F0 Correct way to use HAL_UART_Receive_IT?

Question asked by seed on Sep 9, 2015
Latest reply on Sep 10, 2015 by seed
Hi,

I have read some of the previous related issues, but I am still confused. How do I use the uart interrupts in a correct way (using hal)? I need to receive each single character since don't know the length.
I have modified the UART TwoBoards_ComIT example to a dummy rx application that doesn't do anything except beeing in receive mode. The application will get stuck if I send more than 3 characters(I tested from realTerm). Sending each character one by one works fine.

while(1)
{    
  UartReady = RESET;
  if(HAL_UART_Receive_IT(&UartHandle, (uint8_t *)aRxBuffer, 1) != HAL_OK)
  {
    Error_Handler();
  }
  while (UartReady != SET)
  {
      BSP_LED_On(LED2);
      HAL_Delay(100);
      BSP_LED_Off(LED2);
      HAL_Delay(100);
      BSP_LED_On(LED2);
      HAL_Delay(100);
      BSP_LED_Off(LED2);
      HAL_Delay(500);
  }
}

void HAL_UART_RxCpltCallback(UART_HandleTypeDef *UartHandle)
{
    UartReady = SET;
}

Outcomes