Sleep mode not working on MKL17

cancel
Showing results for 
Search instead for 
Did you mean: 

Sleep mode not working on MKL17

Jump to solution
591 Views
eduardocarletti
Contributor III

Hello everybody!

So I am developing a project using MKL17Z256VLH4. One of its main requirements is that the device should enter in sleep mode. I have already done this using the same device, for another client, and it worked fine.

I am using KDS V3 and KDSK 1.3.0.

When calling the desired mode, I simply use the following:

POWER_SYS_SetMode(1, kPowerManagerPolicyAgreement);

As long that the configurations seem to be correct, this should work.

Attached are the powerMan and CPU driver configurations, which, as far as I know, are all that need to be done.

I don't think its relevant, but I have the serial bootloader enabled, although I am debugging using P&E micro.

Does anyone have any tips?

Thanks!

0 Kudos
1 Solution
455 Views
eduardocarletti
Contributor III

Hi Kerry,

I didn't had time to try as you suggested. But I managed to find the solution.

I searched file by file on the SDK folder of a much older project created using KDS V2.0 or 3.0 (not sure wich). It happens that someone, I suppose from KDS developing team, messed with the "system_MKL17Z4.c", located under "PROJECT ROOT"\SDK\platform\devices\MKL17Z4\startup. The error was in line #128, as shown:

Older, correct file:

SMC->PMPROT = SYSTEM_SMC_PMPROT_VALUE | 0x08;

Newer, incorrect file:

SMC->PMPROT = SYSTEM_SMC_PMPROT_VALUE; 

So, all I had to do was add the "| 0x08" mask.

Thank you so much for your attention.

Eduardo Carletti

View solution in original post

0 Kudos
6 Replies
455 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Eduardo Carletti,

   SDK1.3.0 is really very old, and that SDK is not in the support list now.

   In my own opinion, it's better to use the new SDK code with the NEW IDE MCUxpresso.

   The new SDK can be downloaded from this link:

   Welcome | MCUXpresso SDK Builder 

   Please tell me what the detail mode you want to enter?

  MKL17Z256VLH4 have these modes: run, wait, stop, VLPR, VLPW,VLPS,LLS, VLLS3,VLLS1,VLLS0.

  From your picture, it seems you want to enter the LLS mode.

  You said, your another client make it work, do you use the same configuration?

  BTW, when you try to enter the LLS mode, you need to make sure your wake up is not working, otherwise, your low power enter will be interrupt.

 


Have a great day,
Kerry

 

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
455 Views
eduardocarletti
Contributor III

Hi Kerry,

I am aware of the MCUxpresso, we already use it on newer projects. This one I am working now is a legacy project, created on KDS and, as far as I know, importing KDS projects into MCUxpresso would be really hard and faulty.

Yes, the mode to enter is LLS. The project of the other client is configured exactly the same.

Tried to disable the wake up source (GPIO), but had the same behavior. When debugging step-by-step, it seems the the failure occurs when the driver checks whether the desired power mode is allowed. See picture below.

getProtection.jpg 

Thanks.

0 Kudos
455 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Eduardo Carletti,

   Do you try the SDK MCUXpresso project:

SDK_2.5.0_MKL17Z256xxx4\boards\frdmkl43z\demo_apps\power_manager\

  Try this LLS mode on your side, whether it works OK or not, you don't need to import the KDS project.

  About the details about how to import the MCUXPresso IDE project, please refer to Getting Started with MCUXpresso SDK.pdf in folder:

SDK_2.5.0_MKL17Z256xxx4\docs


Have a great day,
Kerry

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
456 Views
eduardocarletti
Contributor III

Hi Kerry,

I didn't had time to try as you suggested. But I managed to find the solution.

I searched file by file on the SDK folder of a much older project created using KDS V2.0 or 3.0 (not sure wich). It happens that someone, I suppose from KDS developing team, messed with the "system_MKL17Z4.c", located under "PROJECT ROOT"\SDK\platform\devices\MKL17Z4\startup. The error was in line #128, as shown:

Older, correct file:

SMC->PMPROT = SYSTEM_SMC_PMPROT_VALUE | 0x08;

Newer, incorrect file:

SMC->PMPROT = SYSTEM_SMC_PMPROT_VALUE; 

So, all I had to do was add the "| 0x08" mask.

Thank you so much for your attention.

Eduardo Carletti

View solution in original post

0 Kudos
455 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Eduardo Carletti,

   Thank you for your updated information and the solutions sharing.

   Actually, normally, customer can set the SMC allowed mode in the main code, the new SDK code is using this code in the main code:

 SMC_SetPowerModeProtection(SMC, kSMC_AllowPowerModeAll);

  kSMC_AllowPowerModeAll = (0U
#if (defined(FSL_FEATURE_SMC_HAS_VERY_LOW_LEAKAGE_STOP_MODE) && FSL_FEATURE_SMC_HAS_VERY_LOW_LEAKAGE_STOP_MODE)
                              |
                              SMC_PMPROT_AVLLS_MASK
#endif
#if (defined(FSL_FEATURE_SMC_HAS_LOW_LEAKAGE_STOP_MODE) && FSL_FEATURE_SMC_HAS_LOW_LEAKAGE_STOP_MODE)
                              |
                              SMC_PMPROT_ALLS_MASK
#endif /* FSL_FEATURE_SMC_HAS_LOW_LEAKAGE_STOP_MODE */
                              |
                              SMC_PMPROT_AVLP_MASK
#if (defined(FSL_FEATURE_SMC_HAS_HIGH_SPEED_RUN_MODE) && FSL_FEATURE_SMC_HAS_HIGH_SPEED_RUN_MODE)
                              |
                              kSMC_AllowPowerModeHsrun
#endif                          /* FSL_FEATURE_SMC_HAS_HIGH_SPEED_RUN_MODE */
                              ) /*!< Allow all power mode.              */
} smc_power_mode_protection_t;

So, the SDK1.3.0 associate with the PE have the bugs. That's why we highly recommend you use the new SDK.

Wish it helps you!

If you still have question, just let me know.

If your question is solved, please help me to mark the correct answer, just close this case, thank you!

Have a great day,
Kerry

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
455 Views
eduardocarletti
Contributor III

Kerry, 

Thanks again for your help. On further projects we are sure using MCUxpresso.

Eduardo Carletti.

0 Kudos