Closed bschwind closed 3 years ago
@skywhale could I get one more look at this? I changed the USB code a bit to initialize the USB device right before the loop so it's less likely to miss any USB communication from the host, and I also added some code to reset the bus before starting up.
Occasionally after uploading firmware via DFU, the tonari serial device would not show up on the host. This forced reset condition seems to fix it. I have jumped to the bootloader, uploaded new firmware, and reset dozens of times without failure on my laptop. I'll test it on linux as well.
@skywhale please review
Here's the basic summary of the changes:
Bootload
command to tell the device to go into bootloader mode0
and jump to the bootloaderThe reason for this little dance instead of just jumping directly into the bootloader is that we would otherwise have to reset all device peripherals back to their default state, including USB devices, timers, etc.
It's much easier to simply reset and jump to the bootloader before we configure any hardware devices.
References: