Determine STM32 reset source
When your STM32 processor starts up from a reset, there are a number of possible sources for that reset. You may want to perform different initialisations depending on the exact source of the reset. A single register holds the flags which tell you why the processor was reset. It is…