Luke Beno

DMA Transfer from GPIO

Discussion created by Luke Beno on Jan 5, 2018
Latest reply on Jan 29, 2018 by Luke Beno

I am using LPC54114 and would like to trigger a DMA transfer every time that a rising edge occurs on a GPIO pin.

 

So far I have the pin setup using the config tool like this:

 

 

This is the code for configuring the DMA channel 0:

dma_channel_trigger_t channel_trigger;
channel_trigger.burst = kDMA_SingleTransfer ;
channel_trigger.type = kDMA_RisingEdgeTrigger;
channel_trigger.wrap = kDMA_NoWrap;

DMA_Init(DMA0);
DMA_EnableChannel(DMA0, 0);
DMA_CreateHandle(&g_DMA_Handle, DMA0, 0);
DMA_SetCallback(&g_DMA_Handle, DMA_Callback, NULL);
DMA_PrepareTransfer(&transferConfig, &CTIMER0->TC , destAddr, sizeof(srcAddr[0]), sizeof(srcAddr), kDMA_MemoryToMemory, NULL);
transferConfig.xfercfg.srcInc = 0;
DMA_ConfigureChannelTrigger     (DMA0, 0, &channel_trigger);
DMA_SubmitTransfer(&g_DMA_Handle, &transferConfig);
DMA_StartTransfer(&g_DMA_Handle);

 

It does not seem and though the trigger is happening.  Its not surprising  because I think that the channel trigger is still routed to ADC0 Sequence A interrupt as shown in Table 217 of the user guide:

I've read through the documents but cannot figure out how to properly route this trigger to the DMA.  It makes me question if it is even possible?

 

I guess an alternative would be to configure the GPIO to generate a pin interrupt and then use one of these to trigger DMA but I still have hope that I don't need this extra step.

 

Lastly, it's sort of a shame that CTIMER CAP events cannot trigger DMA transfers on this part.  At least that what I decided after reading the documents.

Outcomes