stm32H7串口IDLE 中断一直卡在中断解决方法
使能IDLE中断的时候不能这样使能
// HAL_UART_Receive_IT(&huart2,Rbuffrechuart2, 50);
// __HAL_UART_ENABLE_IT(&huart2,UART_IT_IDLE);
要这样使能
__HAL_UART_ENABLE_IT(&huart2, UART_IT_IDLE);
while(__HAL_UART_GET_FLAG(&huart2,UART_FLAG_IDLE)==RESET)
{}
HAL_UART_Receive_IT(&huart2,rx_buffer,100);
感谢https://blog.csdn.net/hqy450665101/article/details/110149311