AM2634-Q1: Question of triggering EDMA Chain continuously

Part Number: AM2634-Q1
Other Parts Discussed in Thread: AM2634

Tool/software:

Hi there,

I am working on AM2634 MCAL 9.2  and trying to trigger EDMA chain by PWM SOCA, but got questions here:

1. Is there any limited to how many channels can be triggered in a EDMA chain?

2. After every time to trigger the EDMA transfer, I found that I have to reset all the ParamEntry like 

        Cdd_Dma_ParamSet(handleId,0,0,paramEntry0);
        Cdd_Dma_ParamSet(handleId,1,0,paramEntry1);
        Cdd_Dma_ChainChannel(handleId,0,0,1,chainOption);
is there any way that I don't need to set those ParameSet every time? as it takes about 20us to reset it.
Thanks
  • Hi Phoenix,

    1. No there is no limit as such on the number of channels involved in the chaining.
    2. Is you trigger manual trigger or is it event based? ParamSet should be set for each param associated with the channel once only and if you are chaining more than 2 channel then you have to chain them all by using ChainChannel. Once this is done you don't need to do this till all your paramSet length (aCount*bCount*cCount) value become "0".

    Thanks,

    Mudit Bhansali 

  • Hi Mudit,

    Thanks for your reply but,

    1. It is triggered by PWM SOCA. From my understanding, it is doesn't matter the trigger is manual or event. For every trigger, all the chained channels will be executed once.

    2. My question is after all the chained channels be executed once, I have to re-init all the ParamEntry by calling those functions before the next trigger comme, otherwise, the chained channels will not execute on the second trigger. Is there any way to init ParamSet once at the beginning, then make it execute for every trigger?

  • Hi Phoenix,

    Can you send me you param-set configuration which you are setting for all the chained channels? There is no need to re-initialize all the paramEntry
    I was asking about the mode of trigger because in case of event mode DMA will be triggered only if receive any HW event from PWM but in the other case DMA will be triggered as soon as enable transfer is called.

    Thanks,

    Mudit Bhansali

  • Hi Mudit,

    Here is the example from MCAL 9.2.0 example DmaChainingModeApp.c

        /* Filling the paramEntry for param 0  of channel0*/
        paramEntry0.srcPtr = srcPtr;
        paramEntry0.destPtr = dstPtr;
        paramEntry0.aCnt = CDD_DMA_TEST_A_COUNT;
        paramEntry0.bCnt = CDD_DMA_TEST_B_COUNT;
        paramEntry0.cCnt = CDD_DMA_TEST_C_COUNT/2;
        paramEntry0.bCntReload = 0;
        paramEntry0.srcBIdx = CDD_DMA_TEST_A_COUNT;
        paramEntry0.destBIdx = CDD_DMA_TEST_A_COUNT;
        paramEntry0.srcCIdx = CDD_DMA_TEST_A_COUNT*CDD_DMA_TEST_B_COUNT;
        paramEntry0.destCIdx = CDD_DMA_TEST_A_COUNT*CDD_DMA_TEST_B_COUNT;
        paramEntry0.opt = opt0;
    
        /* Filling the paramEntry for param 0 of channel1 */
        paramEntry1.srcPtr = srcPtr+shift;
        paramEntry1.destPtr = dstPtr+shift;
        paramEntry1.aCnt = CDD_DMA_TEST_A_COUNT;
        paramEntry1.bCnt = CDD_DMA_TEST_B_COUNT;
        paramEntry1.cCnt = CDD_DMA_TEST_C_COUNT/2;
        paramEntry1.bCntReload = 0;
        paramEntry1.srcBIdx = CDD_DMA_TEST_A_COUNT;
        paramEntry1.destBIdx = CDD_DMA_TEST_A_COUNT;
        paramEntry1.srcCIdx = CDD_DMA_TEST_A_COUNT*CDD_DMA_TEST_B_COUNT;
        paramEntry1.destCIdx = CDD_DMA_TEST_A_COUNT*CDD_DMA_TEST_B_COUNT;
        paramEntry1.opt = opt1;
    
        Cdd_Dma_ParamSet(handleId,0,0,paramEntry0);
        Cdd_Dma_ParamSet(handleId,1,0,paramEntry1);
        Cdd_Dma_ChainChannel(handleId,0,0,1,chainOption);
    
        void * appdata = (void *) &Cdd_Dma_TestDoneSem;
        /* Registering the callback */
        Cdd_Dma_CbkRegister(handleId,appdata,&Cdd_Dma_RegionIsrFxn);
                    /*
                    * Enable transfer on dmaCh0 only.
                    * Because of chaining the dmaCh1 will be triggered automatically.
                    * Transfer is done in AB sync mode, Number of triggeres required is
                    * cCnt value programmed in param (EDMA_TEST_C_COUNT / 2)
                    */
        for(uint32 count=0;count<(CDD_DMA_TEST_C_COUNT/2);count++)
        {
            Cdd_Dma_EnableTransferRegion(handleId,CDD_EDMA_TRIG_MODE_MANUAL);
            while(Cdd_Dma_TestDoneSem == 1);
            Cdd_Dma_TestDoneSem = 1;
        }

    After all the chained channels run, if I try to trigger it again by, Cdd_Dma_EnableTransferRegion(handleId,CDD_EDMA_TRIG_MODE_MANUAL);

    It doesn't work. I need to call Cdd_Dma_ParamSet() again before Cdd_Dma_EnableTransferRegion(handleId,CDD_EDMA_TRIG_MODE_MANUAL);

    Then it works again.

  • Here in this case we are using AB-sync mode and since in this chain example our cCount value is 1, so param-set length become "0" after first trigger only so there is nothing to transfer.
    If you change for example : CDD_DMA_TEST_C_COUNT from 2 to 4 , then in that case total 2 trigger will be required by DMA Chain to transfer the whole length.

    Thanks,

    Mudit Bhansali

  • Hi Mudit,

    My question is if I change the trigger to PWM periodic trigger in this example, does the chain channels run for every trigger?

    From my test, it doesn't work.

    Do you have any example where the chained channels be trigerred periodically?

    Thanks