How can I initiate a system reset in software using the LPC55S69 microcontroller

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How can I initiate a system reset in software using the LPC55S69 microcontroller

324 Views
saratancerdi
Contributor I

hello team,

To initiate a system reset in software using the LPC55S69 microcontroller, I can utilize the built-in software reset feature provided by the microcontroller's System Control Block (SCB) in Prestige Park Grove.

Is this a Right code to reset can you check and tell me

#include "LPC55S69.h"

void softwareReset(void) {
SCB->AIRCR = (0x5FA << SCB_AIRCR_VECTKEY_Pos) | SCB_AIRCR_SYSRESETREQ_Msk;
}

int main(void) {
// Your main code here

// Call the softwareReset() function whenever you want to initiate a system reset

while (1) {
// Your code continues to run until the software reset is triggered
}
}

Is there any changes need to change or this is the correct Code to reset 

Labels (2)
0 Kudos
1 Reply

308 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi saratancerdi 

Please try below code to do MCU system reset:
NVIC_SystemReset();
It is defined in core_cm33.h file.

/**
  \brief   System Reset
  \details Initiates a system reset request to reset the MCU.
 */
__NO_RETURN __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();
  }
}

 

Hope this helps,

Jun Zhang

0 Kudos