Getting Started ← | ↑ ScratchMonkey | → High Voltage Programming |
ISP is the simplest programming method to set up, and in 99% of all cases, it's all you need.
The exact pins to connect depend on the board you're using as a programmer. The illustration on the right shows connections for an Arduino Uno, see the Connection Diagrams chapter for other boards.
ISP requires 6 signals (including power and ground), as shown in this illustration. Do NOT use the ICSP headers, as the one at the right has the RESET pin connected to your own Arduino's RESET signal, and the one at the top left is connected to the signals for the Atmega16U2 USB slave processor.
The XTAL signal can optionally be connected to your target's XTAL1 pin, as discussed below.
(RDY), (PGM), (VFY), and (ERR) can optionally be connected to LEDs (with a suitable resistor, e.g. 330Ω) to show the status of a programming job. This will only work with a patched version of avrdude
The (DEBUG) pin is available for debug logging, as discussed in the Troubleshooting chapter.
The pin connections for an Arduino Micro are shown in this illustration, and for the Leonardo, the same pins would be used. Note that:
The ISP 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.
Since ScratchMonkey is largely pin compatible with the ArduinoISP sketch, the circuits shown at http://arduino.cc/en/Tutorial/ArduinoISP for Arduino boards all should work with ScratchMonkey as well. You can disregard the circuit showing an external crystal — it should work as well, but is not needed, as ScratchMonkey generates its own clock signal.
While all AVR MCUs are capable of running from internally generated clock signals, in many designs, they are instead set up to rely on an external clock signal — either for better timing accuracy, or because a particular operating frequency is desirable. If you try to program a MCU on a breadboard and its fuses have been (deliberately or accidentally) set to require an external clock signal, ISP will not work on that MCU without supplying a clock signal.
For this purpose, ScratchMonkey uses Arduino timer 1 to generate a clock signal XTAL. If you get an upload error, try connecting this signal to the XTAL1 pin of your MCU. Curiously, and somewhat inexplicably to me, I have found that when Low Frequency Crystal Oscillator mode (CKSEL[3:0] = 6) is selected, connecting the clock signal to XTAL1 did not work, but connecting to XTAL2 did work, so you may want to try this as well.
ScratchMonkey will normally operate its SPI connection at a 125kHz clock rate. With some clock settings (e.g. Internal 128kHz Oscillator) of the target microcontroller, or external clock signals wired to the board, this rate is too fast for the target microcontroller to keep up. For this case, ScratchMonkey will fall back to a software simulation of SPI, using the same pins, but operating deliberately at slower speeds (Down to less than 1kHz, if necessary)
With the combination of Limp Mode and the external clock signal, ScratchMonkey in ISP mode should be able to handle pretty much any setting of the clock fuses. Still, there are other fuses, e.g. RSTDISBL or SPIEN, that will prevent ISP mode from working when changed, so you will need to use High Voltage Programming to deal with those cases.
Getting Started ← | ↑ ScratchMonkey | → High Voltage Programming |