Continuous/Self-perpetuating eDMA scatter gather

cancel
Showing results for 
Search instead for 
Did you mean: 

Continuous/Self-perpetuating eDMA scatter gather

921 Views
Contributor IV

Hello, I am using IAR with an RT1050 SDK, version  2.3.0 (2017-11-16).   Is there a way to make scatter gather eDMA transaction self-perpetuating, i.e. they require no software intervention to keep the transactions running indefinitely? 

I have been working with the SDK scatter gather example and they appear to always stop after the last TCD even when linking appears to be set up correctly in the last TCD.  There are some hints in the reference manual and API code that suggest this is expected behavior then other still suggest it is not.

Here is a comment in the API documentation that suggests this might not be possible:

For the last two continuous ISRs in a scatter/gather process, they both load
the last TCD (The last ISR does not load a new TCD) from the memory pool to the
eDMA engine when major loop completes. Therefore, ensure that the header and
tcdUsed updated are identical for them. tcdUsed are both 0 in this case as no
TCD to be loaded.

Thanks.

6 Replies

143 Views
Contributor IV

Lets try this another way.  Below is the eDMA setup from the RT105x SDK scatter gather example.  Could someone please point out the changes necessary to turn this into a self-perpetuating transfer, i.e. once TCD[1] is complete it should re-trigger TCD[0], forever without SW intervention once set up.

    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, tcdMemoryPoolPtr, TCD_QUEUE_SIZE);
    /* Configure and submit transfer structure 1 */
    EDMA_PrepareTransfer(&transferConfig, srcAddr, sizeof(srcAddr[0]), destAddr, sizeof(destAddr[0]),
                         sizeof(srcAddr[0]), sizeof(srcAddr[0]) * HALF_BUFFER_LENGTH, kEDMA_MemoryToMemory);
    EDMA_SubmitTransfer(&g_EDMA_Handle, &transferConfig);
    /* Configure and submit transfer structure 2 */
    EDMA_PrepareTransfer(&transferConfig, &srcAddr[4], sizeof(srcAddr[0]), &destAddr[4], sizeof(destAddr[0]),
                         sizeof(srcAddr[0]), sizeof(srcAddr[0]) * HALF_BUFFER_LENGTH, kEDMA_MemoryToMemory);
    EDMA_SubmitTransfer(&g_EDMA_Handle, &transferConfig);

    EDMA_StartTransfer(&g_EDMA_Handle);

I have tried using the API EDMA_TcdSetChannelLink and it does appear to correctly set MAJORELINK and MAJORLINKCH but no re-triggering occurs.  On a whim, I have also tried forcing ESG on the last block without results. 

Regards.

0 Kudos

143 Views
NXP TechSupport
NXP TechSupport

Hello,

  When started with the edma_scatter_gather exampel from the SDK, one can add the following to the main just

before the call to EDMA_StartTransfer():

 

/* Enable scatter gather for TCD1. DLAST is already setup to point back to TCD0. 
* The scatter gather enable bit needs to be set, and DREQ needs to be cleared so that
* the channel will still respond to requests.
*/

tcdMemoryPoolPtr[1].CSR = DMA_CSR_ESG_MASK | DMA_CSR_INTMAJOR_MASK;

 

   The loop changes the functionality so the demo won't complete, because the DMA runs forever at this point.

You can stop execution with the debugger, manually modify srcAddr and/or destAddr, start execution again,

then stop and see that the DMA is still going.

Regards,

Yuri.

143 Views
Contributor IV

Thanks Yuri, that worked.  I have set those bits but not in the same way or sequence in the setup.

143 Views
Contributor II

Hi Ryan, I want config the eDMA just like you say, But i cant config it properly, Could you give me some advice??

0 Kudos

143 Views
Contributor IV

Hello Yuri, yes I have read these sections and tried again and again.  The problem is when a person is new to a processor and processor family they lack the context and "tribal knowledge" they need to assimilate the often obscure and voluminous documentation.  In order to get past these issues they look to the NXP forum moderators and community for insight and clarification and perhaps a simple example. 

There is little to no point at all in having a forum when the standard response is almost invariably "read the manual".  Please see this post for some more feedback in this regard. 

Regards

143 Views
NXP TechSupport
NXP TechSupport

Hello,

 

  Have You followed recommendations of sections 22.5.7.2 (Dynamic channel linking)

and 22.5.7.3 (Dynamic scatter/gather) in i.MX RT1050 Processor Reference Manual,

Rev. 0, 10/2017 ?

 

Have a great day,

Yuri

 

------------------------------------------------------------------------------

Note: If this post answers your question, please click the Correct Answer

button. Thank you!

0 Kudos