This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How to do a link edma with a peripheral

Hello, I am working with edma on a evm dm6437. It is working good servicing the mcbsp and doing an "echo" (copy the DRR on the DXR, every time that a new data is received on the mcbsp). The problem is that I am not able to do a good link after the completion. In spru987 says: "The PaRAM sets associated with peripheral synchronization events should only be used for linking if the corresponding events are disabled".  So I guess, I can't just point the Param127 (for example) and hope that everything goes well. I guess I would need to wait the mcbsp reception event is disabled and then make the link. What would be the best way to do this? What I want to do is program the edma to work in an infinite loop to make always the "echo" on the mcbsp. I look on the "new linked" values on the param, and they seem correct, like just recent uploading, but ER does not show anymore the right event bit enabled like before doing the link.

 

 

 

 

 

Thank you in advance.

  • I gather you want the edma to continuously service your mcbsp events.  You basically want 2 copies of the param set used to service the event, one that is actively executing and another that is used to "reload" that param set after it completes.  You have 128 channels total, the lower 64 are associated with peripherals/events, and the upper 64 are "free" for linking.  So you would configure the param set associated with the mcbsp channel and link it to a free set (say 64).  You then copy the exact same param set, including the link, to set 64.  Then when your original set is exhausted, it will reload from set 64.  You do have to make sure to clear the event in your interrupt handler to allow subsequent events to occur.  The line you bolded from the app note says that you can use any of the 128 param sets as a link "target", but you should not use a set that has a peripheral event tied to it as a reload link (since it might be in flux while servicing that event when the link occurs).

    edit: of course you want to make sure the event is not enabled before you complete the param config for it & the link set.

  • Well, what you say is what I did. I have configured the dma channel 3 (tied to the rec event of mcbsp), and the link point to param127 (and the link of param 127 point to itself). And in param3 and in param127 is the same configuration (which works only the first time).

    About what you say in your p.s., is what exactly I want to know how to do it. The mcbsp is sending to me always, how I should I do the link, then?

     

    thank you

  • Did you clear the static bit in the options flag to 0 to allow links?  Does the mcbsp param set refresh with the new values correctly but just doesn't trigger a second event, or does it not reload at all?

    As far as setting this up, you have to enable events for the edma channel before it starts servicing them.  Normally you configure the transfer channel, then enable events.  Now, configure the transfer channel, configure the link channel, then enable the mcbsp event.

  • Matt had a great thought with respect to the STATIC field.  If that's not it then I suggest you post your code that configures the EDMA.

  • Well here is some of my code (yest static is clear to 0):

     

    #include <cslr.h>
    #include <cslr_edma3cc.h>
    #include <cslr_edma3tc.h>

    main{

    init_LINK();

    init_edma();

    }

    void init_edma(void)
    {
     edmaRegs->EESR= 0x08;
     edmaRegs->DMAQNUM[0]=0x00;
     edmaRegs->PARAMSET[3].OPT=0x00000000;    
     edmaRegs->PARAMSET[3].SRC=0x01D00000;
     edmaRegs->PARAMSET[3].A_B_CNT=0x00010001;
     edmaRegs->PARAMSET[3].DST=0x01D00004;
     edmaRegs->PARAMSET[3].SRC_DST_BIDX=0x00000000;
     edmaRegs->PARAMSET[3].LINK_BCNTRLD=0x4fE0;
     edmaRegs->PARAMSET[3].SRC_DST_CIDX=0x00;
     edmaRegs->PARAMSET[3].CCNT=0x01;
    }

     

    void init_LINK{
     edmaRegs->PARAMSET[127].OPT=0x00000000;    
     edmaRegs->PARAMSET[127].SRC=0x01D00000;
     edmaRegs->PARAMSET[127].A_B_CNT=0x00010001;
     edmaRegs->PARAMSET[127].DST=0x01D00004;
     edmaRegs->PARAMSET[127].SRC_DST_BIDX=0x00000000;
     edmaRegs->PARAMSET[127].LINK_BCNTRLD=0x4fE0;
     edmaRegs->PARAMSET[127].SRC_DST_CIDX=0x00;
     edmaRegs->PARAMSET[127].CCNT=0x01;

    }

     

           This is not exactly my code (I am not in my work place right now) but I remember it like this. Anyway the behaviour is like this:

     

    -The first whole transferetions goes right.

    -When the link comes, I see the param[3] register and they seems well reloaded (well I do not know exactly as the params are the same), but in ER there is no 0x08 bit enable that I was able to see like "set" in the whole transfer before the link (this bit is supposed to be enable on every mcbsp reception, and as my mcbsp is always receiving is should be set, I guess)

     

    Thank you in advance

     

  • As far as setting this up, you have to enable events for the edma channel before it starts servicing them.  Normally you configure the transfer channel, then enable events.  Now, configure the transfer channel, configure the link channel, then enable the mcbsp event.

     

    So, maybe the problem is that in my init_edma I made EESR=0x80 before configure paramset[3] and I would need to be in the opposite order???

  • James Thorton said:
    "The PaRAM sets associated with peripheral synchronization events should only be used for linking if the corresponding events are disabled". 

    Every EDMA channel has a working parameter set which it uses to keep track of where it is during a transfer. This means that the working PaRAM set is modified as the EDMA copies each piece of data. The note you highlighted from spru987 is suggesting that the ONLY time to link to a working set is when that PaRAM's event is disabled. For example, don't link set 3 to set 4 if EDMA channel 4 is enabled.

  • TimHarron said:

    "The PaRAM sets associated with peripheral synchronization events should only be used for linking if the corresponding events are disabled". 

    Every EDMA channel has a working parameter set which it uses to keep track of where it is during a transfer. This means that the working PaRAM set is modified as the EDMA copies each piece of data. The note you highlighted from spru987 is suggesting that the ONLY time to link to a working set is when that PaRAM's event is disabled. For example, don't link set 3 to set 4 if EDMA channel 4 is enabled.

    [/quote]

    Ok, I get it, as I was using peripheral with edma I thought it was refering to that. Thank you for clarifying me this. So, then, what is wrong? The links should work perfectly as the way I see

  • My next guess is that because you enabled the event using the EESR before configuring the Param set, specifically the link parameter, that you are getting a first event execute which links to a null set, which then generates an error an the next mcbsp event which will never be cleared since you aren't checking for it.  You could look at the SER/EMR registers to see if an error is being generated, but I think you are right about the problem.

  • Oh, I see the behaviour that you say. Yeah, that can be happening (in the other hand I think I took a quick look to the error registers and I did not see anything). Thank you very much, I will check it on the next monday