I'm using the MIMXRT1062 chip and I have a battery powering SNVS and the rest of the chip is powered by an external power supply. Is there a way to run code when the external power supply is removed? Currently, when that power is removed, the chip goes into suspend mode with just the SNVS powered. This works fine, but I am using the PMIC_STBY_REQ pin as a GPIO pin (bank 5, pin 2) and I want to change its output from High to Low when the chip goes into suspend mode. Is there some interrupt that I can setup when the chip is normal mode that will run in SNVS mode once when power is removed?
Thanks for the information. Sounds like I'll need to add external circuitry to trigger the MCU before it (fully) loses power.
Q. Is there a way to run code when the external power supply is removed?
A. No, it is not possible. Removing the main power means removing the power from
the CPU core, so, no code can be executed. The VDD_SNVS_IN voltage only supplies
the 32kHz oscillator and SNVS module. When the main power is back, the processor
starts booting in normal cold boot.