This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

system reset request (NVIC_systemreset) does not restart the M4 controller

Hi,

I am working on M4 microcontroller. I would like to perform soft reset of the system. so I have used NVIC_SystemReset function as shown below


__STATIC_INLINE void __NVIC_SystemReset(void)
{
  __DSB();                                                          /* Ensure all outstanding memory accesses included
                                                                       buffered write are completed before reset */
  SCB->AIRCR  = (uint32_t)((0x5FAUL << SCB_AIRCR_VECTKEY_Pos)    |
                           (SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) |
                            SCB_AIRCR_SYSRESETREQ_Msk    );         /* Keep priority group unchanged */
  __DSB();                                                          /* Ensure completion of memory access */

  for(;;)                                                           /* wait until reset */
  {
    __NOP();
  }
}

When I do this, the system gets restarts only when I do power-on reset or Reset in keil debug window. Is this correct operation?

I need the processor gets restart without doing power-on reset or Resetting from keil debug window. please let me know if anyone has solution

thanks in advance

  • Did you try it w/o debugger attached?

    And did you check the symbolic constants are correct?

    Edit: I just wrote 0x5fa0001 via debugger and my CM4 did reset.

  • Hi,

    Thanks for suggestions

    1) I tried w/o debugger attached but reset is not taking place

    2) Symbolic constants are correct

    3) when I try to write 0x5fa0001 via debugger, the value is rolling back to 0x5FA

    __STATIC_INLINE void __NVIC_SystemReset(void)
    {
      __DSB();                                                          /* Ensure all outstanding memory accesses included
                                                                           buffered write are completed before reset */
      SCB->AIRCR  = (uint32_t)((0x5FAUL << SCB_AIRCR_VECTKEY_Pos)    |
                               (SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) |
                                SCB_AIRCR_SYSRESETREQ_Msk    );         /* Keep priority group unchanged */
      __DSB();                                                          /* Ensure completion of memory access */
    
      for(;;)                                                           /* wait until reset */
      {
        __NOP();
      }
    }

    Thanks in advance

  • I'd use the memory dump window instead of the special one. Not sure what the debugger does under the hood.