The following article shows a basic configuration for S32K3 that allows the MCU to transition from RUN mode to a Standby mode.
The following software tools were used to develop and deploy the application onto the S32K3 board.
The application is developed for the following hardware*:
In this chapter, I show most important settings that must be to allow the MCU to enter standby mode and to be able to wake up and switch to RUN mode again. For more details, please download the files attached and consult the configuration project.
Two pins must be configured for this application:
Figure 1. Configuration Pins tab - Dio_Pins_MBDT Functional Group
A new Functional Group must be created for the Standby Mode. This can be done from the Clocks tab (as shown in the image below).
Figure 2. Configuration Clock tab - Create new Functional Group
Figure 3. Configuration Dio Component - DioGeneral
Figure 4. Configuration Dio Component - DioChannel Wkpu_DioChannel
Figure 5. Configuration Dio Component - DioChannel Green_Led_DioChannel
The Port configuration must match the settings configured in the Pins tab (check Pins Configuration chapter).
Figure 6. Configuration Port component - PortPin Wkpu_PortPin
Figure 7. Configuration Port component - PortPin Green_Led_PortPin
A new McuModeSettingConf must be created. It is going to be used to switch to STANDBY mode.
Figure 8. Configuration Mcu component - McuModuleConfiguration -> McuModeSettingConf
A new McuClockSettingConfig must be created. The MCU will use to this clock tree when it is in standby. All the settings in this newly created McuClockSettingConfig must match the settings made in Clocks tab.
Figure 9. Configuration Mcu component - McuModuleConfiguration -> McuClockSettingsConfig
Make sure that for the new McuClockSettingsConfig, in the configuration tab, the Functional Group created in Figure 2 is selected.
Figure 10. Configuration Mcu component - McuModuleConfiguration -> McuClockSettingsConfig -> Configuration
Figure 11. Configuration Icu component - IcuConfigSet -> IcuChannels
Note! The first 4 Hardware Channel are internally routed. For the evaluation board that I used, the PTB17 corresponds to the WAKE_14. In the configuration project, the hardware channel must be set to CH18 (to offset the first 4 internally routed hardware channel).
Figure 12. Offset internally routed hardware channels
Figure 13. Configuration Icu component - IcuConfigSet -> IcuWkpu -> IcuWkpuChannels
Figure 14. Configuration Icu component - IcuConfigSet -> IcuHwInterruptConfigList
The Simulink model used to switch from RUN mode to STANDBY mode can be seen in the picture below. It can also be found in the achieve attached to this article.
The application executes the following tasks at each steps:
Figure 15. Simulink Model S32K3_Standby_GPIO_Wkpu
Figure 16. Enter Standby mode routine
Figure 17. Custom code to enter standby mode
To validate the application, the FreeMASTER tool is used to connect to the board and initiate the sequence to enter standby mode. To connect the board, I used the debug probe.
Figure 18. Connect FreeMASTER tool to the board using debug probe
If everything is properly configured, the FreeMASTER should now be connected to the board. In the Variable Watch, the value of the counter variable is increased each second.
To enter standby mode, the value of the enter_standby variable must be set to 1. If the sequence to enter standby mode is correctly executed, the value of the counter shouldn't be updated anymore and the LED should stop blinking. Also, the board is disconnected from the FreeMASTER board.
To exit standby mode, use the jumper wire to connect the PTB17 to a GND pin. The LED should start blinking.
In this article, I presented a basic implementation that allows the S32K344 to enter standby mode. The configuration presented here doesn't maximize the power savings, as the user should take care of putting the pins in a floating state, disable all unnecessary clocks and many more. For further details, please consult the S32K3 reference manual.
This application was based on the examples found in this article: S32K3 Low Power Management AN and demos. Kudos @Shuang!