ATtiny85 Pin usage

Hey guys,

I’m working with the v1.0 “damellis-attiny-6bff522.zip” library from HLT

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?

Hey,

Panici:
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.

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.

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.

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

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

// 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
// ±—+

Is it supported with any arduino+ATtiny library?

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

[quote author=Coding Badly link=topic=87517.msg657083#msg657083 date=1326825303]

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]
Gotcha. I’ll see what I can find in the datasheet.

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.

Please let us know what happens.

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/

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

Rick100: 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.

[quote author=Coding Badly link=topic=87517.msg657361#msg657361 date=1326838326] Please let us know what happens. [/quote]

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

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.

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:

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

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!

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!

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.

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

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

They have identical pinouts as far as I know.

yes same chip, 2k 4k and 8k

Pinouts are very similar, its sjust the 85 has 6? PWM ouputs where as the 45 has 3

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.

Panici: 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!

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:

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

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

Old thread

Hi All,

Hope this is the right place to post this. Im fairly new to the ATtiny85 but I want to make a series of wireless sensors, using NRF24L01+ transceivers and DS18B20 temperature sensors.

As you need 5 pins for the NRF24L01 and one pin for the DS18B20, I believe I will need to use PB5, and hence use HVSP to program the chip.

Based on what I have read, I think I can use http://www.rickety.us/2010/03/arduino-avr-high-voltage-serial-programmer/ to reset the chip each time I need to program it, and then write the code in the Arduino IDE, and compile it to generate the hex file to be uploaded. This is where I get confused.

Do I just need to upload it to the chip using the ArduinoISP sketch and AVRDude?(I have a uno to use as the programmer). Or do I have to flash the chip to disable the reset before uploading the hex.

Is there anyway to modify the ArduinoISP to program the chip directly using HVSP?

Thanks

Kihon

kihon: As you need 5 pins for the NRF24L01 and one pin for the DS18B20, I believe I will need to use PB5, and hence use HVSP to program the chip.

The NRF24L01 needs 5 pins all by itself (4 for SPI plus "CE"). You might be able to share a pin with the DS18B20 but it complicates things.

OTOH, disabling the RESET pin during software development is for masochists. Much better to develop on (eg.) a Tiny84 and save the Tiny85 for the final build.

Or just use Tiny84s.

Can you use the 84 like the 85? If i'm thinking properly, the 84 only has like two PWM pins.

funkyguy4000: If i'm thinking properly, the 84 only has like two PWM pins.

Four.