AnsweredAssumed Answered

VLLS3 wake up,but no reset flow, MK20DX128

Question asked by Diego Colombo on Nov 5, 2012
Latest reply on Dec 20, 2012 by Diego Colombo

Hello.Please can i have help, hints  or ideas?I'm trying to wake up from vlls3 mode using a switch on a pin, but something goes wrong.

I reduced code at example level to better focus on the problem:after reset 1)initialization2)an easy recognizable 4 seconds square wave is outputted on a pin,3) an infinite loop is entered,where another sequence of different frequency is repeatedly outputted,and the status of a button is polled;

if pressed ,the vlls3 mode is called,just after  the button itself is configured as wakeup trigger source,then the uC goes to sleep in vlls3 mode.

Resumed code looks like this:

void  main(void){

      wdog_disable();

      PE_low_level_init();

      TogglePin2KHz_4Sec();//to see it on  oscilloscope when it passes through this point,once-only

      for(;;)//infinite loop     {

       TogglePin500Hz_1Sec();//to see it on  oscilloscope when it passes through this point,repeatedly

      if(BUTTON PRESSED) {

       ..... //prepare Button as wake up trigger event

asm("WFI") 

       }//end of if

     }//end of for(;;)

}//end of main

I measure the power consumption by 1 ohm resistor  and a digital multimeter with less significative digit representing 0.1uV->100nA(probably not actually),i tried to follow tips from AN4503 11.1.2 Tips for making low-power measurements on the bench.

I can see current absorption =20 mA in RUN mode,and few uA when  i call vlls3,,so i can think to be entered in vlls3.Ok until there.

Pushing the button the absorption rises up to 20 mA,typical of RUN mode,but i can't see any square wave on the scope.Where is my program running?

Debugging with Cyclone Max adds hundreds of uA,but that is non the main problem, i can see the debug stopping during vlls3.When,i turn back in RUN mode the debugger appears  able to follow the code,but no signal on output pin when code should toggle it.If i check registers inherent  to that PORT_PIN they look  unchanged,if compared to the previous RUN mode.Is the debug realistic?

Reading the AN4503 at page 31: 

• VLLSx exits to Run mode through the reset flow.

• For Kinetis devices, after exit from VLLSx, execution starts with the instruction pointed to by the RESET vector address.

 

I should expect that the the code starts from RESET,initializing stack pointer,global variables etc.It is my expectation wrong?

In code examples i found that at least GPIO iniatilization is done in wake up ISR,so i done(see attached file).

Thanks for your attention,

Diego.

 

Original Attachment has been moved to: Test_VLLS3.c.zip

Outcomes