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.

C2000WARE: v 5.05 ERAD Configuration Bug?

Part Number: C2000WARE

Tool/software:

Hello,

I am using the ERAD on the F28838D to profile my code and v5.05 does not work, but v5.04 does. I diff'd the files and found this in erad.C:

        HWREGH(base + ERAD_O_CTM_INPUT_SEL_2) =
                ((uint16_t)stop_event << ERAD_CTM_INPUT_SEL_2_STO_INP_SEL_S);

Was changed from this:

        HWREGH(base + ERAD_O_CTM_INPUT_SEL_2) |=
                ((uint16_t)stop_event << ERAD_CTM_INPUT_SEL_2_STO_INP_SEL_S);

Removing that OR bar seems to have broken the profiler. Doing nothing but switching the C2000Ware version fixes this (same compiler configs (-O4), source,target,etc). I do not have time to debug this, but hopefully, I have provided enough information.

Here is a snippet of my code, I have posted edited versions of the config and periodic functions:


typedef	const	ERAD_Counter_Input_Event	cCntIpEvtE;

static
cCntIpEvtE CtrlIsrEvtN= (cCntIpEvtE)ERAD_BUSCOMP_BASE_TO_EVENT(ERAD_HWBP2_BASE);
static
cCntIpEvtE CtrlIsrEvtX= (cCntIpEvtE)ERAD_BUSCOMP_BASE_TO_EVENT(ERAD_HWBP3_BASE);

/// Configure ISR Begin event
static
void	McuCfgIsrBeginEvt(cU32 ref)											{
	const	ERAD_BusComp_Config	CtrlIsrN=									{
		.mask=			0,
		.reference=		ref,
		.comp_mode=		ERAD_BUSCOMP_COMPMODE_EQ,
		.enable_int=	0,
		.enable_stop=	0,
		.bus_sel=		ERAD_BUSCOMP_BUS_VPC
	};
	ERAD_configBusComp(ERAD_HWBP2_BASE, CtrlIsrN);
}
/// Configure ISR End event
static
void	McuCfgIsrEndEvt(cU32 ref)												{
	const	ERAD_BusComp_Config	CtrlIsrX=									{
		.mask=			0,
		.reference=		ref,
		.comp_mode=		ERAD_BUSCOMP_COMPMODE_EQ,
		.enable_int=	0,
		.enable_stop=	0,
		.bus_sel=		ERAD_BUSCOMP_BUS_VPC
	};
	ERAD_configBusComp(ERAD_HWBP3_BASE, CtrlIsrX);
}
/// Configure ISR Single timer
static
void	McuCfgIsrSingTmr()			{
	const	ERAD_Counter_Config CtrlSingK=								{
	    .event=	    	ERAD_EVENT_NO_EVENT,
        .event_mode=	ERAD_COUNTER_MODE_ACTIVE,
        .reference=		0,
        .rst_on_match=  0,
        .enable_int=	0,
        .enable_stop=	0
	};
  ERAD_configCounterInStartStopMode(ERAD_COUNTER2_BASE,CtrlSingK,CtrlIsrEvtN,CtrlIsrEvtX);
}

static
void	PeriodicTimerTask(McuS* mcu, CtrlS* ctrl)							{
    cU32	k= 	ERAD_getMaxCount(ERAD_COUNTER2_BASE);  // ALWAYS RETURNS 0.
    ERAD_setMaxCount(ERAD_COUNTER2_BASE,0);
    <snip>
}