用寄存器看了晕晕啊,但是注释的配置好像没问题啊。你用查询1byte产生的中断过程中可能会给后面的数据覆盖啊。你改用大点的buffer试试啊、
确实晕,dr有东西串口应该没问题,我怎么记得中断和dma只能用一个呀,这个是以前用过的
USART_DMACmd(USARTX, USART_DMAReq_Tx, ENABLE);
USART_DMACmd(USARTX, USART_DMAReq_Rx, ENABLE);
// DMA接收 //
DMA_DeInit(USART_RX_DMA_CHANNELX);
DMA_InitStructure.DMA_PeripheralBaseAddr = (uint32_t)&(USARTX->DR);
DMA_InitStructure.DMA_MemoryBaseAddr = (u32)Received_Data_Buffer;
DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralSRC;
//收到1个数据后开始处理
DMA_InitStructure.DMA_BufferSize = USART_PACKET_SIZE;
DMA_InitStructure.DMA_BufferSize = 1;
DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable;
DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable;
DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Byte;
DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_Byte;
DMA_InitStructure.DMA_Mode = DMA_Mode_Circular;//循环模式
DMA_InitStructure.DMA_Priority = DMA_Priority_Low;
DMA_InitStructure.DMA_M2M = DMA_M2M_Disable;
DMA_Init(USART_RX_DMA_CHANNELX, &DMA_InitStructure);
DMA_Cmd(USART_RX_DMA_CHANNELX, ENABLE);
USART_Cmd(USARTX, ENABLE);
DMA_ITConfig(USART_RX_DMA_CHANNELX, DMA_IT_TC, ENABLE);