小学生
最后登录1970-1-1
在线时间 小时
注册时间2024-6-28
|
请问下,在STM32标准库视频DMA一章,数据从SRAM到外设(串口),使能DMA时钟时,为什么示例程序里是RCC_AHBPeripheralClockCmd(USART_TX_DMA_CLK,ENABLE),而不是USART_RX_DMA_CLK呢?
// Memory -> P (USART->DR)
void USARTx_DMA_Config(void)
{
DMA_InitTypeDef DMA_InitStruct;
RCC_AHBPeriphClockCmd(USART_TX_DMA_CLK, ENABLE);
DMA_InitStruct.DMA_PeripheralBaseAddr = (uint32_t)USART_DR_ADDRESS;
DMA_InitStruct.DMA_MemoryBaseAddr = (uint32_t)SendBuff;
DMA_InitStruct.DMA_DIR = DMA_DIR_PeripheralDST;
DMA_InitStruct.DMA_BufferSize = SENDBUFF_SIZE;
DMA_InitStruct.DMA_PeripheralInc = DMA_PeripheralInc_Disable;
DMA_InitStruct.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Byte;
DMA_InitStruct.DMA_MemoryInc = DMA_MemoryInc_Enable;
DMA_InitStruct.DMA_MemoryDataSize = DMA_PeripheralDataSize_Byte;
DMA_InitStruct.DMA_Mode = DMA_Mode_Normal;
DMA_InitStruct.DMA_Priority = DMA_Priority_High;
DMA_InitStruct.DMA_M2M = DMA_M2M_Disable;
DMA_Init(USART_TX_DMA_CHANNEL, &DMA_InitStruct);
DMA_ClearFlag(USART_TX_DMA_FLAG_TC);
DMA_Cmd(USART_TX_DMA_CHANNEL, ENABLE);
}
|
|