Using ATtiny85 reset pin as GPIO

Go To Last Post
16 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm trying to test using the ATtiny85 Reset pin as an output, and I've done the following:

* Uploaded a program using an ISP to make PB5 an output, and then pulse it at 1Hz.

* Programmed the fuses using a High Voltage Programmer:

low_fuses=0x62
high_fuses=0x5f
extended_fuses=0xff

* Connected a LED and 220 ohm resistor between pin 1 and Gnd.

However, it doesn't work. A voltmeter on the Reset pin shows no fluctuation.

I'd be really grateful for suggestions about what I might be doing wrong.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Did you make PB5 an output?

Have you confirmed that RSTDISBL is programmed? Hint: If you can still do ISP, it isn't.

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"Wisdom is always wont to arrive late, and to be a little approximate on first possession."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm pretty sure RSTDISBL is programmed because when I try ISP I get:

avrdude: initialization failed, rc=-1

Also, putting the ATtiny85 back in the High Voltage Programmer confirms that the high fuse reads 0x5f.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It looks as if you have the correct fuses.

So your software is probably wrong.

Quite honestly, using RSTDISBL in a development environment is a pain.

Develop on a 'bigger' Tiny.
Re-compile and test for the tiny85.
Sell one million finished products.

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks - good advice, but I hate being stumped.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

However, it doesn't work. A voltmeter on the Reset pin shows no fluctuation.


What do you see with your voltmeter if you disconnect the load?

Quote:
6. The RESETpin must tolerate high voltages when entering and operating in programming modes and, as a consequence, has a weak drive strength as compared to regular I/O pins. See Figure 22-23, Figure 22-24, Figure 22-25, and Figure 22-26
(starting on page 189).

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Use a low current LED (~2mA) and it may light it up.
or add an bipolar or FET driver to your led on that leg.

JC

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

Use a low current LED (~2mA) and it may light it up.
or add an bipolar or FET driver to your led on that leg.


And/or, switch around pin assignments to use that pin on a no-load/low-load signal (like an input).

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

OK, I'll check that - thanks.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Here's my code:

int led = 5;    // Reset

void setup() {
DDRB = 1<<led;
}

void loop() {
PINB = 1<<led;
delay(1000);
}

When running it pin 1 measures a constant 0.22V with no load.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well, think about it.

If your delay() comes from the Arduino core, then it really will 'delay' for 1000ms. OTOH, if it is a meaningless loop, it will be optimised to nothing.

So your loop() will probably go wiggling PB5 at about 1MHz. Your DMM probably registers about 0V. An LED would be half-brightness.

As suggested earlier, don't put a heavy load like an LED on PB5. Or preferably, don't use RSTDISBL at all.

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Does a DMM really show 0V for a toggled pin? Intuitively I would have expected Vcc/2.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Changing to pin PB3 with the same code works fine, and toggles that pin at 1Hz.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

In which case, your delay() works fine. I would expect 0.5Hz rather than 1Hz.

Although the PB5 driver might be 'weak', it should manage just fine with a light load. The data sheet might even tell you the max current.

Quote:
6. The RESET pin must tolerate high voltages when entering and operating in programming modes and, as a consequence,
has a weak drive strength as compared to regular I/O pins. See Figure 22-23, Figure 22-24, Figure 22-25, and Figure 22-26
(starting on page 188).

Especially look at:

Quote:
Figure 22-24. Reset Pin Output Voltage vs. Sink Current (VCC = 5V)

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi johnsondavies, did you solved the problem? I am with same issue here and Im stucked =/.

 

Thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Note the date of his post, and lack of any recent activity ...

 

 I am with same issue here

Here: https://www.avrfreaks.net/forum/using-attiny85-reset-pin-pcint

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...