AnsweredAssumed Answered

Stop Mode K27F (FRDM K28 power_mode_switch example)

Question asked by Eldar Firing on Jun 13, 2018
Latest reply on Jun 15, 2018 by Eldar Firing

Hi, I am using MCUXpresso 10.2 and SDK 2.3.1, FreeRTOS and tickless Idle. I am developing an application where I need to use the low power modes of Kinetis K27F. The processor will be idle for about 200 ms, then run maybe a couple of milliseconds and then back to sleep again. Using the FreeRTOS hooks configPRE_SLEEP_PROCESSING / configPOST_SLEEP_PROCESSING I have tested first with normal stop mode (deepsleep). I use LPTMR0 for tickless and LPTMR1 as wakeup timer.

 

But when waking up from deepsleep, I discovered that "STOPA" bit is always set (also before enter WFI) : 

....

/* read back to make sure the configuration valid before enter stop mode */
(void)base->PMCTRL;
__DSB();
__WFI();
__ISB();

/* check whether the power mode enter Stop mode succeed */

if (base->PMCTRL & SMC_PMCTRL_STOPA_MASK)

{
      return kStatus_SMC_StopAbort;  // always return here
}

...

Then I tested using the "FRDM-K28 power_mode_switch" example which by the way does not work out-of-the box either (LPTMR0_IRQHandler is for some reason called constantly once enabled by NVIC...?).  Is it a known problem?

Commenting out "NVIC_EnableIRQ(LPTMR0_IRQn);" I tested "C - Stop Mode" using switch SW3 as wake-up, but same thing happens as in my application, STOPA is always 1. 

 

This is a bit confusing since K27 doc says :

3
STOPA
Stop Aborted
When set, this read-only status bit indicates an interrupt occured during the previous stop mode entry
sequence, preventing the system from entering that mode. This field is cleared by reset or by hardware at
the beginning of any stop mode entry sequence and is set if the sequence was aborted.
0 The previous stop mode entry was successful.
1 The previous stop mode entry was aborted.

 

So, that means it did not go to deepsleep?  Does debugger attached change something ?

Outcomes