I'm trying to reboot an Arduino mini from within the running program. I found this on the web:
sei();
MCUCR |= _BV(IVSEL);
asm volatile ("\tjmp 0x1C00\n");
But it doesn't work reliably. Sometimes it reboots and I can download a new program, or watch the program restart, and sometimes it goes into the weeds and the bootloader never responds to downloading, and the existing program never starts up even when I don't attempt to download anything.
I need this functionality because the mini is going to be built into a small container that for practical and aesthetic reasons I won't have access to the reset switch. I will have serial communications, however. Any advice?