[SOLVED] Have to reset every time I upload

Hello, I’ve been happily uploading code to my lovely Arduboy for a couple of weeks now without any issues, but now suddenly the Arduino software gets stuck at “Uploading…”

I have been able to get past this by using the reset method detailed in the FAQ section of the Arduboy website, but unfortunately I have to do this every single time I upload. Normal service never returns to the Arduboy.

Can anyone offer any tips on what I can do? Resetting every time is a real pain in the bum!

Thanks
Andy

Check if the com port is still the same in Tools > port.

Does compiling (uploading) run slower then before and did you change the location of the Arduino IDE ?
(When the Arduino IDE resets Arduboy, the bootloader mode is activated for just 8 seconds)

Is this on every game or one particular game?

(Some games that use a lot of progmem or memory will sometimes interfere with the uploading system.)

The com port is the same. I’ve tried swapping USB ports and changing the com port to match, but that doesn’t help. The IDE hasn’t changed location. Compiling and uploading isn’t any slower, it just requires me to manually push the reset button each time I want to upload.

It happens with every game I try to upload, even just a simple “hello world”.

I should add that the IDE is definitely finding the Arduboy because when I try to upload without doing the manual reset, the Arduboy resets on its own like normal, but then it just displays the last game that was uploaded.

That sounds like the bootkey problem. But strange that it seems to happen to ‘all’ the games.

The Arduino IDE resets the Arduboy by opening and closing the comport at 1200 baud. When the USB code in a sketch detects this it puts a magic value in ram and uses the watchdog timer to reset Arduboy. On reset the bootloader checks what the reason was for the reset. In case of a watchdogtimer reset it looks for the magic key. if it finds it it will enter the bootloader if not, it just starts the sketch again.

The problem is that when the watchdog timer is set, Arduboy doesn’t reset immediately but waits for the watchdog period to timeout. During this time the sketch is executed and there is a change that the magickey is overwritten. Which causes just a reset instead of entering the bootloader.

This problem is not Arduboy specific but a general problem of the Caterina bootloader. If you have an ICSP programmer you can burn the custom bootloader I wrote. Using this the magic key will be stored at the end of ram and will not be overwritten by sketch.

1 Like

I’ve managed to fix it! The solution was to compile the code for a game, then hold down the reset button and while it’s being held, press upload in the IDE. Then after a couple of seconds I released the reset button. The uploading completed successfully and since then I have been able to upload code without having to use the reset button at all.

1 Like

That sounds to me like it wasn’t actually uploading at all before, it was resetting before the upload finished.