AnsweredAssumed Answered

STM32L0 board USART IRQ

Question asked by narsutis.dainius on Jan 10, 2016
Latest reply on Jan 19, 2016 by narsutis.dainius
Hi everyone,

I am trying to connect a nucleo board to an ESP8266-01WiFi board using UART1, I've used the STM32Cube to generate the project. I've added the NVIC and there is a USART1_IRQHandler function generated. However, it does not seem to get called each time there is something in the DR register.

Also I've noticed that the function get stuck after it receives the first item.

This is my while inside the main.c
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
  HAL_UART_Transmit(&huart1,ap_command,sizeof(ap_command),2000);
  __HAL_UART_FLUSH_DRREGISTER(&huart1);
  /* USER CODE END WHILE */
         
/* USER CODE BEGIN 3 */
 
        hal_states = HAL_UART_GetState(&huart1);       
         
        HAL_Delay(1000);
 
}
/* USER CODE END 3 */



This is my IRQ function

/**
* @brief This function handles USART1 global interrupt / USART1 wake-up interrupt through EXTI line 25.
*/
void USART1_IRQHandler(void)
{
  /* USER CODE BEGIN USART1_IRQn 0 */
     
  /* USER CODE END USART1_IRQn 0 */
  HAL_UART_IRQHandler(&huart1);
  /* USER CODE BEGIN USART1_IRQn 1 */
 
    if(HAL_UART_Receive(&huart1,rx_buffer,BUFFER_SIZE,500) != HAL_OK)
    {
        hal_state = HAL_UART_GetState(&huart1);
         
    }
         
  /* USER CODE END USART1_IRQn 1 */
}

So every 1s I should have the IRQ called but it aint.

Any advice much appreciated


Outcomes