lpcware

DMA Transfer Delay Problem

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by mrmehdi on Mon Sep 14 07:32:01 MST 2015
Hi Everyone
i have a problem with LPC1788 DMA
i want transfer data linked list from sram to gpio port by DMA.
i try this code and work correctly
but i have a big problem
in data logger result you can see huge time gap between each transfer completed.
[img]http://s2.postimg.org/lwwour0xl/image.jpg[/img]

my tested code:

void DMA_IRQHandler (void)
{
static uint32_t regVal;
regVal=LPC_GPDMA->IntTCStat;
LPC_GPDMA->IntTCClear |= regVal;
regVal=LPC_GPDMA->IntErrStat;
LPC_GPDMA->IntErrClr |= regVal;

// check GPDMA interrupt on channel DMA_CHANNEL_NO
//if (GPDMA_IntGetStatus(GPDMA_STAT_INT, DMA_CHANNEL_NO)){ //check interrupt status on channel DMA_CHANNEL_NO
// Check counter terminal status
//if(GPDMA_IntGetStatus(GPDMA_STAT_INTTC, DMA_CHANNEL_NO)){
// Clear terminate counter Interrupt pending
//GPDMA_ClearIntPending (GPDMA_STATCLR_INTTC, DMA_CHANNEL_NO);
//Channel0_TC++;
//}
//}
}

GPDMA_LLI_TypdGPDMA_LLI;

void DMA_Setup()
{
uint32_ti=0;
GPDMA_Channel_CFG_TypeGPDMACfg;

for (i=0;i<512;i+=2)
{
DMASrc_Buffer=0x00;
DMASrc_Buffer[i+1]=0xff;
}

NVIC_DisableIRQ(DMA_IRQn);

NVIC_SetPriority(DMA_IRQn, ((0x01<<3)|0x01));

GPDMA_Init();
//Setup DMA Channel

GPDMA_LLI.SrcAddr=(uint32_t)DMASrc_Buffer;
GPDMA_LLI.DstAddr=(uint32_t)&(LPC_GPIO0->PIN);
GPDMA_LLI.NextLLI=(uint32_t)&GPDMA_LLI;
GPDMA_LLI.Control= DMA_SIZE
|(2<<18) //SW=32Bit
|(2<<21)//DW=32Bit
|(1<<26) //source incr
|(1<<31) ;

GPDMACfg.ChannelNum=DMA_CHANNEL_NO;
GPDMACfg.SrcMemAddr=(uint32_t)DMASrc_Buffer;
GPDMACfg.DstMemAddr=(uint32_t)(&LPC_GPIO0->PIN);

// Transfer size
GPDMACfg.TransferSize = DMA_SIZE;
// Transfer width
GPDMACfg.TransferWidth = GPDMA_WIDTH_WORD;
// Transfer type
GPDMACfg.TransferType = GPDMA_TRANSFERTYPE_M2M;
// Source connection - unused
GPDMACfg.SrcConn = 0;
// Destination connection - unused
GPDMACfg.DstConn = 0;
// Linker List Item - unused
GPDMACfg.DMALLI = (uint32_t)&GPDMA_LLI;
// Setup channel with given parameter
GPDMA_Setup(&GPDMACfg,0);

// Enable GPDMA channel DMA_CHANNEL_NO
GPDMA_ChannelCmd(DMA_CHANNEL_NO, ENABLE);

/* Enable GPDMA interrupt */
NVIC_EnableIRQ(DMA_IRQn);

}

my problem is huge time between each transition.
you can see in this picture
A section period time and  B section is same.
i don't know why this time gap happened.
thanks for your help

Outcomes