Hello,
I am trying to implement a sleep wake-up procedure on the S32K146 development board.
To send the controller to sleep, I use the code from the Application notes AN5425, chapter 5.5.1.
S32_SCB->SCR |= S32_SCB_SCR_SLEEPDEEP(1);
/* Select Stop Mode */
SMC->PMCTRL = SMC_PMCTRL_STOPM(0b00);
/* Select which STOP mode (Stop1 or Stop2)
* is desired (Stop1 - 0b01, Stop2 - 0b10) */
SMC->STOPCTRL = SMC_STOPCTRL_STOPO(0b01);
/* Wait For Interrupt */
#if defined (__GNUC__)
__asm volatile ("wfi");
#endif
The go to sleep procedure works without any issue, no matter the stop mode that I use.
To wake-up the controller, I want to trigger a LIN interruption using the LIN 2.1 stack from the NXP SDK. LIN communication is working properly.
Issue that I am facing:
My question:
What do I need to define or modify in order to be able to wake-up the controller from any file?
Thank you for your guidance.
Solved! Go to Solution.
Hello @ndousse,
The MCU starts running in the wakeup ISR, and once the ISR is complete, it returns to the next inxtruction after WFI.
So, if the AWIC does not detect the interrupt, please make sure that when the WFI is executed
Regards,
Daniel
Dear Daniel,
Thank you for your answer.
The "__asm volatile ("wfi");" is indeed called from an interrupt, a scheduler based on a lptmr interrupt. The LPTMR_DRV_ClearCompareFlag is cleared directly at the beginning of the interrupt, before the call to the "wfi".
No interrupt mask is applied.
All the interruption have their default priority. Following the S32K1xx_DMA_Interrupt_mapping.xlsx, the LPUART interrupts have a lower Interrupt ID (ID 31-35) than the LPTMR interrupt ID (ID 58). So the LPUART should have a higher priority than the LPTMR, is it correct?
Can I simply change the priority of the LPTMR interrupt to a lower one in order to trigger the LPUART interrupt as AWIC?
Hi @ndousse,
If all the interrupts have thier priority set to 0 (default), one interrupt can't preempt the other.
You would need to set the LPTMR interrupt to a lower periority (like 1).
BR, Daniel
Dear Daniel,
I setup the priority of the LPTMR interruption to 1 with the function
INT_SYS_SetPriority(LPTMR0_IRQn, 1);
And I was able to trigger the LIN interruption through LPUART.
Thanks for your guidance and help.
Hello @ndousse,
The MCU starts running in the wakeup ISR, and once the ISR is complete, it returns to the next inxtruction after WFI.
So, if the AWIC does not detect the interrupt, please make sure that when the WFI is executed
Regards,
Daniel