Hi,
I am using the GPDMA to transfer a block of data out via a GPIO port and I'm trying, with no success, to discover the theoretical frequency at which this should occur based on the system core frequency.
I have measured the transfer using a scope at a core frequency of 204MHz and 120MHz. I get a sensible looking answer on the scope given the ration between the 2, however it would really help to discover the actual speed and tolerance.
Thanks.
Hello Hairy Lee,
You can try something like this 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); }
Best Regards,
Sol