大家好:
我用STM32将串口通讯放在DMA上发送数数据没什么问题,接收数据那:
if(USART_GetITStatus(USART1, USART_IT_IDLE) != RESET)
{
LEDB(ON);
DMA_Cmd(DMA1_Channel5, DISABLE); //关闭DMA,防止处理其间有数据
DMA1_Channel5->CMAR = (uint32_t)USARTx1.Rece_Buffer;
DMA1_Channel5->CNDTR = 64; //重装填
DMA_Cmd(DMA1_Channel5, ENABLE);
if(USART_GetITStatus(USART1, USART_IT_PE | USART_IT_FE | USART_IT_NE) != RESET)//出错
{
USART_ClearITPendingBit(USART1, USART_IT_PE | USART_IT_FE | USART_IT_NE);
}
else{}
//USART_ClearITPendingBit(USART1, USART_IT_RXNE);
USART_ClearITPendingBit(USART1, USART_IT_IDLE);
//DMA_ClearITPendingBit(DMA1_IT_TC5); //清除传输完毕中断
//DMA_ClearITPendingBit(DMA1_IT_TE5);
}
else{}
程序初始化完毕之后,发送一直没问题,但是我从上位机发一帧数据下去之后,整个程序仿佛死了一样有做watchdog,望各位大侠指点迷津! |