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.

edma initialization of c6657

Hi, when I initialize EDMA3 in c6657, it got error after executing "hModule = CSL_edma3Open(&edmaObj, 0, NULL, &status);". When I debugged the code, the value of hModule is NULL. What's the problem? thanks.

The following is part of the code:


void main()
{
//3.1 edma initialization for ddr3 test
CSL_Edma3Handle hModule;
CSL_Edma3Obj edmaObj;
CSL_Edma3ParamHandle hParam;
CSL_Edma3ChannelObj chObj;
CSL_Edma3ChannelHandle hChannel;
CSL_Edma3ParamSetup myParamSetup;
CSL_Edma3Context context;
CSL_Edma3ChannelAttr chAttr;
CSL_Edma3CmdIntr regionIntr;
uint32_t instNum;
uint32_t channelNum;
uint8_t *srcBuff1;
uint8_t *dstBuff1;
uint32_t index;

instNum = 0;
channelNum = 0;
srcBuff1 = (uint8_t *)0x80000000;
dstBuff1 = (uint8_t *)0xA0000000;

for(index=0; index<256; index++)
srcBuff1[index] = index;

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

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


/* 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;
}
.............................................
}

  • Hi,

    Thanks for your post.

    I presume that, you are using CSL initialization procedure for EDMA in your example.

    You have CSL based EDMA examples at the below loaction for C6678 which could be used as sample reference for C6657 as well:

    ~\ti\mcsdk_2_01_02_06\pdk_C6678_1_1_2_6\packages\ti\csl\example\edma\edma_test.c

    The above is the  EDMA example test code uses the EDMA CSL functional layer for the c6678 device.  You can build it for other targets (C6670, C6657 ) too through copying the above EDMA test source code into a new empty CCS project and link the functional CSL EDMA library (file name : ti.csl.ae66 ) by adding the directory to the library search path to the project properties->File Search Path. Then you can build this EDMA example in CCS and run without any issues.

    http://processors.wiki.ti.com/index.php/CSL#Chip_Support_Library_for_C6670

    May be, i could recommend few suggestion below:

    1. Ensure whether TCINTEN bit is enabled in channel OPT and only then, the interrupt pending register (IPR / IPRH) relevant bit position appropriate to the DMA event would be set on transfer completion

    2. Also, please ensure the TCCMODE bit in OPT which would indicate normal or early completion of data transfer. To clarify you that any TCC value cannot be set in the PaRAM and the fact is that the 6-bit TCC would be posted by the TC to the CC after it receives the transfer completion signal from the destination peripheral in normal completion mode. This 6-bit code sets the relevant bit in the interrupt pending register (IPR [TCC] / IPRH [TCC]) for interrupt triggered.

    3. I would suggest you to validate the received TCC code in OPT first and obviously, the corresponding bit position in IPR/IPRH would be set which is directly the TCC value and thereafter, the corresponding IER[TCC] / IERH [TCC] bit would be set to generate a EDMA completion interrupt to the DSP

    Thanks & regards,

    Sivaraj K

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

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

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

  • Hi, I have solved the problem. In CSL_edma3Open() and CSL_edma3ChannelOpen(), it called the function

    CSL_Status CSL_edma3ccGetModuleBaseAddr
    (
    CSL_InstNum edmaNum,
    CSL_Edma3ModuleAttr* pParam,
    CSL_Edma3ModuleBaseAddress* pBaseAddress,
    CSL_Edma3CfgInfo* pCfgInfo
    )
    {
    CSL_Status status = CSL_SOK;

    if (pBaseAddress == NULL) {
    status = CSL_ESYS_INVPARAMS;
    }
    else {
    switch (edmaNum) {
    case CSL_TPCC_2:
    {
    /* Instance 2: Populate the Base Address... */
    pBaseAddress->regs = (CSL_Edma3ccRegsOvly)CSL_EDMA2CC_REGS;

    /* Populate the Configuration Information for this instance. */
    pCfgInfo->numDMAChannel = CSL_EDMA3_TPCC2_NUM_DMACH;
    pCfgInfo->numQDMAChannel = CSL_EDMA3_TPCC2_NUM_QDMACH;
    pCfgInfo->numINTChannel = CSL_EDMA3_TPCC2_NUM_INTCH;
    pCfgInfo->numParamsets = CSL_EDMA3_TPCC2_NUM_PARAMSETS;
    pCfgInfo->numEvque = CSL_EDMA3_TPCC2_NUM_EVQUE;
    pCfgInfo->numRegions = CSL_EDMA3_TPCC2_NUM_REGIONS;
    pCfgInfo->IsChannelMapping = TRUE;
    pCfgInfo->IsMemoryProtection = TRUE;
    break;
    }
    default:
    pBaseAddress->regs = (CSL_Edma3ccRegsOvly)NULL;
    status = CSL_ESYS_FAIL;
    }
    }
    return (status);
    }

    We can see in the function, only if edmaNum is equal to CSL_TPCC_2, the related parameters can be initialized.
    So, if we call the function CSL_edma3Open(), and CSL_edma3ChannelOpen(), the parameter edmaNum should be set to CSL_TPCC_2.
    CSL_TPCC_2 is defined in cslr_device.h:
    /** @brief Peripheral Instance of TPCC instances */
    #define CSL_TPCC_2 (2)
  • Hi,

    Glad to hear your update which would help other community members in E2E.

    Thanks for sharing your update.

    Regards,
    Sivaraj K