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.

RTOS/TMS320C6657: EDMA3_DRV_create() fails

Part Number: TMS320C6657

Tool/software: TI-RTOS

Hello everyone

I'm still having problems bringing EDMA into life. My code looks like:

static unsigned int edma3InstanceId = 0, edma3RegionId = 1;
extern EDMA3_DRV_GblConfigParams sampleEdma3GblCfgParams[];                              // Also tried: extern EDMA3_DRV_GblConfigParams sampleEdma3GblCfgParams;
extern EDMA3_DRV_InstanceInitConfig sampleInstInitConfig[][EDMA3_MAX_REGIONS]; // also tried: extern EDMA3_DRV_InstanceInitConfig sampleInstInitConfig;

// And in the same source file: void edma_config(EDMA_T *EdmaObj) { EDMA3_DRV_Result edma3Result = EDMA3_DRV_SOK; // Set global config to defaults in sample Params (located in bios_edma3_drv_sample_C6455_cfg.c) EDMA3_DRV_GblConfigParams *globalConfig = &sampleEdma3GblCfgParams; // + edma3InstanceId; // Used in DRV_create() function to specify master/slave EDMA3_DRV_MiscParam miscParam; // Used for EDMA3_DRV_open() API and initCfg structure, defined in <edma3_drv.h> EDMA3_DRV_InitConfig initCfg; // Located in bios_edma3_drv_sample_C6455_cfg.c EDMA3_DRV_InstanceInitConfig *instanceConfig = &sampleInstInitConfig; // [edma3InstanceId] + edma3RegionId; // Declare Config structure used to initialize the Driver Instance (needed by DRV_open) initCfg.isMaster = TRUE; initCfg.regionId = edma3RegionId; // User must specify region (LLD/DRV does not support "global" region) initCfg.drvSemHandle = (void*)&os_sem; // Os_sem create in semaphore.c initCfg.drvInstInitConfig = instanceConfig; // Device-specific configuration - resources owned by region edma3regionId initCfg.gblerrCb = NULL; // Callback function to catch channel controller errors such as TCC error, // queue threshold exceeded, etc. initCfg.gblerrData = NULL; // any data required by the error callback function miscParam.isSlave = FALSE; // ARM + DSP, specify who is the master, single-chip = use FALSE // EDMA3 Driver Create (called only once for each EDMA3 hardware instance) edma3Result = EDMA3_DRV_create( edma3InstanceId, globalConfig, (void *)&miscParam ); if( edma3Result != EDMA3_DRV_SOK ) { Log_info0( "e@edma_config:EDMA3_DRV_create()" ); return; } }

The return value is not EDMA3_DRV_SOK . the context ma matter, so here goes a zip of the whole project (CCS7.3, pdk_2_0_7, edma3_lld_2_12_05_29):

gpio_edma1.zip

I've made same clean up in main.c, so only the edma3 functionality remains, but some more source files are there.

If anyone has a tip, it will be very helpful to me.

Kind regards,

Pablo

  • Hi Pablo,

    I've forwarded your query to the software experts. Their feedback should be posted here.

    BR
    Tsvetolin Shulev
  • Hello

    the reason for the problem is actually very silly: I coded this function call in a loop, and the corresponding "release" is outside.

    I hope nobody spent too much time on this. Kind regards,

    p.

  • Hi,

    For the C6657 with PDK 2.0.7, there is an example for MCBSP. In sample_init.c, it calls edma3init()----->EDMA3_DRV_create(). You can just use that code to see if you can create an EDMA instance (it should), then compare what differs in your code.

    Regards, Eric
  • Thank you Eric for pointing me to that example. I find many answers there. And also a question:

    That example contains a full definition of the EDMA3_RM_GblConfigParams[] array. Is it a definition tuned up for that particular example (MCBSP)? Or is it about C6657 properties that are common to any application using the EDMA3-LLD? In my previous code, I declared that array extern, and I though that the real definition came inside one of the edma-lld libraries I linked against (the linker gave no error). May be more than one definition is possible, but then I'm surprised that they have the same name. Do you have at hand a similar definition valid for the C6678 ?

    Kind regards,

    Pablo

  • Hi,

    The EDMA3_RM_GblConfigParams[] is a global array. In the MCBSP sample, it is defined in mcbsp\example\c6657\MCBSPDigLpbk\sample_c6657_cfg.c. The same is defined in EDMA LLD \ti\sdo\edma3\drv\sample\src\platforms\sample_c6657_cfg.c (the contents are exact the same). When both are defined in the application, the one in source code will be linked instead the other in the library. I didn't see the reason why need a separate sample_c6657_cfg.c in the example.

    For the same definition for C6678, you can find it under EDMA LLD: packages\ti\sdo\edma3\drv\sample\src\platforms

    Regards, Eric
  • Hello

    thank you! I like it that I'm finally understanding some details.

    I hope I can still ask one more little question here: I would like to understand what the following two arrays represent (from sample_c6657_int_reg.c, lines 67-73):

    ccXferHostInt[NUM_EDMA3_INSTANCES][NUM_DSPS] = {{0u, 20u}};
    edma3ErrHostInt[NUM_EDMA3_INSTANCES][NUM_DSPS]= {{1u, 21u}};

    The other arrays appear to be taken from the CIC0-Input-Event table. Are they hand-picked events of the CIC0/1 tables?

    Thanks and regards,

    p.

  • Hi,

    These are host interrupt, as you saw they are used in function CpIntc_enableHostInt(). So they are hand-picked from C6657 primary corepac interrupt table.

    Regards, Eric
  • Hello

    there are a couple of things that I cannot understand in the example. Do please tell me if I should open separate threads for these questions.

    [1]

    The region number. I've read in the tutorials that region 0 (zero) is for the supervisor, and that it is not supported by the LLD. So I used region 1. But the example uses the core number as the region.  Hence the first core is a supervisor? The example definitely makes use of the LLD, and the first few lines in main() basically state that the core number is zero.

    [2]

    The global structures EDMA3_RM_GblConfigParams and EDMA3_RM_InstanceInitConfig. We've already discussed that the example provides a definition of them. In my opinion, the definition provided by the library is constant and a user-program cannot modifiy it. Or can it? The example modifies the contents of both structures (source mcbspMasterDigLpbk.c, lines 946-957). It looks like the dma channels should be enabled by hand. I understand that those lines assume both edma-instance zero and region zero, but I do not understand the subscript "1" there:

    uint32_t temp;
    
    // ...
    
    /* Enabling the dmaChannel MCBSP Events to EDMA (36-40) */
    temp=sampleEdma3GblCfgParams[0].dmaChannelHwEvtMap[1];
    sampleEdma3GblCfgParams[0].dmaChannelHwEvtMap[1]= temp | 0x000000F0;
    
    /* Let RM Own the dmaChannels (36-40) */
    temp=sampleInstInitConfig[0][0].ownDmaChannels[1];
    sampleInstInitConfig[0][0].ownDmaChannels[1]=temp | 0x000000F0;
    
    /* Let RM Own the TCCs (36-40) */
    temp=sampleInstInitConfig[0][0].ownTccs[1];
    sampleInstInitConfig[0][0].ownTccs[1]= temp | 0x000000F0;
    
    /* Initialize EDMA3 library */
    hEdma[0] = edma3init(0, &edmaResult);
    

    I wonder if channels 36-40 are something special, or just a selection as anyone else (I assume the latter is right).

    Thanks and regards,

    Pablo

  • Ohhh, nooo.
    In the example provided with the pdk_c665x_2_0_7, there are two variables with the same name (sampleEdma3GblCfgParams) but different type. One is EDMA3_DRV_GblConfigParams and the other one EDMA3_RM_GblConfigParams.
    Same story with the instance config (sampleInstInitConfig).
    Needless to say, I fail to understand this trick.
    Regards,
    p.