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.

EVMK2G: Manual trigger of the EDMA channel with DSP c66x

Part Number: EVMK2G

Hi experts,

For my work I developed a bare metal code on the evaluation board EVMK2G that is loaded in the DSP C66x by means of the on-board debugger TI XDS2xxx.

I downloaded the ti-processor-sdk-rtos-k2g-evm-06.03.00.106-Windows-x86-Install.exe and I installed CCS10.2

Currently I want to program the EDMA in order to copy data between memories.

I run the CSL example C:\ti_hpc\pdk_k2g_1_0_16\packages\ti\csl\example\edma\edma_test.c and it does not work.

#include "edma.h"
#include <stdio.h>
//#include <ti/csl/csl_edma3.h>
//#include <ti/csl/csl_edma3Aux.h>
//#include <ti/csl/csl_cacheAux.h>
//#include <ti/csl/hw_types.h>
#include <ti/csl/soc/k2g/src/cslr_soc_baseaddress.h>


/* Global Buffers (Source and Destination) for PING-PONG */
Uint8 srcBuff1[3];
Uint8 dstBuff1[3];
CSL_Edma3Context context;
CSL_Edma3Obj edmaObj;
CSL_Edma3Handle hModule;
CSL_Status status;
CSL_Edma3ChannelHandle hChannel;
CSL_Edma3ChannelAttr chAttr;
CSL_Edma3ChannelObj chObj;
CSL_Edma3ParamSetup myParamSetup;
CSL_Edma3ParamHandle hParamSet2;
CSL_Edma3CmdIntr regionIntr;

void main_dma (void)
{
    Uint8  channelNum = 0;
    Uint8  instNum = 0;
    Uint32 loopIndex;
    Uint32 ParamSetNum = 2;

    printf ("\n**************************************************\n");
    printf ("***************** EDMA Testing start *************\n");
    printf ("**************************************************\n");

    /* Start the EDMA PING-PONG test over the Global Region. */
    printf ("Debug: Testing EDMA(%d) Ping-Pong Test (Global) Region for Channel %d...\n", instNum, channelNum);

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

    CSL_edma3Init(&context);  // Module initialization

    hModule = CSL_edma3Open(&edmaObj, instNum, NULL, &status); // Open the EDMA Module using the provided instance number

    chAttr.regionNum = CSL_EDMA3_REGION_GLOBAL;
    chAttr.chaNum    = channelNum;
    hChannel = CSL_edma3ChannelOpen(&chObj, instNum, &chAttr, &status);

    CSL_edma3HwChannelSetupQue(hChannel,CSL_EDMA3_QUE_1);

    CSL_edma3MapDMAChannelToParamBlock (hModule, channelNum, ParamSetNum); // Map the DMA Channel 0 to PARAM Block 2 (Channel0 --> Paramset2)

    hParamSet2 = CSL_edma3GetParamHandle(hChannel, ParamSetNum, &status); // Obtain a handle to parameter set 2


          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    = (Uint32)srcBuff1;
            myParamSetup.aCntbCnt   = CSL_EDMA3_CNT_MAKE(5,1);
            myParamSetup.dstAddr    = (Uint32)dstBuff1;
            myParamSetup.srcDstBidx = CSL_EDMA3_BIDX_MAKE(1,1);
            myParamSetup.linkBcntrld= CSL_EDMA3_LINKBCNTRLD_MAKE(0,0);
            myParamSetup.srcDstCidx = CSL_EDMA3_CIDX_MAKE(0,1);
            myParamSetup.cCnt = 1;


            CSL_edma3ParamSetup(hParamSet2,&myParamSetup);

            regionIntr.region = CSL_EDMA3_REGION_GLOBAL;
            regionIntr.intr   = 0x3;
            regionIntr.intrh  = 0x0000;
            CSL_edma3HwControl(hModule,CSL_EDMA3_CMD_INTR_ENABLE,&regionIntr);

            //CSL_edma3HwChannelControl(hChannel,CSL_EDMA3_CMD_CHANNEL_SET,NULL); // Trigger channel
            CSL_edma3SetDMAChannelEvent ((CSL_Edma3Handle)hChannel,hChannel->region, hChannel->chaNum);

    printf ("**************************************************\n");
    printf ("***************** EDMA Testing End ***************\n");
    printf ("**************************************************\n");

    /* The test passed. */
    return 0;

} // end main_dma

I noticed that the EDMACC0_ESR register has not been set. Therefore, the manual trigger would not be set.

Can the DSP manually triggers a DMA channel?

According the TMR of 66AK2G1x: "The event set registers (EDMACC_ESR/EDMACC_ESRH) allows the DSP (EDMA programmers) to manually set events to initiate DMA transfer requests. DSP writes of 1 to any event set register (E n) bits set the corresponding bits in the registers".

I simply tried the basic command HW_WR_REG32(0x2701010U, 0x01) where 0x2701010 is the address of EDMACC0_ESR. However, by means of the debugger I verified that the register ESR is always 0x0.

Any suggestions concerning how to manually trigger an EDMA channel by means of the DSP?

I thank you in advance.

Best regards,

Benito 

  • Hi Benito,

    Please refer to the TRM, section 10.3.6.1.2 - Manually-Triggered Transfer Request. You'll need to have a valid PaRAM set associated with the DMA channel that you want to manually trigger.

    Regards,

    Jianzhong

  • Dear mr Jianzhong,

    thank you for your feedback.

    You'll need to have a valid PaRAM set associated with the DMA channel that you want to manually trigger.

     Is the setting of the register ESR ineffective in case which the paramset is not valid,?

    Is this the reason for which my command line HW_WR_REG32(0x2701010U, 0x01)  does not set the corresponding bit in ESR register?

    Thank you in advance.

    Best regards,
    Benito

  • Hi Benito,

    I believe so. Below is from the TRM:

    If the PaRAM set associated with the channel is a NULL set (see Section 10.3.5.3), then no transfer request (TR) is submitted and the corresponding E n bit in EDMACC_ER is cleared and simultaneously the corresponding channel bit is set in the event miss register (EDMACC_EMR.E n = 1) to indicate that the event was discarded due to a null TR being serviced. Good programming practices should include clearing the event missed error before re-triggering the DMA channel.

    You can check EDMACC_EMR and see if the corresponding bit is set.

    Regards,

    Jianzhong

  • Dear mr. Jianzhong,

    thank you for your feedback.

    The problem was the SRC and DST fields within the Parameter set.

    Specifically, in my code EDMA should copy data between two different addresses within L2SRAM memory (C66X_COREPAC_LOCAL_L2_SRAM).

    I wrote the following codelines:

    myParamSetup.srcAddr = (Uint32)(srcBuff1); // address is 0x831698
    myParamSetup.dstAddr = (Uint32)(dstBuff1); // address is 0x831670

    However, in accordance with the memory map shown in TMR, C66X_COREPAC_LOCAL_L2_SRAM  is reserved to other device masters.

    Aimed at solving, I changed the source and destination addresses from  C66X_COREPAC_LOCAL_L2_SRAM (base address 0x800000) to C66X_COREPAC_0_L2_SRAM (base address 0x10800000).

    I hope this will be useful to other users.

    Thank you for your support.

    Best regards,

    Benito Carotenuto