Hello,
I want to use perodic wake-up for my project like 100us using S32k116.
It should enter into sleep mode and after 100us it should wake up and read inputs and again enter into sleep mode(VLPS mode).
As I got to know with the help of LPTM we can do it but I am not able to do it.
Is there any example available?
I am working on urgent project so quick response highly appreciated.
Hello @chaitanya_kalyani,
You can refer to this example:
https://community.nxp.com/t5/S32K-Knowledge-Base/Example-S32K144-RTC-VLPS/ta-p/1119655
And replace RTC with LPTMR.
In this example, the RTC module brings the MCU from VLPS to VLPR every 1s.
It works in the Sleep-on-exit mode so that the MCU can go back to VLPS automatically once the RTC interrupt routine is complete.
Please note that it takes some time to transition between RUN modes and STOP modes as specified in the datasheet,
Regards,
Daniel
Hello @danielmartynek ,
Thank you for quick response.
I ported that code for S32K116 but that is entering into sleep state but not able to wake-up.
Unfortunately don't have S32K116 eve board so I am testing this example on our developed board expecting only sleep-wake up and current change while changing the states.
Here I am attaching the code that I am using it.
Hello @chaitanya_kalyani,
The S32K11x MCUs have a different vector table, you forgot to change it
// RTC_Interrupt (alarm)
S32_NVIC->ICPR[0] = (1 << (6 % 32));
S32_NVIC->ISER[0] = (1 << (6 % 32));
// RTC_Seconds_Interrupt
S32_NVIC->ICPR[0] = (1 << (7 % 32));
S32_NVIC->ISER[0] = (1 << (7 % 32));
Also, my description of the example posted here is not correct.
The RTC second interrupt is disabled in the VLPS mode, only the RTC alarm is enabled.
You need to enabled it in the RTC init function if you want to use it.
RTC->IER |= (1 << 4);
// [4] TSIE = 1 Time Seconds Interrupt Enabled
Regards,
Daniel
Hello @danielmartynek ,
I checked that example after your suggested modification it is working but when I integrate with our project then it is not working.
For our project development I am using SDK.
Can you provide example with LPTMR 100ms perodic wake-up form VLPS using SDK?
Quick response highly appreciated.
Hello,
You can use these two SDK examples:
lptmr_periodic_interrupt_s32k116
power_mode_switch_s32k116
Regards,
Daniel