SDK lptimer wakeup from VLPS

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

SDK lptimer wakeup from VLPS

1,700 Views
viktorfellinger
NXP Employee
NXP Employee

just wondering if anyone have an SDK example where LPTIMER is used as a wakeup source. We have some examples on power modes and lptimer but as far as I see no wakeup from VLPS.

Labels (1)
Tags (1)
2 Replies

1,125 Views
lidded
Contributor I

你好,我想了解一下关于MCAL配置LPTMR用作时钟唤醒时的配置实例,可以吗?我现在如下现象:通过mcal配置gpt,mcu等模块,gpt中配置Lptmr,参考时钟用的是SIRC,mcu中已配置,在debug模式,载VLPS模式下LPTMR计时器可以正常工作,但通过flash下载到控制器,在VLPS模式下LPTMR就无法计时工作。我将模式改成stop1模式,LPTMR也能正常工作。目前实在无法找到原因,能提供可能出问题的配置吗,谢谢!

0 Kudos
Reply

1,478 Views
RadekS
NXP Employee
NXP Employee

Hi Viktor,

I prepared example code for you (in attachment).

I simply use power_mode_switch_s32k144 example code as a template and add there LPTIMER component.

The LPTIMER is configured for 10s interrupt, with 1KHz LPO input clock!

LPTIMER 10s configuration.png

The main contains LPTIMER initialization:

LPTIMER initialization.png

And LPTIMER interrupt routine:

LPTIMER ISR.png

I configured and initialized also GPIO Blue LED (port D, pin 0) - just for testing purpose.

 

Please be aware that power_mode_switch in SDK0.8.4 sometimes behave strangely (ignore inputs from the terminal) because it waits for EOL char (\r or \n) – please use Enter button with number char for your power mode choice.

This example works like a charm with SDK0.8.5 due to minor changes in the main code:

power_mode_switch_s32k144 example - SDK 0.8.5 changes.png

 

When you load code into MCU, the LED should be GREEN. When you use any serial terminal and switch mode to any STOP mode like VLPS, the LED become RED.

The LPTIMER event every 10s wake-ups MCU from stop mode and change LED from RED to GREEN.

Wake-up is also possible by SW3 button on board.

 

I hope it helps you.

Have a great day,
Radek

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