Skip to main content

ATtiny Who?

ATtiny85-20  DIP-8
Fits nicely on a breadboard.

I followed this guide to get it working with the Arduino IDE: http://highlowtech.org/?p=1695

I downloaded the 64bit Linux 1.6.5-r5 version of the IDE, extracted it to a folder in my home directory. This newer version has the extra board support!  I also put the ATtiny ide files in the sketchbook folder under "hardware".  See the guide above.

 When uploading, it tries to use its built-in avrdude (failing and complaining), but since I have the latest and greatest (6.1) in my /usr/bin, I (moved and) replaced it with a simlink to my system avrdude.  Then I loaded up Blink to test on "Pin 0", and wala, we have a blinking tardis:

A TARDIS working.  It's totally bigger on the inside.

I can use the power from my USBmicroISP (power jumper installed) to give it 5V.  Very nice.

Sometimes the programming wouldn't initiate.  I found that I had to close the IDE, unplug the USBmicroISP, then replug it in, and restart IDE.  Then I had no problem changing the fuse settings ("burning the bootloader") to increase the internal clock to 8MHz, and reprogramming Blink.  So far so good!

ATtiny85 Arduino IDE pinouts reference

ATtiny datasheet pinout

Hex Madness

A friend had asked me about using the hex file from the IDE to upload with avrdude.  I wasn't totally sure, given the bootloader needs.  Well, it works great!  Here's what I did:

  1. Make sure your programmer can see your ATtiny.
    $ avrdude -c usbtiny -p t85

    avrdude: AVR device initialized and ready to accept instructions

    Reading | ################################################## | 100% 0.01s

    avrdude: Device signature = 0x1e930b

    avrdude: safemode: Fuses OK (E:FF, H:DF, L:E2)

    avrdude done.  Thank you.
  2. Make sure the fuse bits are set correctly.  If not, use the IDE to "burn the bootloader". Usually you only have to do this to change the clock to 8MHz.
  3. Verify a sketch you want to upload in the IDE, which does the build and outputs a hex file (among other things).
  4. Find the hex file in the build directory.  On my Linux machine it is in "/tmp/build<lots-of-random-#'s>.tmp"  It is usually called <Project-name>.cpp.hex.  On Windows it is under "Documents and Settings\<user>\Local Settings\Temp" or something similar.
  5. Fire up the command line again.
    $ avrdude -c usbtiny -p t85 -U flash:w:/tmp/build6237348845015981915.tmp/Breathe.cpp.hex:i
    -c is the programmer
    -p is the part, attiny85
    -U is memory operation (flash : write : <hex-file-location> : intel hex file format)
Now we are free to update the firmware with just avrdude and the hex file!

~JWilly

Comments

Popular posts from this blog

Atmega328PB Dev on Linux x64

The Atmega328PB is the greatest thing to come to the Arduino platform since the UNO.  Who wouldn't want more 16-bit PWMs and double all 3 serial protocols? The new unofficial Arduino Mini PB Pro! To get the IDE to support it, follow this guide: https://github.com/watterott/ATmega328PB-Testing Since the JSON file is incomplete for Linux, do the manual toolchain replacement.  This was a little tricky, and there isn't much on the internet on where the toolchain resides inside the Arduino base folder.  Here's what I did to make it work. I downloaded the latest Arduino build, and I will refer to the extracted base directory as "arduino-1.6.9".  Also download the "hardware.zip" and the "Arduino Toolchain (4.9.2)" Linux x64 version from the github links. 1. Replace the toolchain The builtin toolchain resides in "arduino-1.6.9/hardware/tools/avr/".  Rename the avr folder to "avr.old".  Extract the "Arduino Toolc

PB Pro Mini

No, it isn't Lead, nor is it Peanut Butter.  It is the 'B' version of the prolific ATmega328P microcontroller which started all this maker craziness off! Top view of PB Pro Mini Description This is a minimal microcontroller board with only a voltage reg, crystal, I2C pull-ups, LEDs and the chip itself.  The goal here is to reduce costs while hosting the beefy 328PB! This is based on, and pin compatible with, the Arduino Pro Mini 5v/16MHz from  Sparkfun . Notable, not-so-minor improvements for the 'B' version: 2 UARTs 2 I2Cs (TWI) 2 SPI Qtouch 5 Timers (with OC, IC, and PWM) Everything else is about the same.  You should be aware the clock driver on the chip is a low-power version, but this board and crystal operate at 16MHz just fine at 5V.  The Arduino library I've been using for the PB has been working without a problem! Getting Started You'll need a FTDI Friend  or FTDI Cable  to program this as there is no secondary USB

Update to USBmicroISP: 6pin and 10pin headers

Actually using my USBmicroISP with microcontrollers other than Arduino Uno's led me to fix a udev rule issue with my Gentoo Linux laptop.  I was getting Permission Denied when I was trying to use avrdude as a normal user.  Yes, my user is part of the 'uucp' group... Background Some background on the Arduino ISP connector.  It is much different than the 10-pin AVR connector... 6-pin ICSP cable pinout.  NOTE: Numbers refer to ATtiny45/85 pins, not ICSP! Arduino ISP pinout. Notice the vertical line next to pin 1, which appears in silkscreen on the PCBs. Redboard ISP pinout.  Obviously the same as UNO.  Notice pin 1 location on upper-left, with horizontal white silk. My USBmicroISP has the cables coming off the IDC differently, but the key is in the correct orientation to the pinout in the top picture! (Please disregard numbering on first picture for ICSP purposes)  Usually the key and wires are facing inward (left side on 2nd and 3rd picture) on an Arduino