This is my first time to design STM32 circuit and I have no experience about the power down procedure.
In my opinion, it may be very rude to shut down the power supply as soon as the user presses the power down button because STM32 may need some time to store important information before shutdown.
Therefore, I guess the procedure may be like this: after the user presses the power button, the circuit should send the highest priority interrupt to STM32 who stores all necessary data immediately. After that, STM32 sends the disable signal to the regulator who provides the power to the whole system.
I'm not sure whether my guess is correct. If it doesn't like this, can someone tells me how what should the power-down procedure be in a real product or tell me where can I get the tutorial about power-down design? Thank you.