Hello Jorge,
I found out the reason for this behavior in the FRDM board using the SDK code. The when the MCU boots-up after being flashed, the " GETCHAR();" in the following code returns two junk characters and therefore the prints come again. Don't know the reason for it but thats what happens. I confirmed this by printing the character in "ch". There is no reset.
=======
/* Wait for user response */
ch = GETCHAR();
======
But the case on my board is different. It goes through reset cycles.Strange thing is that this is not systematic. I tried to debug this further to get the reset reason. So I added the following code at the start-up in main(). Sequence is: MCU is flashed, wakes-up, initializes, goes to VLLS0 state and resets. This cycle continues.
=========
uint32_t resetStatus;
resetStatus = RCM_GetPreviousResetSources(RCM);
PRINTF("\r\nRESET_SOURCE = 0x%x", resetStatus);
resetStatus = RCM_GetStickyResetSources(RCM);
PRINTF("\r\nSTICKY_RESET_SOURCE = 0x%x", resetStatus);
resetStatus = (uint32_t)LLWU->F1;
PRINTF ("\r\n F1 = 0x%x", resetStatus);
resetStatus = (uint32_t)LLWU->F3;
PRINTF ("\r\n F3 = 0x%x", resetStatus);
==========
And i get the following values when this happens:
==========
RESET_SOURCE = 0x1
STICKY_RESET_SOURCE = 0x1
F1 = 0x0
F3 = 0x0
==========
I think this means that this was an LLUW wake-up? This is surprising because I have commented out the code that enables the LLWU interrupt from the external pin.
=========
//LLWU_SetExternalWakeupPinMode(LLWU, LLWU_WAKEUP_PIN_IDX, LLWU_WAKEUP_PIN_TYPE);
//NVIC_EnableIRQ(LLWU_IRQn);
=========
What other registers should I check for to understand whats going on.
Please help urgently.
Best regards,
Gaurav.