But it reflects what I have been doing the past several of days. Flashing in an opti-boot bootloader that will work at 3.3v and 8Mhz. As pointed out here:
Arduino's normal Bootloader had a bug in it that prevents the watch dog from working. Most people will not see this as Arduino Uno's are now loaded with the improved optiBoot, which corrected this bug. However, in selecting the 'defaut' 3.3v / 8Mhz 328p board type, one gets the old bootloader - faults and all.
So I worked to locate the OptiBoot loaders and more specifically a binary for an 8Mhz 3.3v 328p deployment. Found it at the optiboot source repository, but it too had an issue - it is configured to load sketches at 115200Baud. This is a bit too fast for the 3.3v deployment of the ATmega328. In addition, all of these were compiled to flash the LED 3 times upon bootup - OK for an UNO which has an LED on port 13, but bad for the regulator which hard wires that to DIP-7...
So, I set out to make my own!
Though all that is needed (source, tools, etc) are included in the Arduino IDE distrubution, here has been several updates and improvements to the code vs. the one included with Arduino. So I decided to download the latest version of optiboot from google code: https://code.google.com/p/optiboot/
To use the new bootloader, look under the Arduino Libs Used tab above for a sub folder called 'SmartRegBoot'. Copy this entire folder to your local Arduino working directory in the hardware sub directory. (C:\Users\Win7\Documents\Arduino\hardware on my machine) After restarting the Arduino IDE a new board will appear called "Smart Regulator (fixed Optiboot - 3.3V, 8 MHz) w/ ATmega328p". Select this one if you ever need to flash in the bootloader; you will also need to select it when compiling a revised sketch to download to the regulator.
Now it is Burn-Baby Burn!
Once all the above is done, it is a simple matter of flashing in the bootloader! For this I used a USBasp tool purchased off of Ebay. It has the advantage over using the Arduino in that it can be jumped to run at 3.3v, which is needed for the regulator. Move the jumper to 3.3v; also jumper JP3 to enable a slower transfer mode, this seemed to help with the 3.3v burning. Then hook it up and Flash away!
|Burning the Bootloader, but wait! This might not work!|
Oh wait, this will not work. Or perhaps I should say it will not always work. Of the 9 boards I burned, 4 of them ended up 'bricked'. This is a situation where the ATmega CPU has sets its internal 'fuses' to a state that will not allow the ICSP port to work, and hence we can now longer communicate / flash a bootloader. . . .
The MOST common error it seems it to select no crystal, instead expecting a nice solid clock signal coming in. LOTS of talk in the net how to use a temporary external clock to overcome this. In my case one of the 4 bricked CPUs was solved this way, but the other three were 'done up good'. Not only was the crystal disabled, but external reset as well . . . and reset is a critical signal for the ICSP to work.
How did this happen? My take is power: The small USBasp has a 3.3v converter that likely works fine for just a CPU, but the Arduino Alternator Regulator has other components on it that use more power. When I attempted to burn the boot-loader (which as its 1st step configures the 'fuses'), the low voltage caused the whole writing to go very very wrong, leaving the CPU in an unusable state. How to prevent this? Add more power! For reliable burning I simply connected up the Service port in addition to the ICSP; with the combination of two small voltage sources all worked out well. Of course, one could also connect 12v or above to the Enable port and let the on board 3.3v regulator power things, THAT would have made sure we had tons of power..
|Need MORE POWER! This reliably burned the 3.3v bootloader...|
Now one might be thinking: Yada, yada, yada. Ok, got a nice 3.3v / 8Mhz Optiboot, get the Need-Power thing. Glad you recover one board. But what about the other three that were really bricked? Well, for that we need even more power, or more correctly, a bigger hammer! See the next post.
One other note: the USBasp I purchased from Ebay needed its firmware updated. Here is the tutorial I followed to do this: http://www.rogerclark.net/updating-firmware-on-usbasp-bought-from-ebay/