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.

EDMA3 code crashes my code

Other Parts Discussed in Thread: TMS320C6678

Hi,

As I was using the driver for our EDMA3, 

While using "EDMA3 request channel" API, The code is getting aborted from running.

Snippet of my main routine is attached. Can any body help? Requirement state: critical

LCH and TCC values obtained both are then seen to be 0 only if I see the values after the routine. I tried this out for region 0 and region 1.

What could be wrong?

regards,

Sijomon

3683.MyMain.c
/*
 *  ======== main.c ========
 */

#include <xdc/std.h>
#include <stdio.h>
#include <xdc/runtime/Error.h>
#include <xdc/runtime/System.h>

#include <ti/sysbios/BIOS.h>

#include <ti/sysbios/knl/Task.h>
#include <ti/sysbios/knl/Semaphore.h>
#include <ti/sysbios/family/c66/Cache.h>

#include <ti/csl/csl_tsc.h>

#include "Delay_Computation.h"
#include "Delay_Computation_Structures.h"
#include "FilterCoeffs.h"

//EDMA3 LLDs
#include "ti\sdo\edma3\drv\edma3_drv.h"
#include "ti\sdo\edma3\drv\sample\bios6_edma3_drv_sample.h"
//EDMA3 LLDs

#define FHI(a)		_itof(_hi(a))
#define FLO(a)		_itof(_lo(a))

#pragma DATA_ALIGN(FFilterCoefficients, 32);
#pragma DATA_SECTION(FFilterCoefficients,"sect_C0");

    float FFilterCoefficients[UpsamplingFactor][FilterClarity];

#pragma DATA_ALIGN(FFilterCoefficientsAligned, 32);
#pragma DATA_SECTION(FFilterCoefficientsAligned,"sect_C0");

    float FFilterCoefficientsAligned[Vertical_Sensors][2*Horizontal_Sensors][8];

#pragma DATA_ALIGN(IMark, 32);
#pragma DATA_SECTION(IMark,"sect_C0");
#pragma DATA_ALIGN(ISpace, 32);
#pragma DATA_SECTION(ISpace,"sect_C0");

	UInt32 IMark[Vertical_Sensors][Horizontal_Sensors],
	ISpace[Vertical_Sensors][Horizontal_Sensors];

#pragma DATA_ALIGN(IMarkExtended, 32);
#pragma DATA_SECTION(IMarkExtended,"sect_MSMC");

	UInt32 IMarkExtended[Vertical_Sensors][2*Horizontal_Sensors];

#pragma DATA_ALIGN(FShadingCoeffs, 32);
#pragma DATA_SECTION(FShadingCoeffs,"sect_MSMC");

	float FShadingCoeffs[Vertical_Sensors][Vertical_Sensors];

#pragma DATA_ALIGN(FDelayArray,32);
#pragma DATA_SECTION(FDelayArray,"sect_C0");

	float FDelayArray[Vertical_Sensors][Horizontal_Sensors];
/*
#pragma DATA_ALIGN(IIndexArray,32);
#pragma DATA_SECTION(IIndexArray,"sect_C0");

	int IIndexArray[Vertical_Sensors][Horizontal_Sensors];
*/
	unsigned long long ULLStartTime,ULLEndTime;
	extern Semaphore_Handle Delay_Computation_Semaphore;
	extern Semaphore_Handle Beam_Former_Semaphore;
	UInt8 UISteering_Change=1;
	UInt runtimer=0,runtask=0;

	//This is a global structure for Delay Computation Task
	Delay_Computation_Task_Params SDelay_Computation_Params;
	Beam_Former_Task_Params SBeam_Former_Params;

#pragma DATA_ALIGN(FDataArray1, 32);
#pragma DATA_SECTION(FDataArray1,"sect_C0");

	float FDataArray1[nRing][nSensor][2*DataLength] = {
																					#include "data4000.txt"
																					};

#pragma DATA_ALIGN(FDataArray2, 32);
#pragma DATA_SECTION(FDataArray2,"sect_MSMC");

	float FDataArray2[nRing][nSensor][2*DataLength];

#pragma DATA_ALIGN(FOutputArrayUp,4);
#pragma DATA_SECTION(FOutputArrayUp,"sect_C0");

	float FOutputArrayUp[nBeam][IterationCount];

#pragma DATA_ALIGN(FOutputArraySt,4);
#pragma DATA_SECTION(FOutputArraySt,"sect_C0");

	float FOutputArraySt[nBeam][IterationCount];

#pragma DATA_ALIGN(FOutputArrayDn,4);
#pragma DATA_SECTION(FOutputArrayDn,"sect_C0");

	float FOutputArrayDn[nBeam][IterationCount];

//EDMA3  resources
	UInt32 edma3InstanceId = 0;
	// EDMA3 features specific to your device (e.g. found in bios_edma3_drv_sample_C6678_cfg.c)

	//EDMA3_DRV_GblConfigParams sampleParams;
	//EDMA3_DRV_GblConfigParams *globalConfig = &sampleParams;
	// Specifies sharing of EDMA3 between CPU�s
	//EDMA3_DRV_MiscParam miscParam;

	//EDMA3_DRV_ChainOptions Chaining_Options;

	extern Semaphore_Handle Semaphore_For_EDMA_Instance;
	EDMA3_DRV_Result  EDMA_Error_Code;

	extern EDMA3_DRV_InstanceInitConfig sampleInstInitConfig;
	EDMA3_DRV_InstanceInitConfig *InstInitConfig = &sampleInstInitConfig;

	EDMA3_DRV_InitConfig InitCfg;

	EDMA3_DRV_Handle  handleEDMA;

	int32_t SRCBIDX,DSTBIDX,SRCCIDX,DSTCIDX;
	UInt32 BCNTRLD,ACNT,BCNT,CCNT;
	uint16_t Link;

	uint32_t LCH = EDMA3_DRV_DMA_CHANNEL_ANY,Tcc = EDMA3_DRV_TCC_ANY;
//EDMA3  resources

#pragma FUNC_ALWAYS_INLINE(DotpMyFunc);
Void DotpMyFunc(const double Ptr1[restrict], const double Ptr2[restrict], float Ptr3[restrict],float Ptr4[restrict])
{
	int i,j;
	float FSum0,FSum1,FSum2,FSum3,FSum4,FSum5,FSum6,FSum7;
#pragma DATA_MEM_BANK(a,0);
#pragma DATA_MEM_BANK(b,4);
	double  a[4] ,b[4];

for(i=0;i<4;i++)
{
	a[i]=Ptr1[i];
	b[i]=Ptr2[i];
}

	for(i=0,j=0;i<IterationCount/2; i+=4, j+=8)
	{

		FSum0 = FHI(a[0]) * FHI(b[0]);
		FSum1 = FLO(a[0]) * FLO(b[0]);
		FSum2 = FHI(a[1]) * FHI(b[1]);
		FSum3 = FLO(a[1]) * FLO(b[1]);
		FSum4 = FHI(a[2]) * FHI(b[2]);
		FSum5 = FLO(a[2]) * FLO(b[2]);
		FSum6 = FHI(a[3]) * FHI(b[3]);
		FSum7 = FLO(a[3]) * FLO(b[3]);

		FSum0	+= FSum1;
		FSum2	+= FSum3;
		FSum4	+= FSum5;
		FSum6	+= FSum7;
		FSum0	+= FSum2;
		FSum4	+= FSum6;
		Ptr3[j] +=  FSum0 + FSum4;
		Ptr4[j] +=  FSum0 + FSum4;

		a[0]=Ptr1[i+4];

	 	FSum0 = FHI(a[1]) * FHI(b[0]);
		FSum1 = FLO(a[1]) * FLO(b[0]);
		FSum2 = FHI(a[2]) * FHI(b[1]);
		FSum3 = FLO(a[2]) * FLO(b[1]);
		FSum4 = FHI(a[3]) * FHI(b[2]);
		FSum5 = FLO(a[3]) * FLO(b[2]);
		FSum6 = FHI(a[0]) * FHI(b[3]);
		FSum7 = FLO(a[0]) * FLO(b[3]);

		FSum0	+= FSum1;
		FSum2	+= FSum3;
		FSum4	+= FSum5;
		FSum6	+= FSum7;
		FSum0	+= FSum2;
		FSum4	+= FSum6;
		Ptr3[j+2] +=  FSum0 + FSum4;
		Ptr4[j+2] +=  FSum0 + FSum4;

		a[1]=Ptr1[i+5];

	 	FSum0 = FHI(a[2]) * FHI(b[0]);
		FSum1 = FLO(a[2]) * FLO(b[0]);
		FSum2 = FHI(a[3]) * FHI(b[1]);
		FSum3 = FLO(a[3]) * FLO(b[1]);
		FSum4 = FHI(a[0]) * FHI(b[2]);
		FSum5 = FLO(a[0]) * FLO(b[2]);
		FSum6 = FHI(a[1]) * FHI(b[3]);
		FSum7 = FLO(a[1]) * FLO(b[3]);

		FSum0	+= FSum1;
		FSum2	+= FSum3;
		FSum4	+= FSum5;
		FSum6	+= FSum7;
		FSum0	+= FSum2;
		FSum4	+= FSum6;
		Ptr3[j+4] += FSum0 + FSum4;
		Ptr4[j+4] += FSum0 + FSum4;

		a[2]=Ptr1[i+6];

	 	FSum0 = FHI(a[3]) * FHI(b[0]);
		FSum1 = FLO(a[3]) * FLO(b[0]);
		FSum2 = FHI(a[0]) * FHI(b[1]);
		FSum3 = FLO(a[0]) * FLO(b[1]);
		FSum4 = FHI(a[1]) * FHI(b[2]);
		FSum5 = FLO(a[1]) * FLO(b[2]);
		FSum6 = FHI(a[2]) * FHI(b[3]);
		FSum7 = FLO(a[2]) * FLO(b[3]);

		FSum0	+= FSum1;
		FSum2	+= FSum3;
		FSum4	+= FSum5;
		FSum6	+= FSum7;
		FSum0	+= FSum2;
		FSum4	+= FSum6;
		Ptr3[j+6] += FSum0 + FSum4;
		Ptr4[j+6] += FSum0 + FSum4;

		a[3]=Ptr1[i+7];
	}
}
Void EDMA_CallBack(uint32_t tcc,
        EDMA3_RM_TccStatus status,
        void *appData)
{

}
Void Test_Timer_Function(void)
{
	if(UISteering_Change)
	{
		UISteering_Change=0;
		SDelay_Computation_Params.FAngleOffset=LEFT_SECTION;
		SDelay_Computation_Params.FVerticalAngle=0.0;
		SDelay_Computation_Params.FDelayArray=FDelayArray;
		SDelay_Computation_Params.IMark=IMark;
		SDelay_Computation_Params.ISpace=ISpace;

		Semaphore_post(Delay_Computation_Semaphore);
	}
	/*
		SBeam_Former_Params.FFilterCoeffs =FFilterCoefficients;
		SBeam_Former_Params.IMark=IMark;
		SBeam_Former_Params.ISpace=ISpace;
		SBeam_Former_Params.FInputArray= &FInputArray[Ping][0];//[Horizontal_Sensors][IterationCount+Surplous]
		SBeam_Former_Params.FOutputArray=&FOutputArray[Ping][0];//[Num_Vertical_Look_Directions][IterationCount]
		*/
		runtimer++;
		Semaphore_post(Beam_Former_Semaphore);


}

/*
 * Delay_Computation_Task_Wrapper_Function
 */
Void Delay_Compute_Task_Function(void)
{

	while(TRUE)
	{
//Attention: Parameters are to be passed to the task only via messages or mailboxes! Change later

	Semaphore_pend(Delay_Computation_Semaphore, BIOS_WAIT_FOREVER);

	Delay_Computation_Function(SDelay_Computation_Params.FAngleOffset,
												SDelay_Computation_Params.FVerticalAngle,
												SDelay_Computation_Params.FDelayArray);

	ReshapeFilterCoeffs(FilterCoeffs, FFilterCoefficients);

	MarkSpace_Compute(FDelayArray, IMark, ISpace);

	Delay_Rearrange(FFilterCoefficients,ISpace,FFilterCoefficientsAligned);

	Mark2MarkExtended(IMark,IMarkExtended);

	}
}

/*
 * Beam Former Task Function
 */
Void BeamFormerTTD3D_Task_Function(void)
{
	int IChannelCount,IBeamCount;
	int IRow, IColumn;
	UInt32 ITemp;

	const double * restrict Ptr1A;
	const double * restrict Ptr1B;
	const double * restrict PtrA;
	float* PtrOut1;
	float* PtrOut2;
	const double* Ptr3;
	const double* Ptr4;

	while(TRUE)
	{
		Semaphore_pend(Beam_Former_Semaphore, BIOS_WAIT_FOREVER);
		runtask++;
		//Attention: Parameters are to be passed to the task only via messages or mailboxes! Change later


		for(IRow=0 ; IRow < Vertical_Sensors ; IRow++ )
				{
					IBeamCount=0;

					for(IChannelCount=0; IChannelCount < nSensor; IChannelCount++)
						{
							Ptr1A=(const double*)&FDataArray1[IRow][IChannelCount][0];
							Ptr1B=(const double*)&FDataArray2[IRow][IChannelCount][0];
							PtrA=(const double*)&FFilterCoefficientsAligned[IRow][0][0];

							for(IColumn=0; IColumn< Horizontal_Sensors ; IColumn++)
								{

									ITemp = IMarkExtended[IRow][IColumn];

										if( ITemp & 0x4 )
										{
										Ptr3 =(const double*) ((UInt32)Ptr1B +  ITemp - 4); //if 17 is the shift, say then locate to 16 since already one delayed while storage
										Ptr4 =(const double*) ((UInt32)Ptr1A + ITemp + 4); //point to 18 to get the 18th shift
										}
										else
										{
										Ptr3 = (const double*) ((UInt32)Ptr1A + ITemp);
										Ptr4 = (const double*) ((UInt32)Ptr1B + ITemp);//1 shift, delayed already
										}

									PtrOut1 = &FOutputArrayUp[(IBeamCount + IColumn - Horizontal_Sensors) % nBeam][0];
									PtrOut2 = &FOutputArrayUp[(IBeamCount + 2*Horizontal_Sensors - IColumn -1 - Horizontal_Sensors) % nBeam][0];

									DotpMyFunc(Ptr3,PtrA,PtrOut1,PtrOut2);

									PtrOut1 = &FOutputArrayUp[(IBeamCount + IColumn - Horizontal_Sensors) % nBeam][1];
									PtrOut2 = &FOutputArrayUp[(IBeamCount + 2*Horizontal_Sensors - IColumn -1 - Horizontal_Sensors) % nBeam][1];

									DotpMyFunc(Ptr4,PtrA,PtrOut1,PtrOut2);

									PtrA+=4;//Note:This is a double variable
								}
							IBeamCount+=2;
							//printf("                             %d\n",IBeamCount);
						}
			}

	}

}
/*
 * MyStartupFunction
 */
Void MyStartupFunction(void)
{

	Cache_Size all_cache_sizes;

	all_cache_sizes.l1pSize=Cache_L1Size_32K;
	all_cache_sizes.l1dSize=Cache_L1Size_32K;
	all_cache_sizes.l2Size=Cache_L2Size_512K;

	Cache_setSize(&all_cache_sizes);
	Cache_wbInvAll();
	Cache_setMode(Cache_Type_ALL, Cache_Mode_NORMAL );

	SDelay_Computation_Params.FAngleOffset=LEFT_SECTION;
	SDelay_Computation_Params.FVerticalAngle=0.0;
	SDelay_Computation_Params.FDelayArray=FDelayArray;
	SDelay_Computation_Params.IMark=IMark;
	SDelay_Computation_Params.ISpace=ISpace;

	ReshapeFilterCoeffs(FilterCoeffs, FFilterCoefficients);//Here the stored filter coefficients are reshaped to aid the poly-phase implementation


	Delay_Computation_Function(SDelay_Computation_Params.FAngleOffset,
												SDelay_Computation_Params.FVerticalAngle,
												SDelay_Computation_Params.FDelayArray);

	MarkSpace_Compute(SDelay_Computation_Params.FDelayArray	,
									SDelay_Computation_Params.IMark,
									SDelay_Computation_Params.ISpace);


	//EDMA3_DRV_create (edma3InstanceId, globalConfig, (void *) &miscParam);

	EDMA_Error_Code = EDMA3_DRV_create (edma3InstanceId, NULL, NULL);

	//printf("\nEDMA_Error_Code = %d.", EDMA_Error_Code);

	InitCfg.isMaster = TRUE;
	InitCfg.regionId = 1;
	InitCfg.drvSemHandle = &Semaphore_For_EDMA_Instance;
	InitCfg.drvInstInitConfig = InstInitConfig;//This is a structure which is loaded from the edma_drv.h
	//InitCfg.drvInstInitConfig = NULL;//This is a structure which is loaded from the edma_drv.h

	if(EDMA_Error_Code == EDMA3_DRV_SOK)
	{
	handleEDMA = EDMA3_DRV_open(edma3InstanceId, (Void*) &InitCfg, &EDMA_Error_Code);
	}

	if(EDMA_Error_Code == EDMA3_DRV_SOK)
	{
	EDMA_Error_Code = EDMA3_DRV_requestChannel (handleEDMA, &LCH, &Tcc,  (EDMA3_RM_EventQueue)0 , &EDMA_CallBack,NULL);
	}
//#if 0
	//EDMA3_DRV_unlinkChannel (handleEDMA,LCH);//Linking is cleared if already linked

	//EDMA3_DRV_setOptField (handleEDMA, LCH, EDMA3_DRV_OPT_FIELD_SAM, EDMA3_DRV_ADDR_MODE_INCR);
	//EDMA3_DRV_setOptField (handleEDMA, LCH, EDMA3_DRV_OPT_FIELD_DAM, EDMA3_DRV_ADDR_MODE_INCR);
	//EDMA3_DRV_setOptField (handleEDMA, LCH, EDMA3_DRV_OPT_FIELD_SYNCDIM, EDMA3_DRV_SYNC_AB);

	if(EDMA_Error_Code == EDMA3_DRV_SOK)
	{
	EDMA_Error_Code = EDMA3_DRV_setOptField (handleEDMA, LCH, EDMA3_DRV_OPT_FIELD_STATIC, EDMA3_DRV_STATIC_DIS);
	}
	//EDMA3_DRV_setOptField (handleEDMA, LCH, EDMA3_DRV_OPT_FIELD_FWID, EDMA3_DRV_W8BIT);
	if(EDMA_Error_Code == EDMA3_DRV_SOK)
	{
	EDMA_Error_Code = EDMA3_DRV_setOptField (handleEDMA, LCH, EDMA3_DRV_OPT_FIELD_TCCMODE, EDMA3_DRV_TCCMODE_NORMAL);
	}

	//EDMA3_DRV_setOptField (handleEDMA, LCH, EDMA3_DRV_OPT_FIELD_TCC, 0);
	//Requires only if chaining is enabled, to set transfer completion code

	if(EDMA_Error_Code == EDMA3_DRV_SOK)
	{
		EDMA_Error_Code = EDMA3_DRV_setOptField (handleEDMA, LCH, EDMA3_DRV_OPT_FIELD_TCINTEN, EDMA3_DRV_TCINTEN_EN);
	}
	if(EDMA_Error_Code == EDMA3_DRV_SOK)
	{
		EDMA_Error_Code = EDMA3_DRV_setOptField (handleEDMA, LCH, EDMA3_DRV_OPT_FIELD_ITCINTEN, EDMA3_DRV_ITCINTEN_DIS);
	}
	if(EDMA_Error_Code == EDMA3_DRV_SOK)
	{
		EDMA_Error_Code = EDMA3_DRV_setOptField (handleEDMA, LCH, EDMA3_DRV_OPT_FIELD_TCCHEN, EDMA3_DRV_TCCHEN_DIS);
	}
	if(EDMA_Error_Code == EDMA3_DRV_SOK)
	{
		EDMA_Error_Code = EDMA3_DRV_setOptField (handleEDMA, LCH, EDMA3_DRV_OPT_FIELD_ITCCHEN, EDMA3_DRV_ITCCHEN_DIS);
	}

	/*
	Chaining_Options.itcchEn =	EDMA3_DRV_ITCCHEN_DIS ;
	Chaining_Options.itcintEn =EDMA3_DRV_ITCINTEN_DIS;
	Chaining_Options.tcchEn =EDMA3_DRV_TCCHEN_DIS;
	Chaining_Options.tcintEn =EDMA3_DRV_TCINTEN_EN;
	Requires if chaining is to be used.
	*/
	if(EDMA_Error_Code == EDMA3_DRV_SOK)
	{
		EDMA_Error_Code = EDMA3_DRV_setSrcParams (handleEDMA, LCH, (signed char*) GLOBAL_ADDR(_FDataArray1), EDMA3_DRV_ADDR_MODE_INCR, EDMA3_DRV_W8BIT);
	}
	if(EDMA_Error_Code == EDMA3_DRV_SOK)
	{
		EDMA_Error_Code = EDMA3_DRV_setDestParams(handleEDMA, LCH,(signed char*) GLOBAL_ADDR(_FDataArray2), EDMA3_DRV_ADDR_MODE_INCR, EDMA3_DRV_W8BIT);
	}
	SRCBIDX = 2048*4;//2048 float values
	SRCCIDX = 2048*4;
	if(EDMA_Error_Code == EDMA3_DRV_SOK)
	{
		EDMA_Error_Code = EDMA3_DRV_setSrcIndex (handleEDMA, LCH, SRCBIDX, SRCCIDX);
	}
	DSTBIDX = 2048*4;//2048 float values
	DSTCIDX = 2048*4;
	if(EDMA_Error_Code == EDMA3_DRV_SOK)
	{
		EDMA_Error_Code = EDMA3_DRV_setDestIndex (handleEDMA, LCH, DSTBIDX, DSTCIDX);
	}
	BCNTRLD= 2048;
	ACNT = 4;
	BCNT = 2048;
	CCNT = 7*72;
	if(EDMA_Error_Code == EDMA3_DRV_SOK)
	{
	EDMA_Error_Code = EDMA3_DRV_setTransferParams (handleEDMA, LCH, ACNT, BCNT, CCNT, BCNTRLD,EDMA3_DRV_SYNC_A);
	}
	if(EDMA_Error_Code == EDMA3_DRV_SOK)
	{
	//	EDMA_Error_Code = EDMA3_DRV_enableTransfer (handleEDMA, LCH, EDMA3_DRV_TRIG_MODE_MANUAL);
	}
printf("\n EDMA INIT COMPLETE.");

//#endif

	int i,j;
	for(i=0;i<144;i++)
		for(j=0;j<1024;j++)
          FOutputArrayUp[i][j]=0.0;

	/*
	for(i=0;i<7;i++)
		for(j=0;j<72;j++)
			for(k=0;k<2047;k++)
				FDataArray2[i][j][k]=FDataArray1[i][j][k+1];
*/
	//Delay_Rearrange(FFilterCoefficients,ISpace,FFilterCoefficientsAligned);

}

/*
 *  ======== main ========
 */

//#define Disable_Checks


Void main(){
    System_printf("enter main()\n");
/*
 * This is a Global Structure for managing the Delay Computation Task
 * Default Values
 */
    CSL_tscEnable();

    //ULLStartTime = CSL_tscRead() ;
    //Delay_Computation_Function(ON_ELEMENT, 0.0, IMark,ISpace, FDelayArray);
    //ULLEndTime = CSL_tscRead() - ULLStartTime;
    //MarkSpace_Compute(FDelayArray, IMark,ISpace);
    //BeamFormTTD3D(FFilterCoeffs,IMark,ISpace, FArrayIndex, FOutput);
	//miscParam.isSlave = FALSE;


    BIOS_start();     /* enable interrupts and start SYS/BIOS */
}

This is the exception system raised while running the code. Code was only upto the request channel API, rest of the edma related codes vwere commented.

8637.Exception.txt
Exception generated while program abort, What could be the reason?

[C66xx_0] 5a8 B25=0xc3f25b0
B26=0x805c9174 B27=0x1
B28=0x805c9174 B29=0x1
B30=0xc3f25a0 B31=0x805dd79d
NTSR=0x1d
ITSR=0xc3f2590
IRP=0x0
SSR=0xc3f24f4
AMR=0x2
RILC=0x0
ILC=0xc3f2598
Exception at 0x3c22f4
EFR=0x2 NRP=0x3c22f4
Internal exception: IERR=0x1
Instruction fetch exception
ti.sysbios.family.c64p.Exception: line 255: E_exceptionMin: pc = 0x805ba020, sp = 0x0c3f25b4.
To see more exception detail, use ROV or set 'ti.sysbios.family.c64p.Exception.enablePrint = true;'
xdc.runtime.Error.raise: terminating execution
5a8 B25=0xc3f25b0
B26=0x805c9174 B27=0x1
B28=0x805c9174 B29=0x1
B30=0xc3f25a0 B31=0x805dd79d
NTSR=0x1d
ITSR=0xc3f2590
IRP=0x0
SSR=0xc3f24f4
AMR=0x2
RILC=0x0
ILC=0xc3f2598
Exception at 0x3c22f4
EFR=0x2 NRP=0x3c22f4
Internal exception: IERR=0x1
Instruction fetch exception

  • Hi,

    one more development.

    I found the code was getting aborted when it is going into an if statement "if(drv->mapxbartochan != NULL)"

    when checked,  drv->mapxbartochan which we get from the edma3open function is 0x000000;

    So it should not go into the if condition. But I found that was happening even if the condition is false.

    Then inside when that function is called, OS raises an exception and gets out of execution.

    please help

    regards,

    sijomon

  • Hi sijomon,

    I hope you are working on C6678. Please confirm.

    Also provide below information to verify.

    1. Is it a Custom board or EVM?

    2. What are all the packages and version used?

    3. Have you tried any examples available in MCSDK?

    Thanks.

    MCSDK: http://software-dl.ti.com/sdoemb/sdoemb_public_sw/bios_mcsdk/latest/index_FDS.html

    UG: http://processors.wiki.ti.com/index.php/BIOS_MCSDK_2.0_User_Guide

  • Hi Sijomon,

    you're getting a Instruction fetch exception.

    This indicates that you're EDMA transfer is potentially overwriting your code.

    Please check that the EDMA tranfers are not over-running the size of the buffers you've allocated.

    Kind regards,

    one and zero

  • Hi Rajasekaran,

    regarding your questions, yes I am working on tms320c6678

    its a custom board.

    I could successfully make transfers with directly manipulating the associated registers, but don't want to do it because of the portability issues that may arise in the future, and also the associated resource share-ability difficulties between multiple cores. 

    I have gone through the complete documentation for edma3, right from peripheral user's guide to edma3 driver and rm user's guide.

    Also most of the source code related to driver but not that much of rm side has been scanned.

    So I thought I would rather go directly, rather than trying out any examples. The main reason for not trying out the examples, because they are not found to be well documented, maybe it's my personal view. The C code logic seems to be alright but I wonder why it's not going as per the logic while single stepping as I mentioned in the previous discussion. 

    What we usually do is that,we use the APIs available and then personally verify all the registers used by those APIs are programmed correctly. If that satisfies well, then seldom we change the version of that driver in order to have a tighter control over the system code. 

    Coming to our problem,

    I even pulled out the code for Request_Channel API from the source file and added it with my companion files for main code after noticing the issue, then the place where I got exception became alright, but got struck at later stages, which if required I can share.

    I reverted everything back because I definitely did not want to have my code not portable in the future.

    regarding the version of what I use

    CCS ver 5.4 (licenced)

    Sys/Bios 6.35.1.29

    EDMA3  2.11.10

    MCSDK 1.1.2.6

    CTools 1.0.0.02

    regards,

    Sijomon

     

     

  • Hi One and Zero,

    Yes I agree.

    But I have not yet initiated the EDMA3 transfer.

    The code gets crashed in between Request_Channel API.

    The exact place is where I mentioned in the previous discussion.

    The 'drvInst->mapXBarToChan' function pointer is set to be zero, before the request channel API is called. The 'if' condition which checks this in the 'request_channel' is going into the code, which is otherwise suppose to be skipped without executing it. But this is not what is seen. The image clearly conveys that, I think.

    I pulled out the code for this api alone and tried to compile it with my main code and tried to use it, of course with a different name, but then this particular issue became alright but got struck at a later stage, somewhere inside the 'resource_alloc' API which is a member of RM. I did not then go into the details of the exception. 

    The structure is ensured to be intact which is verified and even visible in the screen capture. 

    What can be done?

    regards,

    Sijomon Parackal, Irinjalakuda.

  • Hi Sijomon,

    you're exception happened at NRP=0x3c22f4. That means your code branched into a reserved area.


    This could have happened because of a too small stack size. But since the program does not behave as expected before the actual crash something went wrong already although not leading to the exception yet. Still could be stack size.

    Cache coherency could be another potential topic to look at. Is there any other master active on memory accesses besides the CPU? Is all your data and code in external memory?

    Could you debug the portion of assembly code where the pointer drvInst->mapXBarToChan is loaded. Maybe the pointer itself is already corrupted.

    Kind regards,

    one and zero

  • Hi one and zero,

    The package for the EDMA3 is not compiled by me. its already a pre-compiled one which I downloaded from the ti website as edma3 latest LLD. Yes what you have said is correct.If you look at the expressions window in the image which I have uploaded in one of the earlier discussions,it can be visually inspected that pointer is not populated with the address.The scenario described in that image is the point where the code is inside the 'request channel' API of the driver. As you can see  in the program display window, surely it should not go into the 'if' statement as the condition is tested to be false. Obviously if it goes inside, a branching towards 'mapxbartochan' function will be made with a start address of 0x0000000 which is the case for the exception.

    My question is why is this happening, what next is to be done to solve this?

    regards,

    Sijomon 

  • Hi Sijomon,

    As I said before:


    1. Try to increase the stack. BIOS offers a method to check on stack overflow. Please see:

    http://processors.wiki.ti.com/index.php/DSP_BIOS_Debugging_Tips#Cause:_Stack_overflow

    2. You need to figure out what's going wrong with the pointer. The screenshot you're referring to is already to far in execution. You need to break earlier and check what goes wrong with the pointer.


    Kind regards,

    One and zero

  • Hi one and zero, 

    I increased the stack size from 8192 to 16384 and tested, still the same problem.

    In the screenshot, I only intended to show that the if condition is ' wrongly ' executed. I took the screenshot at a point where the code was at a break point which I have placed inside the "if" condition. It is visible in the screen shot. But the drvInst->mapxbartochan, which is a function pointer, shown in the variable display region is not seen initialized. surely a branching towards address location 0x000000 will crash the code which is exactly what is happening. Also in disassembly view I don't see any compare instruction in the vicinity of if condition.  There is a break point just after the one which is not seen in the screenshot, the code is seen to be struck at. Unfortunately it is not seen in the screen shot. There are no instructions other than result =mapXBarToChan(..... ; The following run of the code crashes the code. Emulator gets disconnected so that I could not debug further. And the drvInst->mapxbartochan is equal to zero also. So I conclude this are "if" condition is executed wrongly. may be I am wrong. 

    But increasing the stack size in bios from default 8192 to 16384 resulted in no use.      

    regards,

    sijomon

  • Could somebody please move this thread to the Embedded Software Forum since this is really more of a EDMA3 LLD question ....


    Kind regards,

    one and zero

  • How can this be transferred to LLD forum then?

    regards,

    Sijomon Irinjalakuda.

  • Hi,

    I took the code of "EDMA3_Drv_Request_Channel" API and made an another  c file and header file and compiled along with my code. In that case the code cleared the earlier struck portion and now getting struck at resource manager's "allocResource" API. What to do now?Can a rebuild of EDMA3 LLD as a whole help?What is the mechanism by which we can rebuild a driver?

    please help

    regards,

    Sijomon Irinjalakuda. 

  • Hi,

    Any Help Possible?

    Sijomon Irinjalakuda

  • Hi,

    I found the problem for processor stall to be at the semaphore pend inside the alloc_resource api. then I commented that portion, recompiled and got through the problem. As of now, since I don't indent to use the request channel API in multiple tasks, I think I would go for it. But with all these difficulties, I could not succeed in making a transfer. I verified  the param set programmed using getParams API, tried to manually trigger and in A-Sync transfer mode, found the BCNT decremented once  and transfer gets aborted. 

    Request for SOS help at-least in this moment. Please somebody in this world to transfer this post to EDMA forum!!!

    Sijomon

  • Hi,

    While I was searching for any error bits set in CC as well as TC, in ERROR STATUS (at adderss 0x2760120) register of TC, MMRAERR bit is found to be set (Value of the register = 0x0000008). Even at the point where the program is halted at main(). Then I cleared the bit using Error Status Clear Register (at address 0x2760128) and went ahead. Every time it enters any of the api-s, of the driver, this value is again found to be set. 

    why is it happening? 

    Looks like no body is there in TI to support me?????

    regards,

    Sijomon

  • Sijomon,

    Can you double check the initialization of EDMA3 driver part on your main.c file.

    Already you saw the EDMA3 driver user guide.

    Following are the APIs which are used for the initialization:
    /* EDMA3 Driver Object Creation */
    EDMA3_DRV_create (unsigned int phyCtrllerInstId, const EDMA3_DRV_GblConfigParams
    *gblCfgParams, const void *param)


    /* EDMA3 Driver Instance Opening */
    EDMA3_DRV_open (unsigned int phyCtrllerInstId, const EDMA3_DRV_InitConfig *initCfg,
    EDMA3_DRV_Result *errorCode)

    These APIs should be mandatorily called once by the global initialization routine or by the user itself, for EDMA3 driver functioning. Also, they can be called further for other usage.

  • Pubesh,

    I had posted the main.c file in the first post. can you please check it and say if anything has gone wrong? The lld package is obviously the latest one downloaded from ti website with the sample file used for configuration.

    I get the handle and associated values as per my expectation. If required I can upload the param set I configured, which was read back using getparams api.

    regards,

    Sijomon Irinjalakuda .

  • Hi,

    Can you share the param set and  the channel numbers returned by EDMA3_DRV_requestChannel () function.

  • Hi Pubesh,

    Finally I got through!

    I was not setting intermediate chaining code to the same channel from where the tranfer is triggered in the PaRAM set. I did it and all started working fine. But no where in the EDMA3 document it is reinstated that in A-Sync mode if CCNT and BCNT is greater than 1 on in AB
    Sync mode if CCNT is greater than one ITCHEN must be set to get the work done . Or else, am I getting it done the way it is not intended to be? 

    If this is the right way then please modify the document with this information as an important one not to be missed by those who dive deep into the EDMA3 peripheral. If this is not the correct way and if I am missing some thing then I would upload the PaRAMs which I set. 

    But with all these I am left over with some pending issues.

    They are,

    Why the pre-compiled version is different from the source code?
    please see the earlier posts about how I reached till here.
     
    What happened at the semaphore pend and why it misbehaved inside drv_open API?
     
    If a mere recompilation would work for the source code, then what is the procedure to get it recompiled again.

     regards,

    Sijomon Irinjalakuda

  • Hi,

    Any suggestions?

    Sijomon

  • Sijomon,

    The Semaphore created for driver instance when edma3init.
    This handle is checked when EDMA3_DRV_open.
    It Used to acquire or free the semaphore, used for sharing of resources among multiple users.
    The sample code avilable for EMDA3 with param set, refer this wiki page.
    http://processors.wiki.ti.com/index.php/Programming_the_EDMA3_using_the_Low-Level_Driver_(LLD)

  • Hi,

    When I was going through the driver codes I encountered 2 similar structures in two files and during initialization both the structures are loaded in the memory.

    They are as follows:

    1)  EDMA3_RM_GblConfig_Params SampleEDMA3GblCfgParams[]  (found in the file edma3/rm/sample/src/Platform_Sample_c6678_cfg.c)   and

    2) EDMA3_RM_GblConfig_Params EDMA3GblCfgParams[] (found in the file edma3/rm/src/config/edma3_c6678_cfg.c)

    Also

    1) EDMA3_RM_Instance_Init_Config SampleInstInitConfig in (found in the file edma3/rm/sample/src/Platform_Sample_c6678_cfg.c) and

    2) EDMA3_RM_Instance_Init_Config defInstInitConfig  in  (found in the file edma3/rm/src/config/edma3_c6678_cfg.c)

    Any changes made in the latter (case 2) is not reflected any where in the process of the program but changes in the SampleInstInitConfig works out. But there also one funny issue. Even though I request channels after the handle is opened through region 1, the actual access is through region 0!  defined in SampleInstInitConfig.

    What I want to know is 1) what is the use of the structure defInstInitConfig in the program?

    Why I am getting access through region 0? at drive_open time I supply the address of defInstInitConfigthrough the init structure.

    Kindly help me out in this regard.

    Regards

    Sijomon Irinjalakuda

  • Sijomon,

    However this discussion of thread got verified already. It may be missed to the readers/experts to give the answer.
    Please post a new thread in E2E forum for help from the experts. If you create new thread, find the issue in the EDMA3_LLD, Even I can take over this to EDMA team to fix it on the next release.