When waked up from VLPS, period of LPIT is not correct

cancel
Showing results for 
Search instead for 
Did you mean: 

When waked up from VLPS, period of LPIT is not correct

172 Views
huisheng_huang
Contributor III

Hi guys, I am implementing the low power mode function.

The aim is to enter VLPS mode, and wake up the MCU from VLPS by LPTMR every 80ms.

After wake up, enable LPIT with period 600us to trigger AD function.

Now, the issue is the period of LPIT is not correct.

The designed period is 600us, but the measured period is 4ms or so.

The incorrect period is just happened at the first cycle after waked up from VLPS. The afterward period is quit correct.

Some other information:

LPTMR: clock source is SIRC.

LPIT: clock source is SIRC.

Chip: S32K148

Could anyone help me ? Thanks in advance.

Tags (2)
0 Kudos
5 Replies

158 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @huisheng_huang,

How do you enable and disable the LPIT timer?

You can reset the module first (MCR[SW_RST]).

Please have a look at the Table 48-4. Initializing the LPIT module in the RM.

 

Regards,

Daniel

0 Kudos

146 Views
huisheng_huang
Contributor III

Thanks for response.

At current implementation, as LPIT doesn't work at VLPS mode, so I do nothing to LPIT when waked up from VLPS mode. I assumed LPIT module would continue working after waked up.

Also, I tried starting the LPIT channel whenever waked up from VLPS mode. We use MCAL code, so the interface I used is Gpt_StartChannel(channel, period). But the result was the same.

So in your opinion, we need reset the LPIT module when MCU waked up from VLPS mode?

 

0 Kudos

126 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi,

I tested it with a simple bare-metal code and couldn't reproduce it.

The LPIT module starts immediately - it does not have to be restarted.

I routed LPIT Ch0 trigger to a TRGMUX_OUT pin and output BUS_CLK at a CLKOUT pin.

After a wake-up:

danielmartynek_0-1616593609356.png

The first period is shorter 0.4752ms.

But this is because the LPIT period was interrupt by the VLPS after 0.1384ms.

danielmartynek_1-1616593723355.png

Can you test it with TRGMUX and CLKOUT on your side?

I guess you use LPIT interrupts and it takes some time to enable the LPIT interrupt after a wake-up event.

 

Thanks,

BR, Daniel

0 Kudos

88 Views
huisheng_huang
Contributor III

Hi  Danielmartynek,

Thanks very much for your detailed response.

I tested and tried other methods. Finally, I found out the root cause.

It's the Clock! Before enter LPM, PLL and FIRC are disabled.

When waked up by interrupt, interrupt handler is executed first and then MCU exit from VLPS.

In my code, I start LPIT in the interrupt handler. At this point, the system clock is still SIRC. So this causes the incorrect period.

One solution is to change clock to PLL in the interrupt handler and then start LPIT.

Thanks again for you suggestion.

 

171 Views
huisheng_huang
Contributor III

Time measured:

issue.png

0 Kudos