cancel
Showing results for 
Search instead for 
Did you mean: 

stm32f4 using NVIC_SystemReset() fails to reset

ari_v2
Senior

Hello,

My board consists of stm32f427 and I have a strange problem.

Calling NVIC_SystemReset() causes CPU to hang. This happens only on some boards.

I could overcome the problem in one of the following:

  • Add a HAL_Delay(100) before calling NVIC_SystemReset()
  • Change code in NVIC_SystemReset() as follows:

   SCB->AIRCR = ((0x5FA << SCB_AIRCR_VECTKEY_Pos) |

               (SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) |

             SCB_AIRCR_SYSRESETREQ_Msk |               

SCB_AIRCR_VECTCLRACTIVE_Msk | SCB_AIRCR_VECTRESET_Msk)

   These 2 additional bits cause CPU to reset, although they are meant to be used only for debug

  • Of course system will reset if I use the IWDG.

I read in forums that others encountered this problem but in my case it looks different:

  • NRST pin has a pulldown 0.1uF.  NRST is not pulled up. As shown below in figure
  • BOOT0 is connected to ground. 

Could anyone please explain:

Why NVIC_SystemReset() does not work on some boards?

How could the delay of 100 msec or setting system control register bypass the problem?

Thank you,

Ari

11 REPLIES 11
TDK
Guru

Only thing I can guess is if there's some flash operation still ongoing that is affecting things.

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

All very odd, don't have an explanation here.

Did you stop something else just prior to doing the reset? Flash Write or Erase? Turn off a PWM?

Is the capacitor really 100nF (0.1uF) and not something much larger?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..