Strange behavior at power-up - URGENT

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Strange behavior at power-up - URGENT

Jump to solution
1,038 Views
gauravbanyal
Contributor IV

Hello,

Following is what I observe with the FRDM-KL03Z board and the SDK2.0 example "power_mode_switch". I compile the software and flash it to the device. Then I press the SWI to see the UART prints. Problem is, the MCU seems to reset a few times and then stops resetting. Please refer to the video. 

In my custom software for an MKL03Z32 which is on a custom board, the effect is even more profound. The resetting never stops. The issue is that when I power-up the device, the code should take it to VLLS0 state and wait for an interrupt to wake it up. Because of this resetting issue, it never goes to VLLS0 and therefore the power consumption is very high. Another observation is when during the resetting I create that interrupt source and make the code flow path change from that power-up -> reset -> power-up flow, the next when time the MCU goes to VLLS0, it stays there. Similar is the observation on the FRDM board. Once when I have for example used VLLS3 mode and woken up using the SW2 and the execution goes to the place where it again asks for user input, it stays there.

Could you please help me on priority on this one? I am supposed to do a demo with my software but this issue is killing the whole thing.

Best regards,

Gaurav.

0 Kudos
1 Solution
797 Views
gauravbanyal
Contributor IV

Hello,

I was struck with something that was described in the Eratta. Now its fixed.

The following is what is added to my initialization code now.

=============

//e8068: RTC: Fail to enter low power mode if RTC time invalid flag (TIF) is not cleared after POR
//Errata type: Errata
//Description: After POR, time invalid flag of RTC is set, RTC_SR[TIF]=1. If this flag is not cleared, the MCU
//fails to enter low power mode.
//Workaround: Clear time invalid flag of RTC before entering low power mode. This bit is cleared by writing the
//RTC_TSR register when the time counter is disabled.
uint32_t tempVar;
CLOCK_EnableClock(kCLOCK_Rtc0);
tempVar = (uint32_t)RTC->SR;
PRINTF ("\r\n RTC->SR = 0x%x", tempVar);
if (tempVar & RTC_SR_TIF_MASK){
RTC->TSR = 0xABCD; //Junk
}
tempVar = (uint32_t)RTC->SR;
PRINTF ("\r\n RTC->SR = 0x%x", tempVar);

==============

Best regards,

Gaurav.

View solution in original post

0 Kudos
4 Replies
798 Views
gauravbanyal
Contributor IV

Hello,

I was struck with something that was described in the Eratta. Now its fixed.

The following is what is added to my initialization code now.

=============

//e8068: RTC: Fail to enter low power mode if RTC time invalid flag (TIF) is not cleared after POR
//Errata type: Errata
//Description: After POR, time invalid flag of RTC is set, RTC_SR[TIF]=1. If this flag is not cleared, the MCU
//fails to enter low power mode.
//Workaround: Clear time invalid flag of RTC before entering low power mode. This bit is cleared by writing the
//RTC_TSR register when the time counter is disabled.
uint32_t tempVar;
CLOCK_EnableClock(kCLOCK_Rtc0);
tempVar = (uint32_t)RTC->SR;
PRINTF ("\r\n RTC->SR = 0x%x", tempVar);
if (tempVar & RTC_SR_TIF_MASK){
RTC->TSR = 0xABCD; //Junk
}
tempVar = (uint32_t)RTC->SR;
PRINTF ("\r\n RTC->SR = 0x%x", tempVar);

==============

Best regards,

Gaurav.

0 Kudos
797 Views
jorge_a_vazquez
NXP Employee
NXP Employee

Hi Gaurav Banyal

I couldn't reproduce your issue in FRDM-KL03Z, did you change the example code in some part of the code?

Also, you are using a SDK2.0 version, could you try with the latest version, SDK2.2 version? this version has improve and resolve some issues. you can download it in the next link:

Welcome to MCUXpresso | MCUXpresso Config Tools 

Please try it and tell me if something change.

Best Regards

Jorge Alcala

0 Kudos
797 Views
gauravbanyal
Contributor IV

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.

0 Kudos
797 Views
gauravbanyal
Contributor IV

Hello Jorge,

I tried again with SDK2.2 version, no code changes done. The behavior is the same. I have tried it on two FRDM boards and the result is the same in both. Please help me out.

Best regards,

Gaurav.

0 Kudos