What does it mean “MCU looks not working”?
If you don’t have stable ADC reference voltage during reset, after reset device will report FCCU fault due to failed self-test and if unhandled it’ll go into SAFE mode. If you use clear fails as below, it should work even in case ADC reference is attached later.
static void ClearFails(void)
{
uint16_t reset_register;
if(RGM.FES.B.F_FCCU_SAFE /*|| RGM.FES.B.F_FCCU_HARD*/)
{
reset_register = RGM.FES.R;
ME.IMTS.R = 0x00000001;
ClearCF();
ClearNCF();
RGM.FES.R = 0xFFFF;
RGM.DES.R = 0xFFFF;
/* re-enter DRUN */
ME.MCTL.R = 0x30005AF0; /* Enter DRUN Mode & Key */
ME.MCTL.R = 0x3000A50F; /* Enter DRUN Mode & Inverted Key */
}
}
static void ClearCF(void)
{
uint32_t i,a[4];
for(i=0;i<4;i++)
{
FCCU.CFK.R = FCCU_CFK_KEY;
FCCU.CF_S[i].R = 0xFFFFFFFF;
while(FCCU.CTRL.B.OPS != 0x3)
{
}; /* wait for the completion of the operation */
a[i]=FCCU.CF_S[i].R;
}
}
static void ClearNCF(void)
{
uint32_t i,b[4];
for(i=0;i<4;i++)
{
FCCU.NCFK.R = FCCU_NCFK_KEY;
FCCU.NCF_S[i].R = 0xFFFFFFFF;
while(FCCU.CTRL.B.OPS != 0x3)
{
}; /* wait for the completion of the operation */
b[i]=FCCU.NCF_S[i].R;
}
}