Electronic – arduino – an easy way to program an ATtiny microcontroller in C without an ISP

arduinoavrispmicrocontroller

I understand the "most raw" method to program an AVR microcontroller is probably with an ISP such as the AVRISP mkII.

However, I'm after a method that doesn't involve me having to purchase a $40 tool for a one-off project.

I have at my disposal a computer, an Arduino Uno, and a Raspberry Pi.

I'm not really interested in using the Arduino IDE and writing sketches. I want to get down into the low level code which is possible in C, preferably using an IDE such as Atmel Studio.

As I understand the Arduino Uno has an ATmega16U2 which connects to a computer via USB, which is used to program the ATmega328P.

Is the ATmega16U2 acting as a ISP here? If so, can I use it to program the ATtiny? I've gone through the schematic, and it shows the mega16u2 has an ICSP header, but it's connected to the mega328 via TX/RX lines.

Best Answer

  • Is the ATmega16U2 acting as a ISP here?

No, that chip is acting as a USB -> RS232 TTL adapter. The 328P chip has a serial bootloader installed on it which accepts commands through RS232 to program the chip.

You can install the ArduinoISP sketch on the Arduino (included with the Arduino IDE), which then turns the Arduino into an ISP that can be controlled via AvrDude (command line program) to program the ATTiny through ISP.

There are many tutorials and examples on the Arduino forums and playground.