This example project will show user how to use and configure the basic functionalities of WKPU + RTC API.
------------------------------------------------------------------------------
* Test HW: S32K3X4EVB-T172 (SCH-53148 REV B2)
* MCU: S32K344
* IDE: S32DS3.5 & S32DS3.6
* SDK release: RTD 6.0.0
* Debugger: PE Micro
* Target: internal_FLASH
------------------------------------------------------------------------------
This example routine configures the WKPU & RTC units for wake-up. The RTC is present in always ON domain, hence available in RUN mode as well as in STANDBY mode.
Snag_120dece.png
The chip contains one instance of RTC (Real Time Clock) timer and API (Autonomous Periodic Interrupt) timer, where both can perform 32-bit comparisons. Both RTC and API timers can generate interrupts as well as wake-up from low power modes.
The following figure highlights the path for RTC API wake-up. Please refer to Chapter 69.3.2 API functional description from the S32K3XX reference manual (Rev. 12) for further information.
Julin_AragnM_0-1768424703841.png
The routine waits for SW5 to be pressed, then turns off the green LED, and enters Wkpu_EnterStandby() function which:
- Switches CORE_CLK to FIRC.
- Initializes the WKPU instance.
- Configures WKPU2 & WKPU42 (PTB19).
- Initializes and enables interrupt for RTC.
- Enables RTC API and loads the APIVAL to 3000ms.
- Starts timer.
- Enters standby (or fast standby).
After the period defined, RTC API generates an interruption and MCU wakes up. After wake-up, MCU resets and polls for SW5 to be pressed again.
The RTC API value can be changed with RTC_PERIOD_DELAY_MS(x) macro defined in Wkpu.h.
This example is provided as is with no guarantees and no support.