yuxiuchang88 发表于 2011-11-29 16:04:54

求助:在用F207ig中DMA的时候,配置完dma参数后,使用库函数使能DMA,但是,不成功,为什么?

DMA_InitTypeDefDMA_InitStructure;
//__IO uint32_t    Timeout = TIMEOUT_MAX;
   
/* Enable DMA clock */
RCC_AHB1PeriphClockCmd(DMA_STREAM_CLOCK, ENABLE);


//RCC_AHB1PeriphResetCmd(RCC_AHB1Periph_DMA2, ENABLE);

/* Reset DMA Stream registers (for debug purpose) */
DMA_DeInit(DMA_STREAM);

/* Check if the DMA Stream is disabled before enabling it.
   Note that this step is useful when the same Stream is used multiple times:
   enabled, then disabled then re-enabled... In this case, the DMA Stream disable
   will be effective only at the end of the ongoing data transfer and it will
   not be possible to re-configure it before making sure that the Enable bit
   has been cleared by hardware. If the Stream is used only once, this step might
   be bypassed. */
while (DMA_GetCmdStatus(DMA_STREAM) != DISABLE)
{
}
/* Configure DMA Stream */
DMA_InitStructure.DMA_Channel = DMA_CHANNEL;
DMA_InitStructure.DMA_PeripheralBaseAddr = (uint32_t)SPI1_DR_Address;       
DMA_InitStructure.DMA_Memory0BaseAddr = (uint32_t)LCDBuffer;
DMA_InitStructure.DMA_DIR = DMA_DIR_MemoryToPeripheral;
DMA_InitStructure.DMA_BufferSize = (uint32_t)COLUMN_NUM-4;
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_High;
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_PeripheralBurst_Single;
DMA_Init(DMA_STREAM, &DMA_InitStructure);
   

   /* DMA Stream enable */

       DMA_Cmd(DMA_STREAM, ENABLE);
while(DMA_GetCmdStatus(DMA_STREAM)!=ENABLE);             //就在这停了

之前用spi的时候是使能dma成功,并且进入中断了,但是在中断中关dma,然后出了中断后执行       
while(DMA_GetCmdStatus(DMA_STREAM)==ENABLE){}时停下了,我的学习就卡在这里了,串口和spi都是调好了的,能成功发送数据,就是在dma这卡住的。
请大家帮帮忙啊

yuxiuchang88 发表于 2011-11-29 16:56:52

自己顶顶

yuxiuchang88 发表于 2011-11-29 16:57:51

发错地方了,不好意思

bbl 发表于 2012-9-11 10:35:10

我现在也遇到一样的问题
页: [1]
查看完整版本: 求助:在用F207ig中DMA的时候,配置完dma参数后,使用库函数使能DMA,但是,不成功,为什么?