先说说具体情况吧,工程中用到F429的串口1、2、4、7接收中断,我用接收中断的回调函数void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)来处理数据,但是有时就会卡死在while(HAL_UART_Receive_IT(&UART1_Handler, (u8 *)aRxBuffer1, RXBUFFERSIZE) != HAL_OK)出不来,这说明我huart->State!=HAL_UART_STATE_READY && huart->State!=HAL_UART_STATE_BUSY_TX;但是我串口的发送端都没发数据了,它还是出不来。很多天了,心塞
{
u8 Res;
u32 timeout=0;
#if SYSTEM_SUPPORT_OS
OSIntEnter();
#endif
HAL_UART_IRQHandler(&UART1_Handler);
timeout=0;
while(HAL_UART_Receive_IT(&UART1_Handler, (u8 *)aRxBuffer1, RXBUFFERSIZE) != HAL_OK)
{
timeout++; //
if(timeout>HAL_MAX_DELAY) break;
}
#if SYSTEM_SUPPORT_OS
OSIntExit();
#endif
}[/mw_shl_code]
一周热门 更多>