cancel
Showing results for 
Search instead for 
Did you mean: 

Software reset flag (SFTRSTF) in RCC CSR register: what source?

jdaalwijk9
Associate II
Posted on April 09, 2013 at 11:52

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.
11 REPLIES 11
jdaalwijk9
Associate II
Posted on April 12, 2013 at 17:00

Allright, thanks all! :)

munger
Associate II
Posted on April 07, 2014 at 20:37

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