Some projects just don’t want to lie down…
The isp_repair example sketch in the Ports library was written for a single purpose: to upgrade a JeeNode to the OptiBoot loader, which leaves more room for sketches and is compatible with the Arduino Uno.
It took two attempts to get it right, but in the end I think it all worked out as intended.
Until featuritis sets in…
First, I added a #define OPTIBOOT in the sketch, to allow re-using that same sketch to revert to the original boot – in case you ever want to go back. So now it’s a setup which can “repair” an ATmega in various ways.
But why stop there?
There are a couple variations for flashing which all make sense in the context of JeeNodes:
- load a short Blink sketch, or load the entire standard RF12demo sketch
- OptiBoot vs the original Arduino 2009 bootstrap code
- faster wakeup after power down, works only with a 16 MHz resonator
The fast wakeup makes it possible to completely power down an ATmega between the reception and transmission of individual bytes via the RF12 driver. It won’t make a huge difference, but it will reduce power consumption just a notch more than staying in idle mode.
So here’s a new setup, and hopefully the last:
It includes yesterday’s DIP-switch Plug, which gives me 4 bits of configurability. There’s a new sketch which adds support for these switches and includes all the different pieces if code – it’s called isp_repair2:
The sketch includes up to four different boot loaders, currently:
There are two “sketch” code sections, followed by 4 bootstrap code sections:
With all switches set to “1″ (same as not connecting any switches at all, BTW), we get:
And since (in my case) there’s an on-board LiPo recharger and battery tacked onto the back: this setup is fully self-contained and ready for use at any time.
Hmmm, I wonder what sort of bootstrap loader I could put in that spare slot, one day…