High Voltage Serial Programming ← |
↑ ScratchMonkey High Voltage Programming |
→ Troubleshooting |
HVPP is the high voltage protocol for ATtiny and ATmega MCUs with 20 pins or more.
HVPP requires 19 signals (including power and ground), as shown in this illustration. For High Voltage programming, the timing of the power pin matters, so it is software controlled through the SVCC pin, rather than simply through the 5V pin of the Arduino. The HVRESET signal is used to control one of the circuits shown in the High Voltage programming section to generate the 12V signal to be applied to RESET pin of the target microcontroller. The other signals go directly to the target microcontroller.
Since a regular Arduino has only 18 pins available (short of reusing pins 0 and 1, which I'm not confident I can do safely), we use a 74HC595 shift register to generate most output only control signals through a serial interface. The only exceptions are XTAL, which needs to be pulsed often, and VCC and HVRESET, which never change during the programming process.
The pin connections for an Arduino Micro are shown in this illustration, and for the Leonardo, the same pins would be used. The Micro/Leonardo has enough pins to generate the control signals without an auxiliary shift register.
The HVSP signals need to be connected to the corresponding signals on your target microcontroller / board. Details for each target are discussed in the Connection Diagrams chapter.
The details of HVPP control signal assignment are somewhat messy, primarily because on 20 pin MCUs, some of the control signals are multiplexed two to a single pin, and the ATtiny26/261/461/861 family does this in a somewhat different way from the ATtiny2313/4313 family of MCUs. The following table gives an mapping from CTRLn names to the names in the MCU datasheets:
Pin | ATtiny861 | ATtiny4313 | Others |
---|---|---|---|
CTRL0 | - | - | BS2 |
CTRL2 | WR | OE | OE |
CTRL3 | XA0 | WR | WR |
CTRL4 | XA1/BS2 | BS1/PAGEL | BS1 |
CTRL5 | PAGEL/BS1 | XA0 | XA0 |
CTRL6 | - | XA1/BS2 | XA1 |
CTRL7 | OE | - | PAGEL |
For 20 pin MCUs not listed here, you need to figure out whether pp_controlstack in the avrdude configuration resembles the ATtiny861 or the ATtiny4313, and connect pins accordingly. As far as I can tell, the ATtiny26/261/461/861 is unique, and all other 20 pin MCUs use the ATtiny4313 scheme.
High Voltage Serial Programming ← |
↑ ScratchMonkey High Voltage Programming |
→ Troubleshooting |