2020-08-01 04:42 AM
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 */
}
2020-08-01 05:31 AM
This line
HAL_UART_Receive_IT(&huart4, (uint8_t *)p, 2);
should be in receive complete callback. move it.
2020-08-01 06:19 AM
Array should be volatile
Show all related code, issue likely not where you're looking