# Programming Arduino AVR MCU with Atmel ICE

I have a question about programming Arduino with Atmel ICE. I am aware that the Arduino UNO has a ISP connection for ISP programming. If i'm not mistaken I should be able to plug in the ICE and program the Arduino UNO when I choose the method of programming to "Atmel-ICE"?

Another reason why I ask his is because I have made a PCB but I believe I may have made a mistake around the RESET pin. I am trying to program the attiny2313A with Ardunio code but am having trouble.

I have programmed this MCU though Atmel studio and can confirm I can program the chip though ISP with Atmel studio but NOT Arduino. I have also broke out the RX and TX pins to try and program with FTDI chip but I have not but a capacitor in series with the RESET line.

If possible I would really like to program with ISP. I have got the ATting files for programing for the following link on github: ATting2313 Arduino Files (Look at ReadMe)

Any help would be great, I'm really stuck.

• What exactly happens when you attempt to program the target via ISP? Did you select the atmel ICE as the programming method when using the Arduino IDE? Sep 15, 2020 at 16:14
• @ChrisStratton I believe I have made an oversight in that it appears that the "ATTinyCore" extension files I have used to get the Attiny2313A option on the Arduino IDE, does not give the option for the Atmel ICE. Sep 16, 2020 at 21:50
• That should be a fairly trivial issue to correct in the scheme of things. Or you might just run avrdude yourself. Or you could put the ISP sketch on an Arduino. At any rate, with such a tiny amount of on-chip resources, you really want to use ISP and not a bootloader. Sep 17, 2020 at 4:06

## 1 Answer

After OP cleared the question, I think that it would be useful to clarify something about the main ways of programming an Atmel microcontroller:

So, one of the main differences between serial programming and SPI programming is: for serial programming, the μC has to have a bootloader.

Serial programming = four wires, two for data: TX and RX.  Needs a bootloader.

SPI programming = six wires, four for data:             Doesn't need a bootloader.
MISO, MOSI, Clock, Reset


There are some USB programmers (green box in the table above) that looks like a USB-to-Serial adapter (orange box in the table above), but each one works in a different way.

It seems that OP has used a programmer before (option 3 in the chart), and now OP is trying to use a serial adapter (option 2 in the chart). But this option needs a bootloader.

(edit) But, for several devices, the serial option is not adviseable, because the bootloader ocuppies a lot of memory space, and for simpler chips (this is the case with all ATTiny) there is no much space left available for the user's program.

The final answer to OP: for programming Attiny2313A with the Arduino IDE and Atmel ICE, you need to connect 6 wires from Atmel-ICE to Attiny: VCC, GND, and the four wires of SPI interface (MISO, MOSI, CLOCK, RESET). You will need to load some drivers and libraries to the Arduino IDE, in order to Arduino IDE can control Atmel-ICE for burning the code to Attiny.

For doing this, you will not need to use RX and TX pins of the microcontroller.

Don't worry about the absence of a capacitor in RESET line. It is good, but not mandatory.

• It's unclear that a serial adapter approach is really what they are seeking, they do explicitly say they want to use ISP. Anyway, a serial bootloader is probably inadvisable on such a low resources chip, even if it may be theoretically possible. Sep 15, 2020 at 16:17
• @ChrisStratton You're right, I edited the answer! I tought about writing about this when I was making the table... but when I finished the table, and started to write the answer, I forgot this part. I tought that OP was seeking for a serial programming, because OP said "broke out the RX and TX pins" and talked about a FTDI adapter. I hope that I make clear for OP that he/she probably is confusing using a programmer (option 3) with using the USB-to-serial adapter (option 2). Sep 15, 2020 at 17:20
• A capacitor in the only reset connection depicted - which is for the ISP header - would actually be wrong and quite problematic. If there were a pin on the serial connector intended to be connected to DTR or RTS, then that would need a series capacitor for typical usage to work. Sep 15, 2020 at 18:11
• I was expecting that the pundit would find a glitch about this! ;-) "A capacitor would actually be wrong" Let's see: AN2519 AVR® Microcontroller Hardware Design Considerations, page 7: To protect the Reset line from further noise, connect a capacitor from the RESET pin to ground. This is not directly required since AVR devices internally have a low-pass filter to eliminate spikes and noise that could cause reset. Using an extra capacitor is an additional protection." Sep 15, 2020 at 18:18
• if it were a capacitor to ground they meant, then yes that would be okay, but the asker as likely means the series capacitor used in a typical Arduino serial connection from DTR or RTS via a capacitor to cause the chip to reset to the bootloader when the serial port is opened, but ultimately be able to run with that signal in either state. Goes to show the question is not currently in answerable form. Sep 15, 2020 at 18:29