在线时间0 小时
UID252090
ST金币0
蝴蝶豆0
注册时间2010-12-5
新手上路
- 最后登录
- 2020-12-7
|
a0a.1 0b0c
我在用DMA1_Stream4做UART4输出通信时,为什么DMA1_Stream4始终使能不了?
DMA配置代码如下:
void wuHostUartTxDmaInit(void)
{
FunctionalState DmaEnableStatus;
DMA_InitTypeDef DMA_InitStructure;
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_DMA1, ENABLE);
DMA_StructInit(&DMA_InitStructure);
DMA_InitStructure.DMA_Channel = DMA_Channel_4;
DMA_InitStructure.DMA_PeripheralBaseAddr = (int32u)UART4_DATA_ADDRESS;
DMA_InitStructure.DMA_Memory0BaseAddr = (int32u)&nvUart4TxBufr;
DMA_InitStructure.DMA_DIR = DMA_DIR_MemoryToPeripheral;
DMA_InitStructure.DMA_BufferSize = 80;
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_FIFOMode = DMA_FIFOMode_Disable;
DMA_InitStructure.DMA_FIFOThreshold = DMA_FIFOThreshold_1QuarterFull;
DMA_InitStructure.DMA_MemoryBurst = DMA_MemoryBurst_Single;
DMA_InitStructure.DMA_PeripheralBurst = DMA_PeripheralBurst_Single;
DMA_Init(DMA1_Stream4, &DMA_InitStructure);
USART_DMACmd(UART4, USART_DMAReq_Tx, ENABLE);
DMA_Cmd(DMA1_Stream4, ENABLE);
DmaEnableStatus = DMA_GetCmdStatus(DMA1_Stream4);
while(!DmaEnableStatus)
{
DMA_Cmd(DMA1_Stream4, ENABLE);
DmaEnableStatus = DMA_GetCmdStatus(DMA1_Stream4);
}
}
|
|