//串口3配置
DMA_DeInit(DMA1_Channel2);
DMA_tx_USART3_Configuration(1);
//DMA_rx_Configuration(1);
//USART_InitStructure.USART_BaudRate = 9600;
USART_InitStructure.USART_BaudRate = 9600;
USART_InitStructure.USART_WordLength = USART_WordLength_8b;
USART_InitStructure.USART_StopBits = USART_StopBits_1;
USART_InitStructure.USART_Parity = USART_Parity_No;
USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
USART_Init(USART3, &USART_InitStructure);
// Enable USART1 DMA Rx and TX request
USART_DMACmd(USART3,USART_DMAReq_Tx, ENABLE);
// Enable DMA1 Channel4
DMA_Cmd(DMA1_Channel2, ENABLE);
/* Enable DMA1 Channel5 */
//DMA_Cmd(DMA1_Channel5, ENABLE);
USART_ITConfig(USART3, USART_IT_ERR, ENABLE);//错误中断
USART_ITConfig(USART3, USART_IT_RXNE, ENABLE);//接收中断开启
/* Enable the USART1 */
USART_Cmd(USART3, ENABLE);
|