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 use three EDMA3 channels to transfer data!!!

1. My hardware platform is TI TMS320C6678evm board

2. The software environment is CCS 5.4.0 and mcsdk_2_01_02_06

3. Now, due to the project, I need to use three EDMA3 channels to transfer data at the same time,  two channels is used to transfer data from DDR3 to L2SRAM and one channel from L2SRAM to DDR3. I use the following codes to request the channels.

unsigned int chId0= 0;
unsigned int chId1= 0;
unsigned int chId2= 0;
unsigned int tcc0= 0;
unsigned int tcc1= 0;
unsigned int tcc2= 0;
unsigned int edmaInstance = 1;

hEdma = edma3init(edmaInstance, &edmaResult);
 
/* Setup for Channel 1*/
tcc0 = EDMA3_DRV_TCC_ANY;
chId0= EDMA3_DRV_DMA_CHANNEL_ANY;

 
/* Request any DMA channel and any TCC */
result = EDMA3_DRV_requestChannel (hEdma, &chId0, &tcc0, (EDMA3_RM_EventQueue)0, NULL, NULL);
if (result == EDMA3_DRV_SOK)
    printf("DMA channel 0: %d\n", chId0);
else
    printf("DMA channel 0 request failed!\n");

 
tcc1= EDMA3_DRV_TCC_ANY;
chId1= EDMA3_DRV_DMA_CHANNEL_ANY;
result1= EDMA3_DRV_requestChannel (hEdma, &chId1, &tcc1, (EDMA3_RM_EventQueue)0, NULL, NULL);
if (result1== EDMA3_DRV_SOK)
    printf("DMA channel 1: %d\n", chId0);
else
    printf("DMA channel 1 request failed!\n");

 
tcc2= EDMA3_DRV_TCC_ANY;
chId2= EDMA3_DRV_DMA_CHANNEL_ANY;
result2= EDMA3_DRV_requestChannel (hEdma, &chId2, &tcc2, (EDMA3_RM_EventQueue)0, NULL, NULL);
if (result2 == EDMA3_DRV_SOK)
    printf("DMA channel 2: %d\n", chId2);
else
    printf("DMA channel 2 request failed! error code : %d\n", result2);

But only two channels(chId0 and chId1) work, the third channel have the error -132(EDMA3_DRV_E_DMA_CHANNEL_UNAVAIL), I know this means there are not enough DMA channels to support, but actually the hardware support 64 channel, I use 8 cores and every core corresponding to a region, each region should have 3 channels to work. The sum is 24 channels. So we should choose Instance1 to support these channels. I see some discussions in the forum, they said the reason why we can't open more than 2 channels having relationship with the sample_c6678_cfg.c file. If you want to use more channels, you should change the parameters in the sampleInstInitConfig. Due to the bit rules and no clash between different regions, I change the sampleInstInitConfig's ownPaRAMSets、ownDmaChannels and ownTccs. For example:   

            /* Resources owned/reserved by region 5 */
            {
                /* ownPaRAMSets */
                /* 31     0     63    32     95    64     127   96 */
                {0x00F00000u, 0x00000000u, 0x00000000u, 0x00000000u,
                /* 159  128     191  160     223  192     255  224 */
                 0x00000000u, 0x00000000u, 0xFFFFFFFFu, 0x00000000u,
                /* 287  256     319  288     351  320     383  352 */
                 0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u,
                /* 415  384     447  416     479  448     511  480 */
                 0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u},

                /* ownDmaChannels */
                /* 31     0     63    32 */
                {0x00F00000u, 0x00000000u},

                /* ownQdmaChannels */
                /* 31     0 */
                {0x00000020u},

                /* ownTccs */
                /* 31     0     63    32 */
                {0x00F00000u, 0x00000000u},

                /* ownQdmaChannels */
                /* 31     0 */
                {0x00000020u},

                /* ownTccs */
                /* 31     0     63    32 */
                {0x00F00000u, 0x00000000u},

                /* resvdPaRAMSets */
                /* 31     0     63    32     95    64     127   96 */
                {0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u,
                /* 159  128     191  160     223  192     255  224 */
                 0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u,
                /* 287  256     319  288     351  320     383  352 */
                 0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u,
                /* 415  384     447  416     479  448     511  480 */
                 0x00000000u, 0x00000000u, 0x00000000u, 0x00000000u},

                /* resvdDmaChannels */
                /* 31     0     63    32 */
                {0x00000000u, 0x00000000u},

                /* resvdQdmaChannels */
                /* 31     0 */
                {0x00000000u},

                /* resvdTccs */
                /* 31     0     63    32 */
                {0x00000000u, 0x00000000u},
            },

However, it still don't work. Someone said he made such changes and rebuilt the edma3_lld_rm_sample.ae6 making the program work, I don't how to do this, so I didn't do this. Does this really work?

4. At last, “C:\ti\edma3_lld_02_11_05_02\packages\ti\sdo\edma3\rm\sample\src\platforms\” and "C:\ti\edma3_lld_02_11_05_02\packages\ti\sdo\edma3\drv \sample\src\platforms\"  have the same sample_c6678_cfg.c file, do the two files work same? If I want to change the sampleInstInitConfig, should I change one of them or both?

  • Zhang Lei,

    Welcome to the TI E2E forum. I hope you will find many good answers here and in the TI.com documents and in the TI Wiki Pages (for processor issues). Be sure to search those for helpful information and to browse for the questions others may have asked on similar topics (e2e.ti.com). Please read all the links below my signature.

    We will get back to you on the above query shortly. Thank you for your patience.

  • Hi,

    Thanks for your post.

    With in the same TC and say, all three DMA channel events are mapped to it, then the transfer cannot be initiated at the same time and would completer one after other. But, if the three DMA channels are mapped to different TC's and all three TC's can initiate DMA transfer independently and simulataneously, all three DMA channels would transfer at the same time.

    I think, you have to rebuild the source code of edma_lld_rm_sample project which would regenerate the edma3_lld_rm_sample.ae6 which would work. Pls. try it

    In my opinion, each sample_c6678_cfg.c file would be unique to each edma3_lld which would require both the config. files, i believe so.

    Thanks & regards,

    Sivaraj K

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

    Please click the Verify Answer button on this post if it answers your question.

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

  • Hi Sivaraj K,

    I am sorry to reply so lately. For the first thing I read the EDMA3 controller User's Guide, I know the transfer channels of one TC would not open simulataneously, but I don't think it matters. My project use 8 cores work together, and each core corresponds to a region, so the channels of the different cores could transfer together as you say. Now, my problem is how to make each core have three channels to transfer data.

    Your second suggestion to rebuild the source code of edma_lld_rm_sample project, I don't know how it works.I try to import it to the CCS, and rebuild it with the edited sample_c6678_cfg.c file, but it has compile errors. Then I don't know what to do.

    The last question, in the EDMA3 driver user guide, it says: "EDMA3 Driver doesn’t allow multiple instances for a single master on the respective shadow region. It permits only one instance for each master which will be tied to its specific shadow region. " Does it mean core 0 could not use two EDMA3 Instances in the region 0? In my project, every region is used so I can't use two instances to transfer data?

    Thanks & regards,

    Lei