Arduino Amnesia

Hi all

Just ran into a strange situation with my Arduino Uno (Rev 2 - not smd) forgetting sketches. I tinkered with the standard “blink” sketch to produce a heartbeat type effect and just had it running for an hour or two powered via the USB. I then loaded up the sketch that I have been working on for a while (only partially finished, but wanted to check a few parameters) and it worked as well as I expected. I then unplugged the usb from the pc to power down the board. All fine so far. But…

Coming back to the board, I reconnected the board via USB, and my sketch wasn’t working, but it was running the heartbeat sketch from earlier…huh? I reloaded the development sketch, and it worked fine. Powered down again and then repowered the Arduino and it was back to the heartbeat sketch again. I now find that it will run any sketch I load into it, but as soon as I power down and then power up again, it keeps on forgetting what was loaded and runs the heartbeat sketch instead. What on earth is going on - is it a bootloader problem? Bear in mind that this board and ATMega328 chip have been used for many sketches over the last 4 or 5 months with absolutely no problem. This amnesia only started today.

It can’t be the bootloader as I have just tried the ATMega328 in a different board and all is fine there, sorta infers a problem with the original board :~

Any suggestions?


Are you certain it is the heartbeat sketch that runs after reconnecting the board? Could it be the bootloader running?

Hi CB Hmmmm, I suppose it could be, but it is only the onboard (pin 13) led that is flashing - short pulse, delay, slightly longer pulse, longer delay and repeat.

The Tx and Rx leds do not flash at all, unless I upload another sketch of course. That sketch will run ok until power down, then it reverts to the original sketch on powerup. I'm going to try the misbehaving board with a different ATMega328 (when it arrives!) and see if that also behaves in the same way.

Thanks Bernie

Other than the somewhat unusual blinking at startup, the symptoms sound an awful lot like an old optiboot bug.

Maybe this is the culprit...