I was not able to get the watchdog timer method to work. I think I found the answer here. That worked for me, and I think it is exactly what you want to do. Here’s the code:
void softReset(){
Serial1.println(“resetting”);
USBCON&= ~(1<<USBE);
delay(5);
asm volatile(" jmp 0");
}
I assume you won’t need the Serial1.println() statement so you can edit that out. My understanding is that for this low-level code: The USBCON flags the usb as “not connected” and the jump 0 resets in a “usb just reconnected” state.