Electronic – arduino – Using AVRDude to program AtTiny via Arduino-as-ISP

arduinoavravrdude

As I understand, I can use Arduino as ISP. Most instructions start with "load ArduinoISP from examples".

But then I want to load existing .hex file to the target chip. E.g.

AvrDude -> ArduinoBoard+ArduinoISP -> targetChip

And I fail miserably to find proper instructions though I believe this is possible and perhaps even already explained somewhere. I could not find instruction mainly because keywords yield instructions on many related but different topics.

I suspect that as Arduino uses avrdude I can sneak how it works when programming via ArduinoISP… At least I'm trying in this direction right now, but I would be glad if someone can help me to save the time.

UPD I've succeeded with the help of the answer below. The last thing to mention – I hate arduino's instruction for giving an image instead of specifying wiring. As I understand it is like:

  • pin 10 to reset
  • pin 11 to mosi
  • pin 12 to miso
  • pin 13 to sck

Best Answer

Assuming you already have a binary file for flashing, this page may help you. All you need to do is:

  1. Connect the Arduino with loaded ArduinoISP sketch to the target chip
  2. Run AVRDude. Make sure to specify a programmer type. Also note that ArduinoISP will work at lower serial speeds. Example:

    avrdude -p m328p -P /dev/ttyACM0 -c avrisp -b 19200 -U flash:w:release.hex