2020-09-24 03:18 AM
i would like know the cause of reset during the power on stage for may application.
i would like to differentiate if its power on reset/NVIC reset/WDG reset or any other cause?
2020-09-24 05:39 AM
The reference manual describes the RCC Reset Status Register RCC->RSR.
The bits in there are cumulative. Once you have read and handled a particular cause of reset, you need to set RMVF to clear them ready to record the next reset by doing RCC->CSR = RCC_CSR_RMVF;
Hope this helps,
Danish
2020-09-25 01:22 AM
hi @Danish ,
Thanks for your response.
Please find the example
uint32 reset_status = 0;
reset_status = READ_BIT(RCC->RSR, RCC_RSR_PORRSTF);
if(reset_status==0x00800000) // POWER on reset
{
}
Please not its important to deinit and clear all the flags before the reset to get the actual reset value from RCC_RSR register.
Also, while testing please avoid the debug mode.