Callback eDMA

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

Callback eDMA

691 Views
carloscardenal
Contributor I

Hi,

I am using eDMA to transfer from peripheral to memory (one register value) and I don't want to use the callback function, so I disable interrupts but still I need to set up the callback function and a global variable in order to transfer all data.

There is any way of getting rid of EDMA_SetCallback() in SDK 2.0?

Tags (1)
0 Kudos
1 Reply

448 Views
jorge_a_vazquez
NXP Employee
NXP Employee

Hi carlos cardenal

There is no need to set a callback to work with the eDMA driver, for example check the example code provided in SDK drivers;

EDMA_GetDefaultConfig(&userConfig);
EDMA_Init(DMA0, &userConfig);
EDMA_CreateHandle(&g_EDMA_Handle, DMA0, 0);
EDMA_SetCallback(&g_EDMA_Handle, EDMA_Callback, NULL);
EDMA_PrepareTransfer(&transferConfig, srcAddr, sizeof(srcAddr[0]), destAddr, sizeof(destAddr[0]),
                         sizeof(srcAddr[0]), sizeof(srcAddr), kEDMA_MemoryToMemory);
EDMA_SubmitTransfer(&g_EDMA_Handle, &transferConfig);
EDMA_StartTransfer(&g_EDMA_Handle);

If you comment the EDMA_SetCallback line, the DMA transfers still happen, you only will not have a function that is called when transfer finished.

Please remember that if you are using transfer to internal memory, your variable addresses need to be aligned, for example:

uint16_t Your_internal_buffer[BUFF_LENGTH] __attribute__ ((aligned (32)));

Hope this information could help you.
Have a great day,
Jorge Alcala

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

0 Kudos