cancel
Showing results for 
Search instead for 
Did you mean: 

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...

Bs.1
Associate II

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 */

}

2 REPLIES 2
prain
Senior III

This line

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

should be in receive complete callback. move it.​

Array should be volatile

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

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