Uno Bootloader Fixer...

I've written a short sketch that will help you load a fixed bootloader unto you Uno systems, assuming that you have a second arduino of some kind to do the fixing.

This is based on the arduinoISP programming sketch, except it includes an internal copy of a (fixed) optiboot bootloader, so there are no communications issues. You just connect up an Arduino containing the sketch to an Uno with the iffy bootloader (as per instructions here: http://arduino.cc/en/Tutorial/ArduinoISP ), hit reset, and it will drop in a new bootloader. (Status is displayed to the Serial port at 19200bps, but you don't really need to watch it.)

This is actually a subset of a more ambitious effort to load optiboot into all sorts of old Arduinos, but that's waiting on more complete documentation. meanwhile, doing Uno only is pretty simple and is getting increasingly urgent as more optiboot bugs show up.

the fixed optiboot included in the sketch has:

  1. PWM timer initialization fixed (this was also fixed in the core.)
  2. 30k upload limit fixed.
  3. zero register initialization (Sketch amnesia) fixed.

optifix.zip

Question, do I give optiboot up as a lost cause (like I had done) or try it one more time ?

After previous negative comment, I'm happy to report that after implementing this, it appears to have resolved my issues with optiboot, for the first time I've been able to put it to work running my home monitoring system.

Well see, that wasn't so bad. :sunglasses:

I'd been suffering optiboot since I first came across it about 3 months before they launched the UNO. This one appears to work. If it continues to behave I might just put it on my Duemilanoves :slight_smile:

I've been using the lady adafruit bootloader for seems like a year now on all my 328 setups. It handles WDT correctly and seems to have a very short bootloader time out, sketches seem to start instantly on power up.

What is the timeout period of optiboot and does it handle WDT interrupts correctly? I'm aware of it's biggest advantages, smaller size and faster baud rate.

I do use an interrupt in my sketch but its just a standard attachInterrupt(); job. Never really done anything with the watchdog stuff. I always had it down as something you used when you put it to sleep to save your precious batteries....

I always had it down as something you used when you put it to sleep to save your precious batteries....

That's it's most common use around here I think. It's main purpose in industrial use is as a safety feature to reset the processor in case it locks up in some kind of endless loop due to a programming error or some kind of glitch, and can be used externally to cause fall back to manual control, sound an alarm, etc.

What is the timeout period of optiboot and does it handle WDT interrupts correctly?

I believe the optiboot in optifix has a one second timeout.
All versions of optiboot handle WDT correctly (optiboot includes the AdaBoot startup features...)

Can your fix be made the standard Optiboot ? The 'official' optiboot site still has V3 from May last year.

http://code.google.com/p/optiboot/

Which is probably whats going onto the Uno as standard.

The optiboot source code is now beyond "version 3"; the new source version has the 30k fix (plus support for other CPUs, plus some other stuff.)
The "amnesia" fix has been submitted as an optiboot issue (with patch), and SHOULD get into the official source at some point. (meanwhile, it got added to the optiboot source that comes with the Arduino environment, but that version doesn't have the 30k fix.)

Sigh. Keeping the official optiboot in sync with the arduino optiboot, and up-to-date (tested?) with some set of changes becomes essentially a non-technical issue of ... some difficulty. Not dissimilar to the Arduino issues that turn out to be due to gcc compiler bugs.