Programming with Adafruit Trinket

I’m very excited about using the Adafruit Trinkets, which are essentially small breakout boards for the Atmel ATtiny85 microcontroller.  It is intended to be used with the Arduino IDE (and I hoped this would be easy), and I found this to work well for compiling source code into a HEX file.  However, I was never successful getting the upload to work directly with Arduino IDE.  At this point, I learned to use avrdude from the command line (I’ve been working in Windows XP up to this point, but I’m switching to Ubuntu since MS doesn’t support XP anymore).

I followed the instructions from Adafruit given here.  These are well written and got me a long way.  I only had trouble uploading with avrdude.

I found this to be a two step process:

1.  I used this command to clear the on-chip flash:  avrdude -c usbtiny -p attiny85 -U flash:w:<hexfile.hex>

This would flag tons of errors that would require a CTRL-C to stop.

Inline image 1

 

2.  Then run this similar command:  avrdude -c usbtiny -p attiny85 -D -U flash:w:<hexfile.hex>

This will actually write to the flash.  If you don’t do step 1, you will get a verification error.

Inline image 1

 

Once the chip was programmed, everything worked well.  Many of the Arduino commands work with the ATtiny85.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s