LPIT Interrupt is not working after VLPS to RUN mode transition

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

LPIT Interrupt is not working after VLPS to RUN mode transition

跳至解决方案
2,429 次查看
ab1995
Contributor II

Hello,

I'm using S32K148 MCU and RTD as MCAL. In my current project the MCU goes to VLPS mode and every 60ms wakes up using LPTMR interrupt. LPTMR uses LPO 1K as clock source. While waking up, a piece of code executes and MCU goes to VLPS again. This scenario repeats 5 times and then MCU stays in RUN mode till the end. At this time the clock is reinitialized and LPIT is started to generate periodic interrupts.

The problem is that LPIT ISR never executes in this case. I checked MCU registers and realized that LPIT interrupt stays pending and the routine doesn't execute.

LPIT uses SIRC as clock source.
I also tried initializing LPIT after the last wakeup when MCU doesn't go to VLPS mode anymore. but the same thing happened.

标签 (1)
0 项奖励
回复
1 解答
2,248 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

The S32K3xx RTD resumes the interrupts within the same function after the wakeup but not the S32K1xx RTD.

Let me trigger a discussion with the RTD team.

danielmartynek_0-1680608752236.png

 

BR, Daniel

在原帖中查看解决方案

0 项奖励
回复
8 回复数
2,261 次查看
ab1995
Contributor II

I don't understand why do we need to suspend interrupts after wfi.

0 项奖励
回复
2,271 次查看
ab1995
Contributor II

Hi @danielmartynek ,

I checked the PRIMASK, before mode change, it is 0, and after wakeup it turns to 1 and remains 1. I tried to change it manually to 0 so I could get the interrupt. But I didn't understand the reason why it's happening.

0 项奖励
回复
2,418 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Hello @ab1995,

Where do you see the LPIT interrupt pending?

In the NVIC_ISPRn register or in the LPIT_MSR register.

If it is pending in NVIC_ISPRn, is the interrupt enabled in NVIC_ISERn?

 

BR, Daniel

0 项奖励
回复
2,406 次查看
ab1995
Contributor II

Hi @danielmartynek ,

thank you for your quick response.

I see that interrupt is pending in NVIC_ISPRn register. Also it is enabled.

If I don’t switch between modes, I can get LPIT interrupt with the current configuration. 

标记 (1)
0 项奖励
回复
2,386 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @ab1995,

Just to be sure, can you double-check PRIMASK?

 

Thanks,

BR, Daniel

0 项奖励
回复
2,269 次查看
ab1995
Contributor II

Hi @danielmartynek ,

I checked the PRIMASK, before mode change, it is 0, and after wakeup it turns to 1 and remains 1. I tried to change it manually to 0 so I could get the interrupt.

The function EXECUTE_WAIT() is called when entering low power modes by driver. It is implemented as bellow:

#define EXECUTE_WAIT() \
do \
{ \
OsIf_ResumeAllInterrupts(); \
ASM_KEYWORD(" wfi"); \
OsIf_SuspendAllInterrupts(); \
} while (0)

if we enter run mode after wakeup interrupts stay suspended (PRIMASK = 1) because of OsIf_SuspendAllInterrupts(), so we need to resume interrupts and the driver doesn't do this.

If we repeatedly enter vlps mode interrupts get executed because of OsIf_ResumeAllInterrupts before wfi, my question is why are interrupts suspended in driver code after wakeup?

标记 (1)
0 项奖励
回复
2,249 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

The S32K3xx RTD resumes the interrupts within the same function after the wakeup but not the S32K1xx RTD.

Let me trigger a discussion with the RTD team.

danielmartynek_0-1680608752236.png

 

BR, Daniel

0 项奖励
回复
2,147 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

The issue will be fixed in the next revision.

 

Thank you,

BR, Daniel

0 项奖励
回复