rogerclarkmelbourne / Arduino_STM32

Arduino STM32. Hardware files to support STM32 boards, on Arduino IDE 1.8.x including LeafLabs Maple and other generic STM32F103 boards
Other
2.49k stars 1.25k forks source link

How to access RCC_CSR register to detect "Device reset cause"? #890

Closed abhaysbharadwaj closed 1 year ago

abhaysbharadwaj commented 1 year ago

Hello, I understand that by reading the RCC_CSR registers, we can understand what caused the microcontroller to reset. Example:

RESET_CAUSE_LOW_POWER_RESET,
RESET_CAUSE_WINDOW_WATCHDOG_RESET,
RESET_CAUSE_INDEPENDENT_WATCHDOG_RESET,
RESET_CAUSE_SOFTWARE_RESET,
RESET_CAUSE_POWER_ON_POWER_DOWN_RESET,
RESET_CAUSE_EXTERNAL_RESET_PIN_RESET,
RESET_CAUSE_BROWNOUT_RESET,

How can I access this in the void setup() part of my code?

rogerclarkmelbourne commented 1 year ago

Issues are not a general support forum.

Try posting to STM's STM32 community forum

https://community.st.com/s/topic/0TO0X000000BSqSWAW/stm32-mcus