Loading new firmware on an AVR

Kragen Javier Sitaker, 2017-03-31 (3 minutes)

There are apparently three different ways to program AVRs:

I think I should be able to bitbang the serial programming interface from an Arduino or other AVR, but this will require talking some protocol to avrdude. This is I think the purpose of the mega-isp firmware and ArduinoISP firmware derived from it.

The ArduinoISP page shows using an external clock crystal and two 18–22 pF capacitors to get the device being programmed to be sufficiently functional to accept programming, if it isn’t configured to use its internal clock. By default the divide-by-8 fuse is set so the chip’s clock rate is only 1MHz. At least the ATtiny2313 is documented to use the internal oscillator by default.

It seems like maybe even an ATTiny45 ought to be enough to use for serial programming: it has 8 pins, of which 3 are used for Vcc, ground, and /RESET; three more are used for SCK, MISO, and MOSI, which can control the serial bus of another AVR being submitted to programming; and two more are available for some other kind of communication. Or you could bitbang the SPI protocol for programming and use the SCL and SDA pins to speak I²C to get programmed.

The ATtiny2313 SOIC unfortunately has the ground pin at the opposite extreme of the chip from the Vcc, /RESET, SCK, MISO, and MOSI pins that are needed for in-circuit programming, so you need a full 20-pin SOIC clip to program it this way. So I need 13mm of PCI bus to clip the whole thing into, with the attendant possible problems with good contact.

Arduinos have a standard six-pin ISP programming header, which I hadn’t realized.

Topics