How can I use a circular buffer for an EDMA transfer?

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I use a circular buffer for an EDMA transfer?

63 Views
Contributor I

I've been stuck trying to get this to work for days now. I am attempting to do an EDMA transfer that loops back onto itself. I've tried using the EDMA_SetModulo method, along with various other methods, and I cannot find any decent examples of this.

I want to start an EDMA transfer, that will complete the major loop a specified number of times. (This is going to be used for Audio to send data to the speaker for alarms and I want to implement a circular buffer that will loop as many times as I specify.)

Based on the documentation I've read, this should cause the major loop to run twice.

```

DMAMUX_Init(EXAMPLE_DMAMUX);
DMAMUX_EnableAlwaysOn(EXAMPLE_DMAMUX, 0, true);
DMAMUX_SetSource(EXAMPLE_DMAMUX, 0, 63);
DMAMUX_EnableChannel(EXAMPLE_DMAMUX, 0);

EDMA_GetDefaultConfig(&userConfig);
EDMA_Init(EXAMPLE_DMA, &userConfig);
EDMA_CreateHandle(&g_EDMA_Handle, EXAMPLE_DMA, 0);
EDMA_SetCallback(&g_EDMA_Handle, EDMA_Callback, NULL);
EDMA_ResetChannel(g_EDMA_Handle.base, g_EDMA_Handle.channel);
EDMA_InstallTCDMemory(&g_EDMA_Handle, tcd, 2U);
tcd->BITER = 2;
tcd->CITER = 2;
tcd->SLAST = -32;

EDMA_PrepareTransfer(&transferConfig,
srcAddr,
sizeof(srcAddr[0]),
dstAddr,
sizeof(dstAddr[0]),
sizeof(srcAddr[0]),
sizeof(srcAddr),
kEDMA_MemoryToMemory);

EDMA_SubmitTransfer(&g_EDMA_Handle, &transferConfig);
EDMA_StartTransfer(&g_EDMA_Handle);

```

Labels (2)
0 Kudos
1 Reply

28 Views
NXP TechSupport
NXP TechSupport

Hi Tristen Harr,

Thank you for your interest in NXP Semiconductor products and
for the opportunity to serve you.
In actually, I'm still not very clear with your question, so I was wondering if you can share the block diagram of DMA transfer, then I can give some advice to you to do it.

Looking forward to your reply.

Have a great day,
TIC

 

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

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos