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.

TMS320C6672: EDMA3 questions

Part Number: TMS320C6672

Hello.
I want to use EDMA3 to my custom 6672 board.
I referenced the edma_test.c code provided by the processor SDK(v03.03).

My goal is to copy 256 words array from DDR to FPGA (EMIF-16)

1. I think it is possible but I'm not sure cause EMIF-16 is 16 bit access as you know.

2. Now, I'm testing by copying from one buffer to another buffer.
I'm not sure how can set the second param.(procedure?)

After PaRAM set and manual trigger, what should I do?

I attached my code and the result said that the second trigger doesn't work. Thanks.

/******************************************************************************
 ** includes
 ******************************************************************************/
#define SOC_C6678 1

#include <stdio.h>
#include <ti/csl/csl_edma3.h>
#include <ti/csl/csl_edma3Aux.h>
#include <ti/csl/csl_cacheAux.h>

#include <ti/sysbios/BIOS.h>
#include <math.h>
#include <stdlib.h> /* malloc() */
#include <string.h> /* memset(), memcpy() */
#include <stdio.h>
#include <xdc/runtime/System.h>

#include <assert.h>
#include <time.h>
#include <xdc/std.h>
#include <xdc/runtime/Types.h>
#include <xdc/runtime/Timestamp.h>

#include "pll.h"
#include "psc.h"
#include "ddr3.h"
#include "gpio.h"
#include "emif.h"
#include "bit.h"
#include "mcGdbg.h"
#include "mcTMS320C6672.h"

#define TEST_SIZE				256

/******************************************************************************
 ** globals
 ******************************************************************************/
#if 0
Uint8 srcBuff1[TEST_SIZE];
Uint8 srcBuff2[TEST_SIZE];
Uint8 dstBuff1[TEST_SIZE];
Uint8 dstBuff2[TEST_SIZE];
#else
Uint16 srcBuff1[512];
Uint16 srcBuff2[512];
Uint16 dstBuff1[512];
Uint16 dstBuff2[512];
#endif

MC_VOID main(void)

{
    MC_INT16  testType = 0;
    int i, btn;
    //MC_INT32 status;
	MC_UINT32  temp = 0, err = 0, val = 0;
	Types_Timestamp64 ts1, ts2;
	Types_FreqHz freq;
	double processing_time, dbTemp;
	long long k;
	MC_UINT32 tempval[3] = {0};
	static int Test_Iter;
	tAInSigVal GcuAinSig;
	float temp1, temp2;

    CSL_Edma3Handle             hModule;
    CSL_Edma3Obj                edmaObj;
    CSL_Edma3ParamHandle        hParamPing;
    CSL_Edma3ParamHandle        hParamPong;
    CSL_Edma3ChannelObj         chObj;
    CSL_Edma3CmdIntr            regionIntr;
    CSL_Edma3CmdDrae            regionAccess;
    CSL_Edma3ChannelHandle      hChannel;
    CSL_Edma3ParamSetup         myParamSetup;
    CSL_Edma3Context            context;
    CSL_Edma3ChannelAttr        chAttr;
    CSL_Status                  status;
    Uint32                      loopIndex;
    Int32 						instNum = 0;
    Uint8 						channelNum = 0;
    Int32 						regionNum = 0;
    int 						j = 0;

    /* Initialize data  */
    for (loopIndex = 0; loopIndex < TEST_SIZE; loopIndex++)
    {
        srcBuff1[loopIndex] = loopIndex;
        dstBuff1[loopIndex] = 0;
    }

    /* Module initialization */
    if (CSL_edma3Init(&context) != CSL_SOK)
    {
        printf ("Error: EDMA module initialization failed\n");
        return -1;
    }

    /* Open the EDMA Module using the provided instance number */
    hModule = CSL_edma3Open(&edmaObj, instNum, NULL, &status);
    if ( (hModule == NULL) || (status != CSL_SOK))
    {
        printf ("Error: EDMA module open failed\n");
        return -1;
    }

    /* Channel open */
    chAttr.regionNum = CSL_EDMA3_REGION_GLOBAL;
    chAttr.chaNum    = channelNum;
    hChannel = CSL_edma3ChannelOpen(&chObj, instNum, &chAttr, &status);
    if ((hChannel == NULL) || (status != CSL_SOK))
    {
        printf ("Error: Unable to open EDMA Channel:%d\n", channelNum);
        return -1;
    }

    if(!instNum)
    {
        /* For first EDMA instance there are only 2 TCs and 2 event queues
         * Modify the channel default queue setup from 0 to 1
         */
         if (CSL_edma3HwChannelSetupQue(hChannel,CSL_EDMA3_QUE_1) != CSL_SOK)
        {
            printf ("Error: EDMA channel setup queue failed\n");
            return -1;
        }
    }
    else
    {
        /* For EDMA instance 1 and 2 maximum of 4 TCs and 4 event queues are supported
         * Change Channel Default queue setup from 0 to 3
         */
        if (CSL_edma3HwChannelSetupQue(hChannel,CSL_EDMA3_QUE_3) != CSL_SOK)
        {
            printf ("Error: EDMA channel setup queue failed\n");
            return -1;
        }
    }

    /* Map the DMA Channel to PARAM Block 2. */
    CSL_edma3MapDMAChannelToParamBlock (hModule, channelNum, 2);

    /* Obtain a handle to parameter set 2 */
    hParamPing = CSL_edma3GetParamHandle(hChannel, 2, &status);
    if (hParamPing == NULL)
    {
        printf ("Error: EDMA Get Parameter Entry failed for 2.\n");
        return -1;
    }

    /* Setup the parameter entry parameters (Ping buffer) */
    myParamSetup.option = CSL_EDMA3_OPT_MAKE(CSL_EDMA3_ITCCH_DIS, \
                                             CSL_EDMA3_TCCH_DIS, \
                                             CSL_EDMA3_ITCINT_DIS, \
                                             CSL_EDMA3_TCINT_EN, \
                                             0, CSL_EDMA3_TCC_NORMAL,\
                                             CSL_EDMA3_FIFOWIDTH_NONE, \
											 CSL_EDMA3_STATIC_EN, \
                                             CSL_EDMA3_SYNC_A, \
                                             CSL_EDMA3_ADDRMODE_INCR, \
                                             CSL_EDMA3_ADDRMODE_INCR );
    myParamSetup.srcAddr    = (Uint32)srcBuff1;
    myParamSetup.aCntbCnt   = CSL_EDMA3_CNT_MAKE(TEST_SIZE*sizeof(Uint16),1);
    myParamSetup.dstAddr    = (Uint32)dstBuff1;
    myParamSetup.srcDstBidx = CSL_EDMA3_BIDX_MAKE(0,0);
    myParamSetup.linkBcntrld= CSL_EDMA3_LINKBCNTRLD_MAKE(0xFFFF,0);
    myParamSetup.srcDstCidx = CSL_EDMA3_CIDX_MAKE(0,0);
    myParamSetup.cCnt = 1;

    /* Ping setup */
    if (CSL_edma3ParamSetup(hParamPing,&myParamSetup) != CSL_SOK)
    {
        printf ("Error: EDMA Parameter Entry Setup failed\n");
        return -1;
    }

    /* Interrupt enable (Bits 0-1)  for the global region interrupts */
    regionIntr.region = CSL_EDMA3_REGION_GLOBAL;
    regionIntr.intr   = 0x3;
    regionIntr.intrh  = 0x0000;
    CSL_edma3HwControl(hModule,CSL_EDMA3_CMD_INTR_ENABLE,&regionIntr);

    /* Trigger channel */
    CSL_edma3HwChannelControl(hChannel,CSL_EDMA3_CMD_CHANNEL_SET,NULL);

    regionIntr.region = CSL_EDMA3_REGION_GLOBAL;
    regionIntr.intr   = 0;
    regionIntr.intrh  = 0;

    /* Poll on IPR bit 0 */
    do {
        CSL_edma3GetHwStatus(hModule,CSL_EDMA3_QUERY_INTRPEND,&regionIntr);
    } while (!(regionIntr.intr & 0x1));

    /* Clear the pending bit */
    CSL_edma3HwControl(hModule,CSL_EDMA3_CMD_INTRPEND_CLEAR,&regionIntr);

    for (i=0; i<TEST_SIZE; i++)
    {
    	if (srcBuff1[i] != dstBuff1[i])
		{
			printf("Error Test #1 : i = %d\n", i);
			break;
		}
    }

   // memset(dstBuff1, 0x0, sizeof(TEST_SIZE*sizeof(Uint16)))
    for (loopIndex = 0; loopIndex < TEST_SIZE; loopIndex++)
    {
        dstBuff1[loopIndex] = 0;
        //dstBuff2[loopIndex] = 0;
    }

    /* Ping setup */
    if (CSL_edma3ParamSetup(hParamPing,&myParamSetup) != CSL_SOK)
    {
        printf ("Error: EDMA Parameter Entry Setup failed\n");
        return -1;
    }

    /* Interrupt enable (Bits 0-1)  for the global region interrupts */
    regionIntr.region = CSL_EDMA3_REGION_GLOBAL;
    regionIntr.intr   = 0x3;
    regionIntr.intrh  = 0x0000;
    CSL_edma3HwControl(hModule,CSL_EDMA3_CMD_INTR_ENABLE,&regionIntr);

    /* Trigger channel */
    CSL_edma3HwChannelControl(hChannel,CSL_EDMA3_CMD_CHANNEL_SET,NULL);

    regionIntr.region = CSL_EDMA3_REGION_GLOBAL;
    regionIntr.intr   = 0;
    regionIntr.intrh  = 0;

    /* Poll on IPR bit 0 */
    do {
        CSL_edma3GetHwStatus(hModule,CSL_EDMA3_QUERY_INTRPEND,&regionIntr);
    } while (!(regionIntr.intr & 0x1));

    /* Clear the pending bit */
    CSL_edma3HwControl(hModule,CSL_EDMA3_CMD_INTRPEND_CLEAR,&regionIntr);

    for (i=0; i<TEST_SIZE; i++)
    {
    	if (srcBuff1[i] != dstBuff1[i])
		{
			printf("Error Test #2 : i = %d\n", i);
			break;
		}
    }

    /* [9] Enable interrupts and start SYS/BIOS */
    BIOS_start();
}

/* End of File : Main.c */

[C66xx_0] Error Test #2 : i = 1

  • Hello!
    If you take a look at your device block diagram, you'll notice, that EMDA3 peripheral exists outside DSP core, they are connected over TeraNet. That implies, that EDMA3 lives in global address space. In the same time, your program running on the core lives in its local address space unless you are taking precautions (you're not). Thus the first thing to try is to configure EDMA3 PaRAM with source and destination addresses being global. You may find functions called Convert_CoreLocal2GlobalAddr() or convert_coreLocalToGlobalAddr() in PDK examples or in pdk_your device\packages\ti\platform\your_evm_l\platform_lib\src\platform.c. It adds upper bits to address so EDMA peripheral knows physical location of the data.
    Hope this helps.

  • It seems that I should change core local address space to global address space by using conver_corelocal2GlobalAddr() function.
    And would you please help me what should I do after the converting?
    Thanks
  • You'll have to assign global addresses to src/dst like

    myParamSetup.srcAddr    = Convert_CoreLocal2GlobalAddr( (Uint32)srcBuff1 );
    myParamSetup.dstAddr    = Convert_CoreLocal2GlobalAddr( (Uint32)dstBuff1 );

    And that all, there you go. You trigger transfer manually and then poll for completion as it already written in your code.

  • Doing above you can make sure your transfer was set up correctly and runs as expected over memory buffers in DSP's memory. When you about to communicate with FPGA, just put appropriate address to src/dst. EMIF16 data space addresses are global, though the function from platform library cares about that and won't spoil them. And one more good news is that EDMA3 ensures cache coherency when targeted to L2SRAM. So if your source or destination buffer resides in L2SRAM, and other party in FPGA, you don't care about caching, that will be done for you.
  • It seems that most of my question was answered. But I have a question PaRAM set.
    I want to use Manual triggering and it seems that I should use the Linking for auto reloading. Is it right?
    And I have no idea that.. After the manual triggering how EDMA3 can find proper PaRAM set ?
    (It seems that channel is mapped to PaRAM set and there are queues for each channel but when I trigger the EDMA3, how EDMA3 can find proper channel ?)
    Thanks.
  • During the transfer PaRAM is modified, so you are right, for the next transfer you have to setup PaRAM again. To develop your understanding and get familiar with peripheral you may start with PaRAM configuration on each run. You may create a structure for PaRAM configuration and then simply reapply it for each transfer, I am doing exactly this way in my app. Literally I am doing CSL_edma3ParamSetup() followed by CSL_edma3HwChannelControl( handle, CSL_EDMA3_CMD_CHANNEL_SET, NULL ) for every transfer.
    I've read about sel-link reload, but had not tried by myself. If you go further, than me, please share your findings.
  • Thank you for your reply. Really helped..
    I'll share if I go further...
  • This is the code for the self auto reloading.

    Define 2 Param handles and only one is mapped.(hParamPing) By linking self PSET, I can do self auto reloading.

    (I attached the original code)

    And I find it works properly when the code is on L2 but it doesn't on MSMC. The problem is maybe..because of the cache.

     Do you know what is the difference between global and shadow region? (If you know, please teach me.)

        /* Obtain a handle to parameter set 2 */
        hParamPing = CSL_edma3GetParamHandle(hChannel, 2, &status);
        if (hParamPing == NULL)
        {
            printf ("Error: EDMA Get Parameter Entry failed for 2.\n");
            return -1;
        }
        /* Obtain a handle to parameter set 2 */
        hParamPong = CSL_edma3GetParamHandle(hChannel, 1, &status);
        if (hParamPong == NULL)
        {
            printf ("Error: EDMA Get Parameter Entry failed for 255.\n");
            return -1;
        }
    
        /* Setup the parameter entry parameters (Ping buffer) */
        myParamSetup.option = CSL_EDMA3_OPT_MAKE(CSL_EDMA3_ITCCH_DIS, \
                                                 CSL_EDMA3_TCCH_DIS, \
                                                 CSL_EDMA3_ITCINT_DIS, \
                                                 CSL_EDMA3_TCINT_EN, \
                                                 0, CSL_EDMA3_TCC_NORMAL,\
                                                 CSL_EDMA3_FIFOWIDTH_NONE, \
    											 CSL_EDMA3_STATIC_DIS, \
                                                 CSL_EDMA3_SYNC_A, \
                                                 CSL_EDMA3_ADDRMODE_INCR, \
                                                 CSL_EDMA3_ADDRMODE_INCR );
        myParamSetup.srcAddr    = Convert_CoreLocal2GlobalAddr((Uint32)srcBuff1);
        myParamSetup.aCntbCnt   = CSL_EDMA3_CNT_MAKE(TEST_SIZE*sizeof(Uint16),1);
        myParamSetup.dstAddr    = Convert_CoreLocal2GlobalAddr((Uint32)dstBuff1);
        myParamSetup.srcDstBidx = CSL_EDMA3_BIDX_MAKE(0,0);
        myParamSetup.linkBcntrld= CSL_EDMA3_LINKBCNTRLD_MAKE(hParamPong,1);
        myParamSetup.srcDstCidx = CSL_EDMA3_CIDX_MAKE(0,0);
        myParamSetup.cCnt = 1;
    
        /* Ping setup */
        if (CSL_edma3ParamSetup(hParamPing,&myParamSetup) != CSL_SOK)
        {
            printf ("Error: EDMA Parameter Entry Setup failed\n");
            return -1;
        }
    
        /* Pong setup */
        if (CSL_edma3ParamSetup(hParamPong,&myParamSetup) != CSL_SOK)
        {
            printf ("Error: EDMA Parameter Entry Setup failed\n");
            return -1;
        }

    Thanks.

    /******************************************************************************
     ** includes
     ******************************************************************************/
    #define SOC_C6678 1
    
    #include <stdio.h>
    #include <ti/csl/csl_edma3.h>
    #include <ti/csl/csl_edma3Aux.h>
    #include <ti/csl/csl_cacheAux.h>
    
    #include <ti/sysbios/BIOS.h>
    #include <math.h>
    #include <stdlib.h> /* malloc() */
    #include <string.h> /* memset(), memcpy() */
    #include <stdio.h>
    #include <xdc/runtime/System.h>
    
    #include <assert.h>
    #include <time.h>
    #include <xdc/std.h>
    #include <xdc/runtime/Types.h>
    #include <xdc/runtime/Timestamp.h>
    
    
    /******************************************************************************
     ** defines
     ******************************************************************************/
    #define TEST_SIZE				256
    
    /******************************************************************************
     ** typedefs
     ******************************************************************************/
    
    
    /******************************************************************************
     ** globals
     ******************************************************************************/
    #if 0
    Uint8 srcBuff1[TEST_SIZE];
    Uint8 srcBuff2[TEST_SIZE];
    Uint8 dstBuff1[TEST_SIZE];
    Uint8 dstBuff2[TEST_SIZE];
    #else
    Uint16 srcBuff1[512];
    Uint16 srcBuff2[512];
    Uint16 dstBuff1[512];
    Uint16 dstBuff2[512];
    #endif
    
    /******************************************************************************
     ** locals
     ******************************************************************************/
    
    MC_VOID main(void)
    {
        int i, btn;
    
        CSL_Edma3Handle             hModule;
        CSL_Edma3Obj                edmaObj;
        CSL_Edma3ParamHandle        hParamPing;
        CSL_Edma3ParamHandle        hParamPong;
        CSL_Edma3ChannelObj         chObj;
        CSL_Edma3CmdIntr            regionIntr;
        CSL_Edma3CmdDrae            regionAccess;
        CSL_Edma3ChannelHandle      hChannel;
        CSL_Edma3ParamSetup         myParamSetup;
        CSL_Edma3Context            context;
        CSL_Edma3ChannelAttr        chAttr;
        CSL_Status                  status;
        Uint32                      loopIndex;
        Int32 						instNum = 0;
        Uint8 						channelNum = 0;
        Int32 						regionNum = 0;
        int 						j = 0;
    
        /* Initialize data  */
        for (loopIndex = 0; loopIndex < TEST_SIZE; loopIndex++)
        {
            srcBuff1[loopIndex] = loopIndex;
            dstBuff1[loopIndex] = 0;
        }
    
        /* Module initialization */
        if (CSL_edma3Init(&context) != CSL_SOK)
        {
            printf ("Error: EDMA module initialization failed\n");
            return -1;
        }
    
        /* Open the EDMA Module using the provided instance number */
        hModule = CSL_edma3Open(&edmaObj, instNum, NULL, &status);
        if ( (hModule == NULL) || (status != CSL_SOK))
        {
            printf ("Error: EDMA module open failed\n");
            return -1;
        }
    
        /* Channel open */
        chAttr.regionNum = CSL_EDMA3_REGION_GLOBAL;
        chAttr.chaNum    = channelNum;
        hChannel = CSL_edma3ChannelOpen(&chObj, instNum, &chAttr, &status);
        if ((hChannel == NULL) || (status != CSL_SOK))
        {
            printf ("Error: Unable to open EDMA Channel:%d\n", channelNum);
            return -1;
        }
    
        if(!instNum)
        {
            /* For first EDMA instance there are only 2 TCs and 2 event queues
             * Modify the channel default queue setup from 0 to 1
             */
             if (CSL_edma3HwChannelSetupQue(hChannel,CSL_EDMA3_QUE_1) != CSL_SOK)
            {
                printf ("Error: EDMA channel setup queue failed\n");
                return -1;
            }
        }
        else
        {
            /* For EDMA instance 1 and 2 maximum of 4 TCs and 4 event queues are supported
             * Change Channel Default queue setup from 0 to 3
             */
            if (CSL_edma3HwChannelSetupQue(hChannel,CSL_EDMA3_QUE_3) != CSL_SOK)
            {
                printf ("Error: EDMA channel setup queue failed\n");
                return -1;
            }
        }
    
        /* Map the DMA Channel to PARAM Block 2. */
        CSL_edma3MapDMAChannelToParamBlock (hModule, channelNum, 2);
    
        /* Obtain a handle to parameter set 2 */
        hParamPing = CSL_edma3GetParamHandle(hChannel, 2, &status);
        if (hParamPing == NULL)
        {
            printf ("Error: EDMA Get Parameter Entry failed for 2.\n");
            return -1;
        }
        /* Obtain a handle to parameter set 2 */
        hParamPong = CSL_edma3GetParamHandle(hChannel, 1, &status);
        if (hParamPong == NULL)
        {
            printf ("Error: EDMA Get Parameter Entry failed for 255.\n");
            return -1;
        }
    
        /* Setup the parameter entry parameters (Ping buffer) */
        myParamSetup.option = CSL_EDMA3_OPT_MAKE(CSL_EDMA3_ITCCH_DIS, \
                                                 CSL_EDMA3_TCCH_DIS, \
                                                 CSL_EDMA3_ITCINT_DIS, \
                                                 CSL_EDMA3_TCINT_EN, \
                                                 0, CSL_EDMA3_TCC_NORMAL,\
                                                 CSL_EDMA3_FIFOWIDTH_NONE, \
    											 CSL_EDMA3_STATIC_DIS, \
                                                 CSL_EDMA3_SYNC_A, \
                                                 CSL_EDMA3_ADDRMODE_INCR, \
                                                 CSL_EDMA3_ADDRMODE_INCR );
        myParamSetup.srcAddr    = Convert_CoreLocal2GlobalAddr((Uint32)srcBuff1);
        myParamSetup.aCntbCnt   = CSL_EDMA3_CNT_MAKE(TEST_SIZE*sizeof(Uint16),1);
        myParamSetup.dstAddr    = Convert_CoreLocal2GlobalAddr((Uint32)dstBuff1);
        myParamSetup.srcDstBidx = CSL_EDMA3_BIDX_MAKE(0,0);
        myParamSetup.linkBcntrld= CSL_EDMA3_LINKBCNTRLD_MAKE(hParamPong,1);
        myParamSetup.srcDstCidx = CSL_EDMA3_CIDX_MAKE(0,0);
        myParamSetup.cCnt = 1;
    
        /* Ping setup */
        if (CSL_edma3ParamSetup(hParamPing,&myParamSetup) != CSL_SOK)
        {
            printf ("Error: EDMA Parameter Entry Setup failed\n");
            return -1;
        }
    
        /* Pong setup */
        if (CSL_edma3ParamSetup(hParamPong,&myParamSetup) != CSL_SOK)
        {
            printf ("Error: EDMA Parameter Entry Setup failed\n");
            return -1;
        }
        /* Interrupt enable (Bits 0-1)  for the global region interrupts */
        regionIntr.region = CSL_EDMA3_REGION_GLOBAL;
        regionIntr.intr   = 0x3;
        regionIntr.intrh  = 0x0000;
        CSL_edma3HwControl(hModule,CSL_EDMA3_CMD_INTR_ENABLE,&regionIntr);
    
        /* Trigger channel */
        CSL_edma3HwChannelControl(hChannel,CSL_EDMA3_CMD_CHANNEL_SET,NULL);
    
        regionIntr.region = CSL_EDMA3_REGION_GLOBAL;
        regionIntr.intr   = 0;
        regionIntr.intrh  = 0;
    
        /* Poll on IPR bit 0 */
        do {
            CSL_edma3GetHwStatus(hModule,CSL_EDMA3_QUERY_INTRPEND,&regionIntr);
        } while (!(regionIntr.intr & 0x1));
    
        /* Clear the pending bit */
        CSL_edma3HwControl(hModule,CSL_EDMA3_CMD_INTRPEND_CLEAR,&regionIntr);
    
        for (i=0; i<TEST_SIZE; i++)
        {
        	if (srcBuff1[i] != dstBuff1[i])
    		{
    			printf("Error Test #1 : i = %d\n", i);
    			break;
    		}
        }
        for (j=2; ; j++)
        {
    		memset(dstBuff1, 0x0, TEST_SIZE*sizeof(Uint16));
    
    #if 0
    		/* Ping setup */
    		if (CSL_edma3ParamSetup(hParamPing,&myParamSetup) != CSL_SOK)
    		{
    			printf ("Error: EDMA Parameter Entry Setup failed\n");
    			return -1;
    		}
    #endif
    		/* Interrupt enable (Bits 0-1)  for the global region interrupts */
    		regionIntr.region = CSL_EDMA3_REGION_GLOBAL;
    		regionIntr.intr   = 0x3;
    		regionIntr.intrh  = 0x0000;
    		CSL_edma3HwControl(hModule,CSL_EDMA3_CMD_INTR_ENABLE,&regionIntr);
    
    		/* Trigger channel */
    		CSL_edma3HwChannelControl(hChannel,CSL_EDMA3_CMD_CHANNEL_SET,NULL);
    
    		regionIntr.region = CSL_EDMA3_REGION_GLOBAL;
    		regionIntr.intr   = 0;
    		regionIntr.intrh  = 0;
    
    		/* Poll on IPR bit 0 */
    		do {
    			CSL_edma3GetHwStatus(hModule,CSL_EDMA3_QUERY_INTRPEND,&regionIntr);
    		} while (!(regionIntr.intr & 0x1));
    
    		/* Clear the pending bit */
    		CSL_edma3HwControl(hModule,CSL_EDMA3_CMD_INTRPEND_CLEAR,&regionIntr);
    
    		for (i=0; i<TEST_SIZE; i++)
    		{
    			if (srcBuff1[i] != dstBuff1[i])
    			{
    				printf("Error Test #%d : i = %d\n", j,i);
    				break;
    			}
    			if (i == TEST_SIZE-1) printf("Test #%d : PASS\n", j);
    		}
        }
        /* [9] Enable interrupts and start SYS/BIOS */
        BIOS_start();
    }
    
    

  • Hi,

    Regarding global region and shadow region, please look at:
    e2e.ti.com/.../259337
    processors.wiki.ti.com/.../EDMA3
    processors.wiki.ti.com/.../II_devices

    "And I find it works properly when the code is on L2 but it doesn't on MSMC"=====> do you mean code placement in L2 vs MSMC, or the data buffer in L2 vs MSMC? In either cases, are you able to see that IPR bit set indicating transfer finished? What do you mean NOT works properly?

    Regards, Eric
  • I meant the code placement.
    I ran multiple transfer(trigger) and I found that the first transfer worked OK but the others didn't work. (It worked only once.)
    Thank you.

  • Hi,

    I felt code put into MSMC or LL2 shouldn't make any difference. You just use 1 DSP core, correct? Where is the data source and destination buffer? What do you mean didn't work: code stuck? EDMA IPR didn't set? the destination buffer didn't get the data?

    Regards, Eric
  • The code is running on the L2 memory and I use only one core. I just declared srcbuff1 and dstbuff1 as global variable. (I think they were allocated in the L2 memory).

    As you can see my code, I tested 256 words transfer from srcbuff1 to dstbuff1 and check 256 words multiple times.

    When I ran the code on the MSMC, it seemed that 256 words transferred only one time. Thank you for your interest. It will improve my skills.

    
    

        for (j=2; ; j++)
        {
    		memset(dstBuff1, 0x0, TEST_SIZE*sizeof(Uint16));
    
    		/* Interrupt enable (Bits 0-1)  for the global region interrupts */
    		regionIntr.region = CSL_EDMA3_REGION_GLOBAL;
    		regionIntr.intr   = 0x3;
    		regionIntr.intrh  = 0x0000;
    		CSL_edma3HwControl(hModule,CSL_EDMA3_CMD_INTR_ENABLE,&regionIntr);
    
    		/* Trigger channel */
    		CSL_edma3HwChannelControl(hChannel,CSL_EDMA3_CMD_CHANNEL_SET,NULL);
    
    		regionIntr.region = CSL_EDMA3_REGION_GLOBAL;
    		regionIntr.intr   = 0;
    		regionIntr.intrh  = 0;
    
    		/* Poll on IPR bit 0 */
    		do {
    			CSL_edma3GetHwStatus(hModule,CSL_EDMA3_QUERY_INTRPEND,&regionIntr);
    		} while (!(regionIntr.intr & 0x1));
    
    		/* Clear the pending bit */
    		CSL_edma3HwControl(hModule,CSL_EDMA3_CMD_INTRPEND_CLEAR,&regionIntr);
    
                    /* Check 256 words */
    		for (i=0; i<TEST_SIZE; i++)
    		{
    			if (srcBuff1[i] != dstBuff1[i])
    			{
    				printf("Error Test #%d : i = %d\n", j,i);
    				break;
    			}
    			if (i == TEST_SIZE-1) printf("Test #%d : PASS\n", j);
    		}
        }
  • Hi,

    Your code doesn't show how the source buffer is initialized and for the infinite for loop, it seems that source buffer is not changed but you just clear the dstBuf to zero with memset. Do you have L2 cache enable? If yes, can you try cache invalidate with writeback after memset() to make sure dstBuf is cleared? Or, can you disable L2 cache to rule out any cache issue?

    Regards, Eric
  • Hello.

    Sorry for my late reply.

    I did some test about this issue. Let me share the result.

    SW Location Cache Setting * Result
    MSMC L1, L2 cache enable NOK
    L2 L1, L2 cache enable OK
    MSMC L1, L2 cache disable OK
    MSMC L1 cache disable, L2 cache enable OK

    * I set cache by using "Edit platform" window. (In debug perspective, Project > RTSC Tools > platform > ...)

    And I also want to know...

    What happen if I set L1, L2 as cache (maximum size cache set) and the SW placed on L2. ?

    Thanks.