我使用的是寄存器到寄存器的DMA方式。65535次。
以下包含了所有与DMA有关的代码。在调试的时候确定DMA的NDTR已经写入数据,DMA2_STREAM1的CR里面TCIF1的FLAG立好了,ENABLE之后DMA传输完成NDTR为0.但是无法进入中断。请问是为什么?
我实用DMA进行SRAM与TFTLCD之间的直接调用,请问这时候地址应该怎么写?
[mw_shl_code=c,true] DMA_InitStructure.DMA_Channel = chx;
DMA_InitStructure.DMA_PeripheralBaseAddr = par;
DMA_InitStructure.DMA_Memory0BaseAddr = mar;
DMA_InitStructure.DMA_DIR = DMA_DIR_MemoryToMemory;
DMA_InitStructure.DMA_BufferSize = ndtr;
DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Enable;
DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Disable;
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_Medium;
DMA_InitStructure.DMA_FIFOMode = DMA_FIFOMode_Enable;
DMA_InitStructure.DMA_FIFOThreshold = DMA_FIFOThreshold_HalfFull;
DMA_InitStructure.DMA_MemoryBurst = DMA_MemoryBurst_Single;
DMA_InitStructure.DMA_PeripheralBurst = DMA_PeripheralBurst_Single;
DMA_Init(DMA_Streamx, &DMA_InitStructure);
DMA2_Stream1->CR &= 0xfffffffe;
DMA2_Stream1->CR &= 0xfffbffff;//关闭双缓冲区模式
DMA_ITConfig(DMA2_Stream1,DMA_IT_TC,ENABLE);//DMA中断配置[/mw_shl_code]
[mw_shl_code=c,true][/mw_shl_code]
[mw_shl_code=c,true][/mw_shl_code]
[mw_shl_code=c,true]
[mw_shl_code=c,true]void DMA2_Stream1_IRQHandler(void)
{
static u8 i = 1;
if(DMA_GetITStatus(DMA2_Stream1,DMA_IT_TCIF1)==SET)
{
if(i<4)
{
MYDMA_Config(DMA2_Stream1,DMA_Channel_0,Bank1_SRAM3_ADDR+131072*i,0x0000007E,65535);
MYDMA_Enable(DMA2_Stream1,65535);
}
else if(i == 4)
{
MYDMA_Config(DMA2_Stream1,DMA_Channel_0,Bank1_SRAM3_ADDR+524288,0X0000007E,4292);
MYDMA_Enable(DMA2_Stream1,4292);
}
}
DMA_ClearITPendingBit(DMA2_Stream1,DMA_IT_TCIF1);
}[/mw_shl_code]
[/mw_shl_code]
[mw_shl_code=c,true][/mw_shl_code]
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
一周热门 更多>