LPC1788 DMA Delay Problem

Status
Not open for further replies.

Persian_Men

Junior Member level 1
Joined
Nov 29, 2008
Messages
18
Helped
5
Reputation
10
Reaction score
4
Trophy points
1,283
Visit site
Activity points
1,455
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.

test code:
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_Typd					GPDMA_LLI;

void DMA_Setup()
{
		uint32_t	i=0;
		GPDMA_Channel_CFG_Type	GPDMACfg;
	
		for (i=0;i<512;i+=2)
		{
			DMASrc_Buffer[i]=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
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…