2013-04-09 02:52 AM
Hi all,
I'm currently working on a custom bootloader. Whenever a reset occurs, it should check if that reset was initiated by the user application. The user application generates a reset by calling the NVIC_SystemReset function. It seemed logically to me, that this equals generating a software reset so i could check the SFTRSTF flag in RCC_CSR. However, it isn't set when calling NVIC_SystemReset. The reference manual RM0008 states that it is ''Set by hardware when a software reset occurs.'' [RM0008 rev 14,page 148]. So, I'm wondering what causes the SFTRSTF-flag bit to be set by hardware as stated in the reference manual? I'm currently setting the flag manually before calling NVIC_SystemReset, but I'm not sure if that's a correct solution. Regards Jesper.2013-04-12 08:00 AM
Allright, thanks all! :)
2014-04-07 11:37 AM
This is very good info. I am trying to do something very similar with a custom bootloader. I wanted to check the software reset flag on power-up to determine where the reset came from but it seemed to be always set even after a power-on reset. I am testing on a STM32F401 Discovery board and I wondered if the debugger was fooling with these flags, it seems like that is probable. Maybe if I power the board independently it will work the way I want. I can test the SFTRST flag and set an LED accordingly.
Mike