Go Down

Topic: ATtiny85 Pin usage (Read 21 times) previous topic - next topic

Panici

Jan 17, 2012, 07:09 pm Last Edit: Jan 18, 2012, 12:12 am by Panici Reason: 1
Hey guys,

I'm working with the v1.0 "damellis-attiny-6bff522.zip" library from HLT
http://hlt.media.mit.edu/?p=1695

Am I able to use Pins 2,3,5,6,7 on the ATtiny85 as inputs OR outputs? (Like you can with the Arduino)




I've done a little burning with avrdude manually, and I know when you set the fuse to disable the RESET pin, you can't reburn the chip without a HVP.
That said, you gain the use of the reset pin for IO.

Is this supported with the attiny45_attiny85.zip library from HLT?
Is it supported with any arduino+ATtiny library?
Electrical Engineering Student

Coding Badly

Hey,

Am I able to use Pins 2,3,5,6,7 on the ATtiny85 as inputs OR outputs? (Like you can with the Arduino)


Yes.

Quote
I've done a little burning with avrdude manually, and I know when you set the fuse to disable the RESET pin, you can't reburn the chip without a HVP.


Correct.

Quote
That said, you gain the use of the reset pin for IO.


Yes.  I believe there are some restrictions.  You need to carefully dig through the datasheet.

Quote
Is this supported with the attiny45_attiny85.zip library from HLT?


I believe so ... let's check ... this is from pins_arduino.c ...

[font=Courier New]// ATMEL ATTINY45 / ARDUINO
//
//                  +-\/-+
// Ain0 (D 5) PB5  1|    |8  Vcc
// Ain3 (D 3) PB3  2|    |7  PB2 (D 2)  Ain1
// Ain2 (D 4) PB4  3|    |6  PB1 (D 1) pwm1
//            GND  4|    |5  PB0 (D 0) pwm0
//                  +----+
[/font]

Quote
Is it supported with any arduino+ATtiny library?


http://code.google.com/p/arduino-tiny/

Panici


Quote
That said, you gain the use of the reset pin for IO.

Yes.  I believe there are some restrictions.  You need to carefully dig through the datasheet.

Gotcha. I'll see what I can find in the datasheet.


Quote
Is this supported with the attiny45_attiny85.zip library from HLT?


I believe so ... let's check ... this is from pins_arduino.c ...

[font=Courier New]// ATMEL ATTINY45 / ARDUINO
//
//                  +-\/-+
// Ain0 (D 5) PB5  1|    |8  Vcc
// Ain3 (D 3) PB3  2|    |7  PB2 (D 2)  Ain1
// Ain2 (D 4) PB4  3|    |6  PB1 (D 1) pwm1
//            GND  4|    |5  PB0 (D 0) pwm0
//                  +----+
[/font]

Funny thing, I checked that file and even looked at the diagram. Looks like D5 would be the RESET pin.

Only one way to find out I guess!

I've got these plans to build a HVSP fuse resetter, so i'll still be able to recover the chip.
http://www.simpleavr.com/avr/hvsp-fuse-resetter
I ordered the parts to build it with my last Digikey order. I'll probably hold off until I run out of ATtiny85s to work with though.
Electrical Engineering Student

Coding Badly


Please let us know what happens.

Rick100

I have been playing with the the Attiny85's with the arduino as ISP  and managed to brick one . I used the simple Arduino based circuit at the following page to restore the fuse settings . It only requires 6 resistors , an NPN transistor , and a 12 volt supply . I used a 2n2222 transistor and a 12 volt battery . I built it on the same breadboard as the Arduino as  ISP circuit .
http://www.rickety.us/2010/03/arduino-avr-high-voltage-serial-programmer/

Panici

#5
Jan 18, 2012, 12:11 am Last Edit: Jan 18, 2012, 12:14 am by Panici Reason: 1
I've just realized, I miswrote the version number in my first post. I'm using Arduino v1.0 and "damellis-attiny-6bff522.zip" from here: http://hlt.media.mit.edu/?p=1695



I have been playing with the the Attiny85's with the arduino as ISP  and managed to brick one
http://www.rickety.us/2010/03/arduino-avr-high-voltage-serial-programmer/

Thanks for the link! I'll definitely need to build either that or the other Fuse Resetter I posted above.


Please let us know what happens.


So, I did some testing.

You can indeed write and compile code to use D5.
The problem is, the Arduino IDE appears to set the fuses for the ATtiny85 when you hit "Burn Bootloader".
Unfortunately, that erases any existing code on the Arduino and you're left with a blank and unwriteable ATtiny85. Doh!

My solution was to use AVRdude from the command line.
I looked up the fuse values from the boards.txt file
Code: [Select]

attiny45-8.name=ATtiny45 (internal 8 MHz clock)
attiny45-8.bootloader.low_fuses=0xe2
attiny45-8.bootloader.high_fuses=0xdf
attiny45-8.bootloader.extended_fuses=0xff


After messing with http://www.engbedded.com/fusecalc for a bit, I found the correct high fuse value to disable the reset pin.
Code: [Select]
High fuse value to disable reset pin: 0x5F

I then compiled/verified my sketch, and grabbed the hex file from the Arduino IDE:
http://smileymicros.com/blog/2011/02/10/where-is-the-arduino-hex-file/

I created a BAT file to run AVRdude:
Code: [Select]
avrdude -P COM4 -b 19200 -c avrisp -p attiny85 -v -e -U lfuse:w:0xE2:m -U hfuse:w:0x5F:m -U efuse:w:0xFF:m  -U flash:w:tm1640.hex

(Using ArduinoISP **from v0023** on my UNO) I ran the bat file, and voila!


The RESET pin now functions as I programmed it to in the Arduino IDE!
Attempts to reprogram or reburn a bootloader failed, confirming the RESET pin is indeed disabled. :D
Electrical Engineering Student

spradlinb

Hi Panici!

I'm hoping you're still around to answer a quick question. I'm about ready to do the same thing with an ATtiny85. It's going to be in an embedded toy, so I know I won't want to reprogram it again. I have a few extra ATtiny85 chips that I'll keep playing with that I won't disable the reset pin on. However, I'm really new at all of this, and have never used the avrdude command line before. The part of your post I don't understand is how you ran the BAT file through the Arduino as ISP. I've downgraded to v0022 (version 1.0 would never work for me to program the ATtiny, but 0022 works fine), and I have my final code on the ATtiny running the way I want it, just missing the pin number 5, which is the reset. So how do I run the avrdude command line you discovered and have it set my chip properly? I can't see a way to open a BAT file in the Arduino code interface. Any help would be awesome, as this is the last step I have to work out in my project.

Thanks!

Panici


Hi Panici!

I'm hoping you're still around to answer a quick question. I'm about ready to do the same thing with an ATtiny85. It's going to be in an embedded toy, so I know I won't want to reprogram it again. I have a few extra ATtiny85 chips that I'll keep playing with that I won't disable the reset pin on. However, I'm really new at all of this, and have never used the avrdude command line before. The part of your post I don't understand is how you ran the BAT file through the Arduino as ISP. I've downgraded to v0022 (version 1.0 would never work for me to program the ATtiny, but 0022 works fine), and I have my final code on the ATtiny running the way I want it, just missing the pin number 5, which is the reset. So how do I run the avrdude command line you discovered and have it set my chip properly? I can't see a way to open a BAT file in the Arduino code interface. Any help would be awesome, as this is the last step I have to work out in my project.

Thanks!


The BAT file is basically a command that would be typed into a Windows Command (Terminal/MS-DOS) window. It's just put in a file so you don't have to retype it every time.

Install AVRdude for windows, and run the bat file by clicking on it.
Electrical Engineering Student

funkyguy4000

I just want to make sure everybody knows this but the picture at the top is of the ATtiny 45, not the ATtiny 85.  Just a heads up
Accelerate to 88 miles per hour.

Panici


I just want to make sure everybody knows this but the picture at the top is of the ATtiny 45, not the ATtiny 85.  Just a heads up


They have identical pinouts as far as I know.

Electrical Engineering Student

Osgeld

yes same chip, 2k 4k and 8k
http://arduino.cc/forum/index.php?action=unread;boards=2,3,4,5,67,6,7,8,9,10,11,66,12,13,15,14,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,86,87,89,1;ALL

funkyguy4000

Pinouts are very similar, its sjust the 85 has 6? PWM ouputs where as the 45 has 3
Accelerate to 88 miles per hour.

Coding Badly


With the exception of some errata, the only difference between the processors is the amount of memory.  They all have four pins that are capable of generating a PWM signal.  One output is only inverted making it not generally useful in the Arduino world.

spradlinb


The BAT file is basically a command that would be typed into a Windows Command (Terminal/MS-DOS) window. It's just put in a file so you don't have to retype it every time.

Install AVRdude for windows, and run the bat file by clicking on it.


Awesome, thanks! I figured the command-line should work, but I wasn't certain if it needed to run through the Arduino software instead. Much appreciated!

mrburnette

I am using the Arduino 1.0 platform with my UNO as an ISPAVR based upon Ladyada's code.  I have one of her ZIF prototype boards configured as a 28 pin burner and I have modified it to support the ATtiny85.


I am using the MIT boards and variants:
http://hlt.media.mit.edu/?p=1695

So far, everything seems to work OK with the standard set of libraries ... of course, they are bloated somewhat, but I will eventually try some of the 'tiny specific' releases.

- Ray

Go Up