There are actually 3 ways to 'program' the ATmega CPU, in order of both simplicity and effort.:
- Self Programming of Flash, this is the way the Arduino IDE / Boot-loader loads new sketches into the CPU.
- Use SPI communications protocol, the most common way to flash in a boot-loader via the ICSP port.
- Use High-Voltage Parallel Programming (HVPP)
To get a bootloader into the CPU the most common way is by using the SPI protocol, side note: One can ALSO download sketches this way as well - bypassing the boot-loader if need be. However, the SPI has a couple of dependency itself: two fuses being set correctly:
- Enable External reset pin
- Enable SPI protocol
As you can see both of these ways to program the Atmel ATmega CPU involve some precondition. But there is one way to make the CPU listen to you no mater what its configuration is: High Voltage Parallel Programming. Perhaps one has noted that Vmax for pins is listed as Vcc+0.6v, with Vcc being max 6v. But there is one exception: the reset pin has a Vmax of 13v, and here is why: Apply greater then 11.5v to reset and the ATmega CPU enters parallel programming mode. In this mode one can change any or all of the CPU, totaly independent of any fuses or boot-loaders, etc. it is in effect the 5-lb sledge that says 'Hey, You - Ya, You - Pay attention to me NOW!'
Here is a great overview of this mode, along with some code and a nice shield to be able to 'rescue' some CPUs that have gone astray: http://mightyohm.com/blog/products/hv-rescue-shield-2-x/
In the case of the Arduino Alternator Regulator the CPUs were soldered in so I tacked on wires to the bottom of the PCB, removed some of the voltage protection devices (ala, the Reset line clamping diodes, and the 3.3v protection diode as all parallel programming must be done at 5v). I used an external breadboard to make up two FET switches, one for +12v, and one to switch 5v (as opposed to just using a direct Uno pin). There are many components on the Regulator board, too many to supply +5v directly from a Uno pin as the HVRescue design does. So, I used that pin to control an external FET switch.
After all that, here is what you get:
|Mass of color-coded wires tacked onto the bottom.|
|Hooked up to an existing Uno running the HVRescue code.|
|Closeup of final protoboard with 2 FET switches (12v and 5v)|
Run the HVRescue sketch in my Uno, and quick as a wink I have a CPU that will talk to me again. Just need a bit of 'persuasion'...
OK so this shows there is a lot that can be done in the Atmel / Arduino community, perhaps one of the reasons for it popularity. And I was glad to get things back on track w/o having to replace the CPU itself. (Which is another option, at around $2 many folks do that it seems). My lesson here: Make sure to cover the power supply (current) needs when flashing in a boot-loader and one will not have any of these issues to begin with (See prior post).