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.

TMDSEVM6474L EDMA interrupt example problem



Example project provided with EVM/CCS demonstrates a simple EDMA/TCC interrupt. The example will run successfully for a single run. To run a second time, it is necessary to reset the EVM. It appears that the pending interrupt is cleared in the handler. What is missing that the interrupt will not function multiple times?

  • Fred,

    Welcome to the E2E Forum.

    I do not have one of the EVM6474L's and I do not have the MCSDK that comes with it. My guess is that is what you are refering to. Can you give me some specifics, like the exact file path to the specific example project you are working with or starting from?

    It is very likely that the example was designed to do just what you find that it does: it will run once to do a transfer and generate an interrupt. Without knowing anything else about the project that what you have said above, I would suggest running it once and then doing a Restart in CCS to start the program over. If you try running it in a loop without restoring the PARAM, then it may set a bunch of error conditions that will prevent it from running until a hard reset or a bunch of error repairs occur.

    Please let me know if the Restart works, after running only once.

    Regards,
    RandyP

  • Hi,RandyP

    You guess is right. This is the EVM6474L (fairly new) delivered with CCS 4.2.0.10012 There are two examples provided at the following locations (default install).

    C:\Program Files\Texas Instruments\pdk_c64x_1_00_00_06\packages\ti\csl\c6474\csl_c64xplus_intc\example\c64xplus\intc\intc_example1

    C:\Program Files\Texas Instruments\pdk_c64x_1_00_00_06\packages\ti\csl\c6474\csl_c6474\example\edma\edma_interrupt

     

    Both examples are near identical. I have run both and see the same results. From a cold start, I run the examples in the debugger and the program runs successfully.

    If I remain in the debugger and restart the program, it will not receive the interrupt. If I exit the debugger and restart the debug session, again it will not receive the interrupt.

    The problem still persists if I exit CCS and start a new session. The only way to clear the problem is the physically reset the EVM.

     

    I initially modified the example by placing a for loop around the manual trigger and flag check. As above, from cold start it will complete the loop only once.

    What steps are needed to restore PARAM?

    I have noted a few differences in macro defs between this CSL release and code examples in the online video for C6474.

     

    Thanks, Fred

     

  • Fred,

    I have debugged some of these CSL examples before, and my latest copy of the main C file has been edited. I honestly do not know if it is in working condition or not and I am away from my EVM.

    My recommendation is to look at the thread How to synchronize the three cores of C6474 without DSP/BIOS. I do not know if the entire thread will be useful to you, but it is not too long. On the last post dated Feb 18, 2010, I attached an example project that runs on one C6474. If some of the text talks about a second DSP, it is what I had on my EVM, but only one DSP is needed.

    This example does a bit more than what you were trying to do, but it does generate interrupts using the EDMA. It also generates interrupts using the IPC, and it uses DSP/BIOS to make things easier.

    You might need to update it for SYS/BIOS, if you are using that. Or you might want to compare it to the example code you were trying to run from the CSL examples.

    Please let me know if this helps or if you have any problems accessing or running the example. I also have a version that does not use DSP/BIOS, if that is a problem for your application. BIOS makes a lot of things easier to keep track of and easier to setup.

    Regards,
    RandyP

  • RandyP,

    I attempted to convert and run the project you indicated. An unexpected, error indicates the MemWindows is not supported. (CCSV4.2) also locked up the debugger and had to force a system reset. I will continue work and see if I can resolve this problem.

    You indicate you have a version that does not use DSP/BIOS. could you provide that version so I can compare?

    I also ran the original simple example provided with MCSDK/CSL. I found a couple of interesting points. The code contains the following line to enable the channel.

       /* Enable Channel :- though not required for a manual trigger */
        status = CSL_edma3HwChannelControl(hChannel,CSL_EDMA3_CMD_CHANNEL_ENABLE, \
                                           NULL);   

    The comment indicates not required for manual trigger, however it will not work without this line.

    Also noted that after the manual trigger, the handler is called. Viewing the registers for shadow region 1 after the handler has completed, ESR is set to 1.

    The handler contains the following line to clear pending interrupts.

        CSL_edma3HwControl(hModule,CSL_EDMA3_CMD_INTRPEND_CLEAR,&regionIntr);

    Can't find a  way to clear the ESR, documents indicate it is handled by the transfer control.

    Thanks,

    Fred

     

  • These examples were written for CCS 3.3, but should not be very difficult to run under CCSv4.2.

    I have attached the non-BIOS version, named C6474_Edma_IPC.zip.

    Whenever I am trying to figure out what is going on with some of these CSL functions, I just look at their source code. That is available to you, right? You can look in there and find the registers that are being written and tested, and those could help figure out why something is needed.

    Fred Jaworsky said:

       /* Enable Channel :- though not required for a manual trigger */
        status = CSL_edma3HwChannelControl(hChannel,CSL_EDMA3_CMD_CHANNEL_ENABLE, \
                                           NULL);   

    The comment indicates not required for manual trigger, however it will not work without this line.

    The comment is correct. You do not need to write 1 to the Event Enable Register in order for the manual trigger of writing 1 to the Event Set Register to cause a trigger.

    Fred Jaworsky said:
    Also noted that after the manual trigger, the handler is called. Viewing the registers for shadow region 1 after the handler has completed, ESR is set to 1.

    The interrupt handler should be called after the manual trigger, since the DMA transfer will run and the interrupt comes right after that. But ESR should never read with a 1 in it. This means an error has occurred, and that is why things are messed up afterward.

    Fred Jaworsky said:
    Can't find a  way to clear the ESR, documents indicate it is handled by the transfer control.

    I have never tried to clear ESR directly. Have you tried to write a 0 to it?

    If ESR is stuck at 1, that means the Event Missed Register and Secondary Event Register are most likely both set. The channel got triggered too many times for the way it was programmed, and the ESR bit is ready to trigger again once those are cleared.

    You should not be in the position of having EMR and SER set, so clearing them in your program is usually not necessary but it can be convenient for re-initializing the EDMA3 module and for the occasional error in a very busy, complex system. It should not happen in an example like this, in my opinion.

    But, to thoroughly clear these registers, you should write to EMCR 4 times then to SECR 1 time. The extra writes to EMCR are to make sure any pending triggers are passed on. ER, ESR, and CER could all be set while EMR is set, and each time you clear EMR one of those will try to trigger the channel again and may set EMR again.

    Fred Jaworsky said:
    An unexpected, error indicates the MemWindows is not supported.

    MemWindows is a function in the Debug.gel file which has to be manually loaded into your project. It might not have the proper syntax for CCSv4.2, but you can just manually create 3 memory windows to watch Buf1, Buf2, and Buf3.

    Please let me know if you have any issues with the non-BIOS example above.

    Regards,
    RandyP

    C6474_Edma_IPC.zip
  • RandyP

    Found a solution to the problems in the CSL example. For reference, I stuck with the example at the following location:

    C:\Program Files\Texas Instruments\pdk_c64x_1_00_00_06\packages\ti\csl\c6474\csl_c64xplus_intc\example\c64xplus\intc\intc_example1

    Original example code for Module setup is as follows:

     /* Edma module setup */
        hwSetup.dmaChaSetup  = &dmahwSetup[0];
        hwSetup.qdmaChaSetup = NULL;
        CSL_edma3HwSetup(hModule,&hwSetup);

    I changed this code to the following:

     

        /* Edma module setup */
        dmahwSetup[0].paramNum = 0;
        dmahwSetup[0].que      = CSL_EDMA3_QUE_0;
        hwSetup.dmaChaSetup = &dmahwSetup[0];
        hwSetup.qdmaChaSetup = NULL;
        status = CSL_edma3HwSetup(hModule,&hwSetup);

    This change fixed the problem with ESR being set and not able to clear. From the EDMA3 documentation, don't seem to be any way to directly clear ESR.

    It also appears to be why it was necessary to Enable Channel. With the change, it is not necessary to Enable the channel as you indicated.

    Finally, is the problem of  looping to manually trigger the channel multiple times. The original code would only loop one time. On the second trigger,

    the interrupt never occurred. Inspecting the PARAM set, I noticed the static setting was CSL_EDMA3_STATIC_DIS changing to

    CSL_EDMA3_STATIC_EN cleared the problem and I can now call trigger the channel multiple times.

     

    I do appreciate the examples you provided and will refer to them as my project moves forward.

     

    Thanks,

    Fred


  • Fred,

    You can now start answering EDMA3 questions on the forum. You know a lot about using it and coding it.

    What did you have for the declaration for dmahwSetup[]? And what do you have for it now?

    The proper declarations are

        CSL_Edma3HwDmaChannelSetup    dmahwSetup[CSL_EDMA3_NUM_DMACH] =
                                        CSL_EDMA3_DMACHANNELSETUP_DEFAULT;
        CSL_Edma3HwQdmaChannelSetup qdmahwSetup[CSL_EDMA3_NUM_QDMACH] =
                                        CSL_EDMA3_QDMACHANNELSETUP_DEFAULT;

    and then make the pair of assignments

        hwSetup.dmaChaSetup = &dmahwSetup[0];
        hwSetup.qdmaChaSetup = &qdmahwSetup[0];

    although I use the simpler form as long as the types are all correct:

        hwSetup.dmaChaSetup = dmahwSetup;
        hwSetup.qdmaChaSetup = qdmahwSetup;

    The explicit initializations you did for channel 0

        dmahwSetup[0].paramNum = 0;
        dmahwSetup[0].que      = CSL_EDMA3_QUE_0;

    should have been the same as the values in CSL_EDMA3_DMACHANNELSETUP_DEFAULT, and I know that some of our examples do not declare dmahwSetup correctly. But all of the intc_example1.c files I could find do set it correctly. So I am curious why that would have affected your program. Probably not worth exploring since you have it working, so why bother, right?

    Fred Jaworsky said:
    Inspecting the PARAM set, I noticed the static setting was CSL_EDMA3_STATIC_DIS changing to CSL_EDMA3_STATIC_EN cleared the problem and I can now call trigger the channel multiple times.

    CSL_EDMA3_STATIC_EN will only work when CCNT=1 and either BCNT=1 or you use AB_SYNC. It is almost always correct to use CSL_EDMA3_STATIC_EN with QDMA channels.

    Good luck with your future EDMA3 work. Keep us posted.

    Regards,
    RandyP