There are many programmers, but because I know I’ll also will need to debug stuff on my MCU’s, I decided to buy the more advanced JTAGICE mkII.
ISP using SPI
The JTAGICE mkII comes with the squid cable, a female JTAG connector with 10 loose wires. It allows you to separate the 6 wires needed to connect the ISP (In System Programmer) to the MCU’s SPI. The following table shows which 6 of the 10 JTAG wires are matched to the wires from the squid cable:
|JTAG pin no.||JTAG pin desc.||MCU pin desc.||Squid Cable Color|
When setting this up on a breadboard, I use 6 pins of a break-away 0.1” strip male header. This allows me to cleanly connect the 6 required wires. If I want to add this to a PCB, I can of course use a 10 (5x2) pin female connector into which the JTAG connector can be plugged in.
Two wires can already be connected to their final destination: VTref and GND can go respectively to the 5V (regulated) power supply and GND to ground. The four remaining wires will need to be connected to the MCU that is going to be programmed or debugged.
- Connecting to a target board with the AVR JTAGICE mkII
- JTAGICE mkII Hardware Description
- Connecting to an SPI target
You live you learn … For some reason I initially thought that the JTAG protocol was only for debugging, so I used ISP using SPI as describeb above to program and JTAG for debugging, requiring me to switch back and forth between ISP and JTAG. I wondered if I couldn’t program using JTAG. Short story: of course, it simply works :-)
The setup isn’t that different from the ISP setup:
The programming process using avrdude remains identical, apart from the the -c switch that now simple is set to jtag2.