Electronic – arduino – Why do we need hardware programmers

arduinoavrdudeispmicrocontroller

I use a Boarduino and a 30-row bread board to program my ATtiny. I load a not too complicated sketch called ArduinoISP (included by default now in the Arduino IDE), and suddenly I have a working programmer. Atmel sells a nice programmer for between $30 and $40, and there are lots of kits for making cheaper ones.

I was very happy once I got my working programmer and made the tiny blink some leds. However, now my poor boarduino is stuck on programmer duty.

As far as I can tell this programmer holds down the reset button, and then transmits and receives on the MOSI and MISO pins. I think the SCK is unused or at least unneeded. (SCK is needed according to the ATtiny datasheet, my programmer doesn't work without it, and I can't find the place I thought I read it was not needed.)

Why do I need a hardware programmer to just transmit serial? I mean, let's suppose I am willing to hold down the reset button with my finger instead of using an IC. All that's left is serial send and receive, so all I need are three wires GND, RXD, and TXD. Heck, if I have the "DTR" line or whatever, you can even hold down the reset button with the serial cable.

Why are there all these hardware solutions that also require fancy software (like AVRdude, or AVR studio, or whatever)?

I mean I could understand a little USB cable that presented the microcontroller as a mass storage device and let you drag binary files over for programming (like this ARM dev board). Hardware only, using standard software drivers.

I could also understand a software only solution (modulo hooking wires from the USB to the chip, using something like the FTDI chip to simplify what goes down the wires). All of the fancy programming protocol would be handled by software on the computer, and the hardware would just be some wires.

Why do we have both (complicated) software and hardware involved? I mean, as far as I can tell, programming microcontrollers is pretty easy, but when I was just getting into this I was really worried about how I was going to ever buy a chip from mouser or digikey without paying some guru to program a bootloader for me.

I'm sure there is a good reason (it's not like I've written the software or started manufacturing the drag-n-drop USB programmer), but as a newcomer, I have no idea what it is.

Best Answer

You are right, programming AVRs is pretty easy. It's just a custom protocol implemented on top of SPI, running at low voltage. SCK is needed.

However, programming older PICs (and non ISP AVR programming) requires high voltages and a different custom protocol. This necessitates a special hardware programmer.

Other devices are more complex. Most ARM microcontrollers must be programmed via JTAG, here memory is being written directly and the processor is instructed to write to the flash. Again, every device is different.