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.
已解决! 转到解答。
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.
BR, Daniel
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.
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
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.
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?