你好!
我用cubeMX产生USART2 DMA 发送,但发现没有出来。我看了很多次程序,没有发现问题,用普通方式发送数据,没有问题,DMA方式不行,采用DMA1,时钟也设置了,
/* USART2_TX Init */
hdma_usart2_tx.Instance = DMA1_Stream3;
hdma_usart2_tx.Init.Request = DMA_REQUEST_USART2_TX;
hdma_usart2_tx.Init.Direction = DMA_MEMORY_TO_PERIPH;
hdma_usart2_tx.Init.PeriphInc = DMA_PINC_DISABLE;
hdma_usart2_tx.Init.MemInc = DMA_MINC_ENABLE;
hdma_usart2_tx.Init.PeriphDataAlignment = DMA_PDATAALIGN_BYTE;
hdma_usart2_tx.Init.MemDataAlignment = DMA_MDATAALIGN_BYTE;
hdma_usart2_tx.Init.Mode = DMA_NORMAL;
hdma_usart2_tx.Init.Priority = DMA_PRIORITY_LOW;
hdma_usart2_tx.Init.FIFOMode = DMA_FIFOMODE_DISABLE;
hdma_usart2_tx.Init.FIFOThreshold = DMA_FIFO_THRESHOLD_FULL;
hdma_usart2_tx.Init.MemBurst = DMA_MBURST_SINGLE;
hdma_usart2_tx.Init.PeriphBurst = DMA_PBURST_SINGLE;
HAL_DMA_DeInit(&hdma_usart2_tx);
if (HAL_DMA_Init(&hdma_usart2_tx) != HAL_OK)
{
}
__HAL_LINKDMA(&UART2_Handler,hdmatx,hdma_usart2_tx);
不知道哪儿出了问题?USART3 DMA就没有问题,难道USART2 DMA 发送不行?
|