Some time ago I purchased an Atmel-ICE Basic for $50 (a very good price, I think). I'm a retired programmer and I'm very familiar with Visual Studio (C, C++ and C#), so I felt comfortable moving off the Arduino IDE to AVR Studio to gain the debugging capability. The Atmel-ICE has been sitting on the shelf for several months.
Recently I tried to use Atmel-ICE on an some cheap Arduino Nano Clones (using the debug-wire interface) with no success. Come to find out, the debug line on the Nano clones is all crapped up with a capacitor and a 1K pull-up on the reset line, which is an absolute no-no for the reset signal when using Atmel-ICE. I found a post where I could pull off the cap and 1K pull-up (should be a weaker 10K pull-up) and that would let the Nano clone work with Atmel-ICE. The only problem with that is that the parts to remove are very small surface mount parts that would be hard (for me) to remove cleanly. I just wanted something that would work out-of-the-box.
I rummaged around the parts bins I have and I found a couple of Leonardo boards. I checked the schematic on these, and I found that because the Leonardo 32U4 CPU automatically adds USB support internally, there was no cap on the reset line and that the pull-up is 10K, like it should be, and it had a beautiful ICSP connector that would fit the Atmel-ICE cable.
All went smoothly until I tried to do a debug. Got a message that Debug is not supported from the ICSP connector (or on the 32U4 chip). Only JTAG is supported for debugging. On one hand, I did not expect that the 32U4 would have the more sophisticated JTAG but I'm kind of excited that it does support it--seems better that the debug-wire kludge.
But then I found that the JTAG is supported using four of the analog pins of the 32U4. Also I need to use an obscure (but cheap) interface part from Adafruit to morph the SWD connector with 0.05 pitch pins onto a breakout board that will allow connection to the analog lines and the reset pin of the 32U4 chip. Now my question comes about because of the use of the analog pins by JTAG.
Does use of JTAG on the 32U4 (Leonardo) usurp the use of the A0-A3 pins for analog (or digital) use?
Also, when programming the 32U4 from Atmel-ICE, writes over the bootloader on the Leonardo. Is it possible to use the Atmel-ICE to write the bootloader to the Leonardo to restore its functionality on the Arduino IDE? It seems like the Atmel-ICE allows a programming from file capability, but it looks for a file with a different extension that the boot loader, which I think is a HEX file? I think the Atmel-ICE is always looking for an ELF file.