ESP32C6 and NVIC_SystemReset

I’m looking for a way to do a software reboot on an ESP32C6. The context is that this is a reboot after a factory reset and wipe of configuration data. My research says that this is achieved by calling NVIC_SystemReset() but the Arduino IDE says this isn’t defined. (“Compilation error: ‘NVIC_SystemReset’ was not declared in this scope”). I can’t find which header file this function is declared in. Is it somewhere that’s not obvious, or is there a deeper problem in that the function isn’t defined for the ESP32C6? The Seeed wiki doesn seem to have anything relevant. Any pointers/help would be greatly appreciated.

Please try
ESP.restart().

EDIT
[Note]:I tried it, but after executing ESP.restart(); two or three times, C6 hangs up. To start it up, I need to re-upload the sketch. The cause is still unknown.

Simple code seems to restart without any problems.

void setup() {
  Serial.begin(115200);
  delay(1000); 
  pinMode(LED_BUILTIN, OUTPUT);
}

void loop() {
  for(int i = 0; i < 10; i++) {
    digitalWrite(LED_BUILTIN, LOW);
    delay(200);
    digitalWrite(LED_BUILTIN, HIGH);
    delay(200);
  }
  Serial.println("Restarting now...");
  delay(1000);

  ESP.restart();   
}

Many thanks. I’ve not found this call documented anywhere else so this is a good find for me. I tried it, and it works. It’s for a feature that I don’t expect to be used very often and it’s not for a commercial product, so having to re-upload occasionally isn’t a problem.

Hi there,

What about going to Deep sleep with no-time/very sort timer wake-up? . (where it goes to sleep and wakes right up) Would it not start from reset? like the Nrf52840 Xiao, maybe.

HTH
GL :slight_smile: PJ :v:

I tried it, and it restarts without any problems either way.

  esp_sleep_enable_timer_wakeup(1);
  esp_deep_sleep_start();
  ESP.restart();