I'm trying to upload a new sketch but am unable due to the existing sketch on both of my boards. I was previously testing communication between Arduinos using serial communication, and apparently the delay before they start trying to communicate is too short and so new sketches can't be uploaded via USB before the previous sketch starts spamming over the serial port. I've tried uploading a blank sketch hoping it would be as short of an upload time as possible, but the communication lights start flashing (indicating the previous sketch has started spamming) before the upload completes, and then the upload progress bar just gets stuck.
I have both an Arduino Uno and Arduino Nano, and they both have the same issue. Is there any way to "factory reset" these boards without code? The only suggestion I've seen is to upload a blank sketch, but that doesn't work since I can't upload it.
All I can say is, the described phenomenon does not occur with any of my Nano, Uno, Mega2560, or Every products, be they clone or genuine. I have a strong suspicion you have something more going on.
Your sketch stops at the moment that avrdude opens the serial port and asserts DTR to start the upload. That will reset your board and the bootloader is activated and your sketch is not running at that moment. So your scenario is highly unusual.
The bootloader will be active for a few seconds if no data is transferred or will stay active during the upload.
Burn the bootloader. You will need a programmer or an other Arduino that is programmed with a programmer sketch.
In the Arduino IDE, I selected Tools -> Programmer -> Arduino as ISP, then Burn Bootloader, but it also gets stuck. The existing sketch starts communicating around one second after it gets reset which seems to be before the process completes.
I'm not familiar with SPI but I assume that this would circumvent the issue with using serial communication? With the caveat that I'd need another (functional) board like you said?
You all were right in that the issue involved the bootloader, and that my guess for what the problem was is incorrect. It turns out that in the Arduino IDE I needed to choose Tools -> Processor -> "ATmega328P (Old Bootloader)" instead of "ATmega328P", and then I was able upload a new sketch successfully.