DMA Transfer from GPIO

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

DMA Transfer from GPIO

1,525 Views
lukebeno
Contributor I

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:

pastedImage_1.png

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:

pastedImage_2.png

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.

Labels (1)
0 Kudos
2 Replies

898 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Luke Beno,

Thank you for your interest in NXP Semiconductor products and 
for the opportunity to serve you.
Maybe the thread will inspire you configure the DMA operation in right way.

TIC

 

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

898 Views
lukebeno
Contributor I

Thanks, the DMA example was not really helpful but I was able to figure out the issue.  The Pin config tool obscures the fact that you are creating a PINT and then linking that to the DMA event.  The other caveat is that they PINT Interrupt appears to need to be enabled in order to trigger the DMA.  Which unfortunate because that means that the CPU also needs to be interrupted as well.  In the end I found that I could "ARM" the IRQ to trigger once and then let the DMA continuously run.  Not the most elegant approach but it works.

0 Kudos