STM32F103C6T6的串口发送出现奇怪问题!与CC2530通讯是能收到数据,但发送的数据有几个字节是错误的,好奇怪!而且无法用DMA发送,最奇怪的是,程序下载完成后。用锂电池供电,运行指示灯正常闪烁。但串口则没有数据(用示波器测试),连接JTAG就有数据。超级奇怪!
DMA配置:
DMA_DeInit(DMA1_Channel2);
DMA_InitStructure.DMA_PeripheralBaseAddr = (u32)SRC_USART1_DR;
DMA_InitStructure.DMA_MemoryBaseAddr = (u32)&USARTSendBuff;
DMA_InitStructure.DMA_DIR = DMA_DIR_PeripheralDST;
DMA_InitStructure.DMA_BufferSize = Len;
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_Normal;
DMA_InitStructure.DMA_Priority = DMA_Priority_Medium;
DMA_InitStructure.DMA_M2M = DMA_M2M_Disable;
DMA_Init(DMA1_Channel2, &DMA_InitStructure);
USART_DMACmd(USART1, USART_DMAReq_Tx, ENABLE);
// Enable DMA1 channel2
DMA_Cmd(DMA1_Channel2, ENABLE); |