Skip to main content
Bs.1
Associate III
August 1, 2020
Question

Using STM32F072VB..USART4 with interrupt..unable to read the receive buffer in interrupt routine...please see the code snippet... I trying to commpare p[0] & p[1]....to do the following operation in my code...

  • August 1, 2020
  • 2 replies
  • 582 views

uint8_t p[2]={0,0}; /// receive buffer

void USART3_4_IRQHandler(void)

{

 /* USER CODE BEGIN USART3_4_IRQn 0 */

      /* USER CODE END USART3_4_IRQn 0 */

      HAL_UART_IRQHandler(&huart4);

      /* USER CODE BEGIN USART3_4_IRQn 1 */

      HAL_UART_Receive_IT(&huart4, (uint8_t *)p, 2);

 /* USER CODE END USART3_4_IRQn 1 */

}

This topic has been closed for replies.

2 replies

prain
Visitor II
August 1, 2020

This line

​HAL_UART_Receive_IT(&huart4, (uint8_t *)p, 2);

should be in receive complete callback. move it.​

Tesla DeLorean
Guru
August 1, 2020

Array should be volatile

Show all related code, issue likely not where you're looking

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..