Can't upload new sketches [Solved]

I see that a couple of other people have had this problem, but there don’t really seem to be good answers posted. I apparently uploaded a sketch (~25KB of flash, 1800B of RAM) that somehow made it impossible to upload new sketches. The sketch I uploaded actually seems to be operating properly (and I can boot it into flashlight mode), but nothing I do seems to let it program a new sketch. I’ve tried resetting it and programming it within the 6 second window (probably 30 attempts before I gave up). Switching USB ports, changing the order of unplugging/plugging/powering on/off/etc. has no impact. When I hit upload it causes the arduboy to reset, but then it just boots into the application again.

I am using Arduino IDE 1.8.0 on Ubuntu 16.04. I had previously experienced this problem, and while trying to reset it to program it, my arduboy became completely unresponsive and required replacement, so I am nervous about trying to reset it too many times. Could someone at least explain what exactly is going on when it’s in this state? I actually work with embedded electronics for a living, and I’ve never used a platform this flaky before.

Do you get a “usb device descriptor” when the Arduboy is in flashlight?

The common problem that using flashlight mode solves it due to the unfortunate decision by the Arduino people to “hard code” the location of a “magic number” (used to invoke the bootloader) in a RAM location that can end up being used by the sketch.

The issue and a solution is being discussed by Arduino but progress is slow.

Using flashlight mode should prevent the sketch itself from overwriting the “magic number” during a reboot/upload sequence.

There’s a very small chance that the location ends overlapping RAM used by a timer interrupt service routine. The latest version of the Arduboy2 library has code in flashlight mode to address this problem but sketches compiled with an older version of Arduboy2 or a different library could be affected by this. This problem requires using the reset button for recovery.

Also, some Arduboys were shipped without the proper fuses being set to protect the bootloader. If the bootloader has been accidentally overwritten as a result of this, then this is a different problem that even using the reset button can’t solve. You need to re-burn the bootloader using a hardware programmer.

When it’s in flashlight mode, I get the following in dmesg when I plug it in:

[69553.930768] usb 2-1: new full-speed USB device number 35 using xhci_hcd
[69554.061135] usb 2-1: New USB device found, idVendor=2341, idProduct=8036
[69554.061138] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[69554.061140] usb 2-1: Product: Arduboy
[69554.061141] usb 2-1: Manufacturer: Arduino LLC
[69554.061839] cdc_acm 2-1:1.0: ttyACM0: USB ACM device

So it looks like it enumerates just fine, but it just resets as soon as I try to program it.

Also, I am using Arduboy2 v3.1.1.

It sounds like I might have gotten unlucky and an ISR is writing to location 0x800.

What should be happening when the reset button is pressed (which doesn’t seem to work either on mine)? It seems like it might be a little slow to re-enumerate or something on my computer (i.e. the IDE doesn’t detect it going away and showing up on a new port in time), although that’s just a guess.

The reset switches from the HID+Serial device (VID_2341&PID_8036) to the arduino leonardo bootloader mode (VID_2341&PID_0036). So if you are not getting the second mode, then you are not able to upload any new sketch.

My question is, if you press reset, do you get a new USB device arrival? or just goes back to the normal (VID_2341&PID_8036) after 8 seconds?

The fix for a timer interrupt overwriting the magic key was added in Ardubboy2 V4.0.0

Hmm, it looks like it is going into bootloader mode. Here is the log of me powering it on in flashlight mode, hitting reset, and then eventually going back into flashlight mode:

[ 226.720637] usb 2-1: new full-speed USB device number 4 using xhci_hcd
[ 226.851999] usb 2-1: New USB device found, idVendor=2341, idProduct=8036
[ 226.852002] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 226.852005] usb 2-1: Product: Arduboy
[ 226.852006] usb 2-1: Manufacturer: Arduino LLC
[ 227.378823] cdc_acm 2-1:1.0: ttyACM0: USB ACM device
[ 227.379627] usbcore: registered new interface driver cdc_acm
[ 227.379631] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
[ 238.584529] usb 2-1: USB disconnect, device number 4
[ 239.357105] usb 2-1: new full-speed USB device number 5 using xhci_hcd
[ 239.487020] usb 2-1: New USB device found, idVendor=2341, idProduct=0036
[ 239.487023] usb 2-1: New USB device strings: Mfr=2, Product=1, SerialNumber=0
[ 239.487025] usb 2-1: Product: Arduino Leonardo
[ 239.487026] usb 2-1: Manufacturer: Arduino LLC
[ 239.487218] usb 2-1: ep 0x82 - rounding interval to 1024 microframes, ep desc says 2040 microframes
[ 239.487523] cdc_acm 2-1:1.0: ttyACM0: USB ACM device
[ 247.135730] usb 2-1: USB disconnect, device number 5
[ 247.405432] usb 2-1: new full-speed USB device number 6 using xhci_hcd
[ 247.536827] usb 2-1: New USB device found, idVendor=2341, idProduct=8036
[ 247.536830] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 247.536832] usb 2-1: Product: Arduboy
[ 247.536834] usb 2-1: Manufacturer: Arduino LLC
[ 247.537353] cdc_acm 2-1:1.0: ttyACM0: USB ACM device

Does this mean that hitting reset should work, I’ve just had bad timing so far?

Yeah I think so, everything looks OK. I do not have a lot of experience with linux in terms of avrdude so I cannot give any extra tip. If you have a chance, you can try my Arduboy Uploader from (but you need a Windows machine); just to discard things.

I tried your uploader on a windows computer, but it’s similar behavior to the arduino IDE under linux - when I press reset it says it can’t see the device (i assume that’s what the arduboy frowny-face means) until it times out and you see the Arduboy logo scroll down the screen, at which point it says it’s trying to upload, but it just causes the application to reset again (and it eventually reports failure).

I just can’t seem to get anything to actually talk to the bootloader when I reset it for some reason.

Can you try again and open the Event Viewer to see the description of the error (frowny-face)?:

It looks like a timeout, but if the port appeared then there should be more info about the error (dump from avrdude output). Or try in Arduino IDE via enabling the verbose mode in preferences

When trying to upload after I reset the arduboy, I get this:

Error putting the Arduboy in bootloader: A device attached to the system is not functioning.

When my application is running and I try to upload, I get this:

Error uploading the file to the Arduboy:

No text after that? :hushed:

After that it says:

the message resource is present but the message is not found in the string/message table

This computer is running Windows 10 with Arduino 1.8.2 installed (but none of the arduboy stuff).

I think you should try to upload the bootloader as I said in my first message here, or contact support.

Just to provide some closure to this thread - I programmed a Mega 2560 board I had lying around to be an ISP, and soldered leads onto the back of my arduboy. I was able to re-flash the bootloader, and then re-upload my game (using Arduboy2 4.0.2, which I’m really hoping won’t exhibit this problem again - I’ve hit it with both games I’ve tried making).

So everything seems to be working for now.

1 Like

@fentonc Good on you! It does appear that there are a variety of scenarios in which the bootloader can become corrupted. An unknown number of units exist in the wild with unlocked bootloader protection and we’ve implemented a check for it in the factory now.

For people who aren’t comfortable reflashing the bootloader use the contact form at and we can try to help you out.

1 Like