AnsweredAssumed Answered

Debug session prevent from VLPS

Question asked by Adam Kulpa on Jun 13, 2018
Latest reply on Jun 13, 2018 by Jing Pan

Hello,

I have a problem with invoking Very Low Power Stop (VLPS) state in KL02Z microprocessor. I use PEMicro Multilink debugger interface for flash programming. Code contains usage of VLPS, provided by KINETIS-SDK v2.3

status_t power_mode_status;


SMC_PreEnterStopModes();

  /* switch to Deep Sleep (VLPS) mode */
  power_mode_status = SMC_SetPowerModeVlps(SMC);

  if (power_mode_status != (status_t)kStatus_Success)
  {
    /**
     * @note With debug enabled, transitions from Run directly to VLPS result in the system entering
     *       Stop mode instead. Status bits within the MDM-AP Status register
     *       can be evaluated to determine this pseudo-VLPS state.
     */

    PRINTF("VLPS FAIL: %d", power_mode_status);

    ret = 1U;
  }

  SMC_PostExitStopModes();

 

My routine looks as follows:

1. Upload flash image by debugger interface and GDB session

2. Close session in GDB

3. Unplug the debugger

4. Performs RESET by using the MCU pin

5. My Code is running, and function

SMC_SetPowerModeVlps(SMC);

 returns status code: 3900 which indicate that previous trial fail and STOPA flag is set. I don't have any pending interrupts.

 

By this moment everything works according to documentation:

9.6 Debug in low-power modes

....

With debug enabled, transitions from Run directly to VLPS result in the system entering
Stop mode instead. Status bits within the MDM-AP Status register can be evaluated to
determine this pseudo-VLPS state.

 

But why after reset my MCU still thinks that debug is enabled. Does reset should not clean debug?

 

My case is quite specific, because the programming takes place under battery power, which I can not disconnect.

I really need to be able of programming flash by debugger and use VLPS.

 

How can I disable debug or indicate MCU that debug session after uploading is over?

Are there any flags / settings that disable the "emulated STOP state"?

 

 

 

Outcomes