程序运行后卡在while (DMA_GetFlagStatus(DMA2_Stream3,DMA_FLAG_TCIF3) == RESET){}这一句。
此时,部分寄存器状态为SDIO->STA=0x00045000,DMA_GetCurrDataCounter(DMA2_Stream3)=16,
部分内存数据:
DMA配置代码如下:
[mw_shl_code=c,true]static void DMA_TxConfiguration(u32 *BufferSRC, u32 BufferSize)
{
DMA_InitTypeDef DMA_InitStructure;
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_DMA2,ENABLE);
DMA_Cmd(DMA2_Stream3, DISABLE);
DMA_DeInit(DMA2_Stream3);
while (DMA_GetCmdStatus(DMA2_Stream3) != DISABLE){}
DMA_ClearFlag(DMA2_Stream3,DMA_FLAG_TCIF3 | DMA_FLAG_HTIF3 | DMA_FLAG_TEIF3 | DMA_FLAG_DMEIF3 | DMA_FLAG_FEIF3);
/* DMA2 Channel4 Config */
DMA_InitStructure.DMA_Channel=DMA_Channel_4;
DMA_InitStructure.DMA_PeripheralBaseAddr = (u32)SDIO_FIFO_Address;
DMA_InitStructure.DMA_Memory0BaseAddr = (u32)BufferSRC;
DMA_InitStructure.DMA_DIR =DMA_DIR_MemoryToPeripheral;
DMA_InitStructure.DMA_BufferSize = BufferSize / 4;
DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable;
DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable;
DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_HalfWord;
DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_HalfWord;
DMA_InitStructure.DMA_Mode = DMA_Mode_Normal;
DMA_InitStructure.DMA_Priority = DMA_Priority_VeryHigh;
DMA_InitStructure.DMA_FIFOMode=DMA_FIFOMode_Disable;
DMA_InitStructure.DMA_FIFOThreshold=DMA_FIFOThreshold_Full;
// DMA_InitStructure.DMA_MemoryBurst=DMA_MemoryBurst_Single;
// DMA_InitStructure.DMA_PeripheralBurst=DMA_MemoryBurst_Single;
// DMA_FlowControllerConfig(DMA2_Stream3,DMA_FlowCtrl_Peripheral);
DMA_Init(DMA2_Stream3, &DMA_InitStructure);
DMA_Cmd(DMA2_Stream3, ENABLE);
}[/mw_shl_code]
|