How to flash an AVR using an Arduino without using Arduino IDE

arduinoisp

I want to program an ATTiny microcontroller using an Arduino Uno board via AVRdude. According to the Arduino Uno schematic, there is a direct line from the USB controller to the ICSP1 header:

enter image description here

I connected the wires from the icsp header (also removed the ATMEGA328P chip) to my breadboard and then to the attiny chip, then ran this command:

$ ./avrdude -p t13 -c arduino -P com3

I also tried -c avrisp

However, there is no response. I'm sure the port is com3, because I can read the ATMEGA328P using com3 on avrdude.

Is there anything else I need to set to be able to program the attiny with avrdude?

Best Answer

You are correct; ICSP1 is connected to the ATmega16U2 which is serving as the USB to serial interface.

However, that ICSP1 is used to program the ATmega16U2.

AFAICT, the Arduino UNO's ATmega16U2 program does not contain any code to enable it be an ICS programmer, so the code on it will be for USB-to-serial and debugging.

You would need to reprogram the ATmega16U2 to have it act as a ICS programmer.

So you have a bit of an 'infinite loop'. You need a programmer to program the ATmega16U2, and if you had such a beast, you could program your ATtiny.

I believe it is possible to program an ATmega16U2 to be an ICS programmer (some less powerful ATtiny's do that). I am not aware of such a piece of sofwtare, but that doesn't stop it being found by a determined web search.

I searched for "programming attiny arduino uno".

Most links offered a solution, e.g.
http://www.instructables.com/id/How-to-program-attiny-using-arduino-uno/ http://www.instructables.com/id/Program-an-ATtiny-with-Arduino/

They use the Arduino IDE's "File -> Examples -> ArduinoISP" sketch, and wire up as shown by Connor Wolf.