To get a HEX-code in your Attiny85 it is possible to use the Arduino as a programmer, but as you cannot load hexcode  in your IDE, it involves using avrdude.

First of all, we need to get the Attiny85 clocked to 8Mhz.

Open up your Arduino software and upload the Arduino ISP sketch to your board.

Disconnect the board from  your computer and attach the Attiny as shown  here. Also make sure you download and install the Attiny core files as described in that article

Connect your Arduino board in again and choose these settings.

Tools – Board – Attiny85 @ 8Mhz (internal oscillator; BOD disabled)
Tools – Programmer – Arduino as ISP
Tools – Serial Port – COMx (x being the com port that your arduino is connected to)

Then select

Tools – Burn Bootloader.

Just to clarify, you are not burning a bootloader here. You are resetting the fuses in the Attiny to clock it at 8Mhz.

Next, get the firmware into the chip. With that I mean the hex file you want in your chip

We do that by using the arduino as a programmer.  You should still still have the ArduinoISP sketch loaded on your Arduino.

Make sure your Attiny is still attached to your Arduino as described here and open a command prompt.  (In your windows start menu type cmd or chose the terminal in Linux/Ubuntu).

Type:

avrdude

This will bring up a list of options explaining what everything does.
Screenshot from 2013-12-11 14:09:55

Only need a few of those commands.

This is what to type in cmd (on 1 line)

avrdude -c avrisp -p t85 -P comX -b 9600 –U flash:w:example_attiny85.hex:i

What does all that mean?

Avrdude… This calls the program-c avrisp…  This tells avrdude which programmer you are using.  The Arduino shows up as avrisp

-p t85… This is the avrdude code for Attiny85.

-P comX… This is the com port your programmer is attached to.  (Change the X to suit your programmer.)

-b 9600… This is the baud rate (Use what is specified in the sketch loaded onto your Arduino.) .

-U flash:w:example_attiny85.hex:i   This tells avrdude you want to write (w) the firmware (example_attiny85.hex) to flash memory (flash).  The ‘i’ is at the end to tell avrdude what format it is writing in.

Avrdude should now read your chip, write to your chip, then read your chip.

If all goes well, you should get:    avrdude done.

 

Source: Programming Hex-code on an Attiny85 with the Arduino

Leave a Reply