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.

CToolslib EDMA doesn`t work.



I`m using TCI6638, CCS v5.5, mcsdk 3.1.1.4.

There is a example, and it works. (path : C:\ti\mcsdk_bios_3_01_01_04\examples\ctools\evmk2h\mc_pc_trace_edma_drn)

But, when I apply to my project, It doesn`t work.

My project is using UART, IPC, and No EDMA.

I added codes below this.

in cfg file.

/* Load the Trace Debug Package */
xdc.loadPackage('ti.sdo.edma3.drv');
var ctools = xdc.loadPackage('ctoolslib_sdk.evmk2h');

and cpp file

int DspShellReadMem(const char * * params, int param_cnt)
{
	uint32_t*   pBuffer = 0;
	int32_t     coreId, i;
	ctools_Result ctools_ret = {0};
	ctools_edma_result_t pct_edma_res;
	EDMA3_RM_Handle  edma3_handle;
	ctools_etb_config_t config = {0};
	/* channel arrary */
	uint32_t  edma3_channels[10] = {0};
	/* param array */
	uint32_t  edma3_params[10] = {0};

	coreId = DNUM;

	/* 1. Initialize the ETB */
	/* 1a. Get the EDMA requirements/pre-setups for the ctools use case library */
	edma3_handle = app_edma_pre_setup(&edma3_channels[0], &edma3_params[0]);
	if (NULL == edma3_handle)
		return -2;
	config.edmaConfig.param_ptr    = &edma3_params[0];
	config.edmaConfig.dbufAddress  = (uint32_t)&trace_data;
	config.edmaConfig.dbufBytes    = 0x2000;
	config.edmaConfig.mode         = CTOOLS_USECASE_EDMA_STOP_BUF_MODE;
	config.etb_mode                = eETB_TI_Mode;
	if (CTOOLS_SOK != ctools_etb_init(CTOOLS_DRAIN_ETB_EDMA, &config, CTOOLS_DSP_ETB))
		return -1;

	/* 3. Initialize the DSP trace
	     * Please refer to the ctools use case library Doxygen API reference
	     * Guide for the API usage */
	ctools_ret = ctools_dsptrace_init();
	if (ctools_ret != CTOOLS_SOK)
	{
	    System_printf (" ctools_dsptrace_init failed\n");
		exit (1);
	}

	ctools_ret = ctools_pct_setup(&example_start_symb, &example_stop_symb);
	//ctools_ret = ctools_pct_start_now();
	if (ctools_ret != CTOOLS_SOK)
	{
		System_printf (" ctools_pct_start_exc failed\n");
		return -1;
	}

	/* trigger the PC trace start in ETB when PC hits this function */
	example_start_symb();

	if (param_cnt != 3)
	{
		MAKE_DATA("[usage] : read_mem [start address(hex value)] [size(words)]\r\n");
		MAKE_DATA("example : read_mem 80000000 16\r\n");
		return 1;
	}

	unsigned long addr = strtoul(params[1], NULL, 16);
	int size = atoi(params[2]);
	unsigned long * ptr = (unsigned long *)addr;
	Cache_wbInvAll();

	for (int i=0; i<size; ++i)
	{
		MAKE_DATA("[%d] => 0x%08X\r\n", i, ptr[i]);
	}

	/* Trigger the PC trace stop when PC hits this function*/
	example_stop_symb();
	//if (CTOOLS_SOK != ctools_pct_stop_now()) return -2;

	/* 5. Call PC trace job close, to drain the collected trace
	 * This would copy ETB hardware buffer as a linear buffer
	 * containing PC and timing traces to the memory provided here
	 */
	ctools_ret = ctools_etb_edma_drain(&pct_edma_res, CTOOLS_DSP_ETB);

	if(ctools_ret == CTOOLS_SOK)
	{
		System_printf("ctools_etb_edma_drain successful, %d bytes would be available in the &etb_drain_mem[%d] memory\n", pct_edma_res.availableWords, DNUM);
	}
	else
	{
		System_printf("ctools_pct_stop_cpu_drn failed [%d]\n", ctools_ret);
	}

	/* 6. close the PCT */
	ctools_pct_close();

	/* 7. Shutdown the dsp trace */
	ctools_ret = ctools_dsptrace_shutdown();
	if(ctools_ret == CTOOLS_SOK)
	{
		System_printf("ctools_dsptrace_shutdown successful\n");
	}
	else
	{
		System_printf("ctools_dsptrace_shutdown failed\n");
	}

	System_flush();

	return 1;
}

when I execute this code, There is No Error. 

In console window message, 

edma3init() Passed
ctools_etb_edma_drain successful, 2048 bytes would be available in the &etb_drain_mem[0] memory
ctools_dsptrace_shutdown successful

But, in trace_data buffer memory, there is no data. 

What is problem? please help me. I have no idea.

  • Hi HyunJoon,
    I am checking with experts. We will get back to you shortly. Thank you for your patience.
  • Hi,

    Thanks for your post.

    To log the PC trace information while ETB is drained by EDMA, please follow the steps to execute the Ctools PC trace examples on the wiki below:

    http://processors.wiki.ti.com/index.php/MCSDK_UG_Chapter_Developing_Debug_Trace#PC_Trace_where_ETB_is_drained_by_EDMA

    Also, I would recommend you to use Trace Decoder utility which is available from CCS and there is a sample usage on the above wiki which should provide the PC trace dump to the console. For the usage of Trace decoder utility, please refer the below wiki:

    http://processors.wiki.ti.com/index.php/TD#Introduction

    All cToolsLib libraries and other example source are available in zip files from the cToolsLib gForge site and there is a generated Doxygen API description included with each CToolsLib. You could download the same from the below wiki:

    http://processors.wiki.ti.com/index.php/CToolsLib#Download

    Also, there are run Instructions for CToolsLib IPC based demo applications which is available on MCSDK 3.x user guide page no. 152. Please search in google for "MCSDK 3.x User Guide".

    Thanks & regards,

    Sivaraj K

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

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

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

  • CPU drain works. but after using EDMA drain, buffer is empty.
    Could you tell me how to debug it? for example, EDMA settting check, etc...
  • Hi,

    Thanks for your update.

    For that reason only, you need to decode trace data and to decode trace from a binary dump of the ETB memory, two tools are avaialble, one is Bin2TDF utility and the other is TD utility which are the traditional debug methods to trace the failures, but this is difficult in investigating intermittent and real-time failures. To know more info. on utilities, please see below:

    http://processors.wiki.ti.com/index.php/BIN2TDF

    http://processors.wiki.ti.com/index.php/TD

    ETB is an on-chip circular memory buffer where the compressed trace information is stored and to get started with CCS Embedded Trace Buffer (ETB) Trace tooling, please refer below:

    http://processors.wiki.ti.com/index.php/Embedded_Trace_Buffer#How_to_get_started_with_CCS_Embedded_Trace_Buffer_.28ETB.29_Trace_tooling

    Thanks & regards,

    Sivaraj K

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

     

     

  • I already said "There is No data in Trace buffer".

    Why do you suggest about decoding trace data??

  • Hi,

    If there is no data in trace buffer, it could be of hardware or software issue. First, please figure out, if it is a hardware JTAG connectivity issur or a software ETB setup configuration issue. If any JTAG connectivity issues, you could debug JTAG connectivity http://processors.wiki.ti.com/index.php/Debugging_JTAG_Connectivity_Problems

    I presume that, you are transporting ETB data using JTAG, instead, you could also use across Ethernet/SRIO/HPI etc.

    If any software issue, please validate the ETB setup configuration in your software code and the reference code snippet for setup ETB receiever, dump_ETB and exporting the data are shown on the wiki below:

    http://processors.wiki.ti.com/index.php/Capturing_ETB_Trace_Data_With_ETBLib#main.28.29

    In order to capture data in trace buffer, we need to initialize the ETB and the DSP trace hardware. Also, you need the AET unit to trigger trace on and off and we need to program AET to turn trace on and off at the appropriate points, thereby, ETB will capture data. So, could you please validate setting up the ETB receiver, AET programming and later dumpEtb( ) call to move the ETB data to memory.

    Thanks & regards,

    Sivaraj K

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

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

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

  • Thanks for reply.

    Then, I want to know some debug points.

    1. AET trigger state : when I want to trigger start trace, how can I figure it out triggered or not?

    2. ETB state : if (1) is triggered, which register do i have to review?

     

    Thanks.

  • HyunJoon,

    Apologize for the delay. I was reviewing your post and CToolsLib using below wiki.

    As per above wiki, queries on CToolsLib is supported on CCS forum. By any chance, have you checked there. Please find the link to CCS forum below. Do not forget to put CToolsLib on title.

    Thank you.

  • I modified sample codes. (app_edma.c)

        //For Keystone2, only 3 link params are required: Params0,1 are not needed and Params2,3,4 are needed
        *(params_ptr + 0) = 0;
        *(params_ptr + 1) = 0;
    
        //Get param resources for  link Params2,3 and 4
        edma3_res_desc.type   = EDMA3_RM_RES_PARAM_SET;
        for (i=2;i<(num_params+2);i++)
        {
            edma3_res_desc.resId = EDMA3_RM_RES_ANY;
        	edmaResult = EDMA3_RM_allocResource(hEdma, &edma3_res_desc);
        	if (edmaResult != EDMA3_RM_SOK)
        		return NULL;
    
        	*(params_ptr + i) = edma3_res_desc.resId;
        }


    In this case, ctools lib use params_ptr[0],[1],[2], but sample code use [2],[3],[4].

    so, sample code use channel 0 twice. (index 0,1)

    index 0 is using for half full EDMA drain, and index 1 for full EDMA drain.

    Cause, both of them are using same EDMA channel (ch 0),

    half full EDMA setting was overwritten by full EDMA setting.

    after all, I fixed that and works well.

     

        //For Keystone2, only 3 link params are required: Params0,1 are not needed and Params2,3,4 are needed
        //*(params_ptr + 0) = 0;
        //*(params_ptr + 1) = 0;
    
        //Get param resources for  link Params2,3 and 4
        edma3_res_desc.type   = EDMA3_RM_RES_PARAM_SET;
        for (i=0;i<(num_params);i++)
        {
            edma3_res_desc.resId = EDMA3_RM_RES_ANY;
        	edmaResult = EDMA3_RM_allocResource(hEdma, &edma3_res_desc);
        	if (edmaResult != EDMA3_RM_SOK)
        		return NULL;
    
        	*(params_ptr + i) = edma3_res_desc.resId;
        }

     

  • Thank you for the update.