Skip to main content
Davy Jones
Associate II
March 20, 2018
Question

Code for soft reset STM32F3 series MCU ?

  • March 20, 2018
  • 3 replies
  • 7479 views
Posted on March 20, 2018 at 07:54

I am working STM32F303CC MCU. Trying to find sure shot way of soft resetting the device. 

Previously I tried with

NVIC_SystemReset() 

. It was and miss. On some boards it worked perfectly and on other boards the system will just stop responding.  

So I have written a small function to soft reset the core, Need feedback from the embedded gurus in the forum

void soft_reset(void)

{

__set_PRIMASK(1);

SCB->AIRCR =  ((uint32_t)0x05FA0000) |  ((uint32_t)0x01);

while(1);

}

#hang #soft-reset ##stm32f4 #stm32f3
This topic has been closed for replies.

3 replies

AvaTar
Senior III
March 20, 2018
Posted on March 20, 2018 at 08:35

On some boards it worked perfectly and on other boards the system will just stop responding.

Why that ?

NVIC_SystemReset() supposedly does the same.

Tilen MAJERLE
ST Employee
March 20, 2018
Posted on March 20, 2018 at 09:17

Hello

davindersingharora

‌,

by usingNVIC_SystemReset(); function, you can reset MCU with software. It is defined in filecore_cm4.h.

Best regards,

Tilen

Jan Waclawek
Visitor II
March 20, 2018
Posted on March 20, 2018 at 11:12

Previously I tried withNVIC_SystemReset. It was it and miss .

On some boards it worked perfectly and on other boards the system will just stop responding.

Show us how the NRST pin is connected.

JW