cancel
Showing results for 
Search instead for 
Did you mean: 

How to read the reset cause using MC_RGM register on SPC58NG84E7 controller?

AVM
Associate III

Hello,

I am currently working on SPC58NG84E7 controller with SPC5 studio.

I want to read the cause of reset in main routine.

In the reference manual, it is mentioned RGM register (RGM.FES & RGM.DES), which will help the controller to identify the type of reset.

I tried to read the RGM register in the beginning of my main function, but every time I am getting 0. I observed during debugging that, before entering into main routine, these registers are getting cleared. So, how to get the reset cause in main routine?

Regards,

AVM

1 ACCEPTED SOLUTION

Accepted Solutions
Giuseppe DI-GIORE
ST Employee

Hello,

if you are using SPC5Studio, take into account that RGM.FES and RGM.DES are cleared, by software, at boot time.

See file clock.c and function spc_clear_fccu_rgm(void)

So, RGM.FES and RGM.DES registers are cleared by software.

Modify clock.c to avoid to clear RGM FES and DES registers.

Regards,

View solution in original post

2 REPLIES 2
Giuseppe DI-GIORE
ST Employee

Hello,

if you are using SPC5Studio, take into account that RGM.FES and RGM.DES are cleared, by software, at boot time.

See file clock.c and function spc_clear_fccu_rgm(void)

So, RGM.FES and RGM.DES registers are cleared by software.

Modify clock.c to avoid to clear RGM FES and DES registers.

Regards,

bin zhuo
Associate II

Dear ST,

I am also developing the FCCU function by SPC58EC80. I can read the reset cause by RGM.FES as FCCU(MCU_FCCU_HARD_RESET or MCU_FCCU_SOFT_RESET), but my goal is to read which fault channel source of FCCU caused the reset. So far, I haven't been able to achieve my goal.

my step is read register RF_S and N2FF_STATUS of FCCU at main function startup, just like this:

	FCCU.CTRL.R = FCCU_OP10;
	while (FCCU.CTRL.B.OPS != 0x3) //0b:11 Successful
	{
		asm("nop");
	};
	FCCU_Log->RF_S0 = FCCU.RF_S[0].R;
	FCCU_Log->RF_S1 = FCCU.RF_S[1].R;
	FCCU_Log->RF_S2 = FCCU.RF_S[2].R;
	FCCU_Log->RF_S3 = FCCU.RF_S[3].R;
 
	FCCU.CTRL.R = FCCU_OP6;
	while (FCCU.CTRL.B.OPS != 0x3) //0b:11 Successful
	{
		asm("nop");
	};
	FCCU_Log->N2FF_STATUS = FCCU.N2FF_STATUS.R;

i use debugger mode and set breakpoint at this, when reset by FCCU(such as channel #8 reset reaction), the register RF_S and N2FF_STATUS always 0,just like this:

0693W00000Lvh8BQAR.pngbecase i use channe #8 as the test, so i think RF_S0 should be 256. The facts did not meet expectations。

Please help me,thanks !