cancel
Showing results for 
Search instead for 
Did you mean: 

how to issue one time software reset STM32F0xx after power up.

HoangDuong
Associate II

I need issue software reset after 1s when power up stm32f0xx, like press hardware reset button but i need in software. plz help me implement only one time after amount 1 second when power up stm32.

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

You can check if the last reset was a software reset by reading RCC_CSR flags.

You can check the approximate time from reset by looking at HAL_GetTick() >= 1000.

You can perform a software reset by calling HAL_NVIC_SystemReset.

Put those three together.

If you feel a post has answered your question, please click "Accept as Solution".

View solution in original post

7 REPLIES 7
MM..1
Chief II

In reset flag you can check power on reset and do for example iwdg

TDK
Guru

You can check if the last reset was a software reset by reading RCC_CSR flags.

You can check the approximate time from reset by looking at HAL_GetTick() >= 1000.

You can perform a software reset by calling HAL_NVIC_SystemReset.

Put those three together.

If you feel a post has answered your question, please click "Accept as Solution".
HoangDuong
Associate II

Thanks for answer!

it not what i want. i can use iwdg or NVIC_SystemReset in normal mode, but not in this situation.

after power up MCU, if i put NVIC_SystemReset in code or timer, next time it will reset, but i only want it reset one time. And, after reset it will working normal and do not executed reset command any more. (only executed soft reset one time when power up)

That is why you read the RCC CSR register to determine if last reset was soft reset and if so, don’t reset again. That is exactly what you want based on your description.
If you feel a post has answered your question, please click "Accept as Solution".
HoangDuong
Associate II

@TDK​ 

Thanks so much, i dont know stm32 have some reset flag to monitor reset status of MCU. This is exactly what i need, just monitor SFTRSTF bit in RCC_CSR will know hardware or software reset

Piranha
Chief II

Taka a note that the software reset bit (SFTRSTF) will be set also on NRST pin reset and therefore on POR/BOR resets also. Most likely you have to check POR/BOR or NRST reset flags for your goal.

HoangDuong
Associate II

Thanks for your suggestion Piranha.