Sleep mode in MKW01Z

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

Sleep mode in MKW01Z

850 Views
sergiiparadiuk
Contributor II

Hello,

I use use sleep mode, but I can only wake in 65535 ms  seconds in maximum only. 

I need to wake i time in 30 minutes. Is it possible to do? 

My code for sleep mode:


PWRP_Init();
PWRP_ConfigureXCVRMode(pwrp_xcvr_sleep);
// Set timer source for wake up LPTM
PWRP_SetWakeUpSource(0x01);
PWRP_UpdateLPTMRCount(60 * 1000);

Enter_VLPS();

...

0 Kudos
Reply
4 Replies

743 Views
mjbcswitzerland
Specialist V

Hi Sergii

The LPTMR has a pre-scaler that can decrease its counting speed by /2, /4, /8 .../64k. If you enable that with an appropriate setting you can get much long delays up to 49.7 days from LPO clock.

Regards

Mark

uTasker developer and supporter (+5'000 hours experience on +60 Kinetis derivatives in +80 product developments)
Kinetis: http://www.utasker.com/kinetis.html

0 Kudos
Reply

743 Views
sergiiparadiuk
Contributor II

thank you for response, but I read this too, but how could I do from API?

2018-04-30 22:19 GMT+03:00 mjbcswitzerland <admin@community.nxp.com>:

NXP Community

<https://community.freescale.com/resources/statics/1000/35400-NXP-Community-Email-banner-600x75.jpg>

Re: Sleep mode in MKW01Z

reply from Mark Butcher

<https://community.nxp.com/people/mjbcswitzerland?et=watches.email.thread>

in Kinetis Microcontrollers - View the full discussion

<https://community.nxp.com/message/1010274?commentID=1010274&et=watches.email.thread#comment-1010274>

0 Kudos
Reply

743 Views
mjbcswitzerland
Specialist V

Sergii

I don't know the API that you are using - you will need to read its documentation or check its implemention. If it doesn't support the pre-scaler setting you can simply do the following (after you call the setup).

1. Disable the LPTMR with LPTMR0_CSR &= ~1;
2. Set the pre-scaler value you need (assuming LPO clock)
LPTMR0_PSR = (LPO_CLOCK_SOURCE | (DIVIDE_VALUE << 3));
3. Re-enable again LPTMR0_CSR |= 1;


where DIVIDE_VALUE is 1 for divide by 2, 2 for divide by 4, 3 for divide by 8, 4 for divide by 16 etc.

This will then increase the timeout value that you set by this factor.

Regards

Mark


uTasker developer and supporter (+5'000 hours experience on +60 Kinetis derivatives in +80 product developments)
Kinetis: http://www.utasker.com/kinetis.html

0 Kudos
Reply

743 Views
sergiiparadiuk
Contributor II

thanks. It helped!

2018-05-01 0:19 GMT+03:00 mjbcswitzerland <admin@community.nxp.com>:

NXP Community

<https://community.freescale.com/resources/statics/1000/35400-NXP-Community-Email-banner-600x75.jpg>

Re: Sleep mode in MKW01Z

reply from Mark Butcher

<https://community.nxp.com/people/mjbcswitzerland?et=watches.email.thread>

in Kinetis Microcontrollers - View the full discussion

<https://community.nxp.com/message/1010279?commentID=1010279&et=watches.email.thread#comment-1010279>

0 Kudos
Reply