ATTiny85 and the Reset pin

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

The project I'm working uses a ATtiny85 and during the course of development has gotten a fair amount of feature scope and I need to use all the pins.

 

I have a 10K pot on PB5 (PCINT5/RESET/ADC0/dW) and I want to use the ADC0  on that pin.

 

When I get to a certain point on the point, threshold voltage is reached and the unit resets, which is what I would expect.

 

My question; is there a way to disable the reset without fuses?  I've did a fair amount of googling and I've not found anything that helps.

 

I've tried disabling the digital input on ADC0D and enabling the ADC unit using ADEN.

 

Any help appreciated!

This topic has a solution.

Happy Trails,

Mike

JaxCoder.com

Last Edited: Sat. Apr 4, 2020 - 05:24 AM
This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

mike32217 wrote:
is there a way to disable the reset without fuses?
No.

 

If you program RSTDISBL, you'll need an HVSP-capable programmer to re-program your t85.

 

Alternately, you can cobble together a 'fuse-doctor' to reset the fuses to factory default when you need to reprogram during development.

 

 

"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: 1

Using the Reset\ pin is never a good idea, unless you have a locked down code and are manufacturing tons of units.

It just isn't worth the hassle.

 

Is there a chance to combine the functions of any other pins, so as to free up the Reset\ pin?

 

Proprietary, or can you post a schematic?

 

If you aren't building a lot of them, your blood pressure will be a lot better if you bite the bullet and use a bigger chip!

 

JC

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

DocJC wrote:

It just isn't worth the hassle.

For HVPP, I might agree.  But HVSP is easy enough to manage, even in circuit.  It only takes one more pin beyond what ISP already needs, and only circuitry connected to /RESET need be 12V tolerant.

 

I do a fair amount of work with t45/85 with RSTDISBL programmed.  Mind you, I've built a simple HVSP/prototyping rig to aid with this, so all my development can be done in-circuit on the rig and if needed with an attached breadboard.

"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

Thank you Joey and Doc

 

I was afraid that might be the case so yes I have come up with an alternate solution to the problem. 

Would have been nice to have that pin but not critical.

Happy Trails,

Mike

JaxCoder.com

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

mike32217 wrote:
I have come up with an alternate solution to the problem.
If you can live without full 10-bit range of the ADC, you can bias the pot so the voltage on ADC0 only ever ranges from 0.9xVCC to 1xVCC, then you'll guarantee that an external reset is avoided.  VRST is device and process dependent, so any given t85 might give you a wider usable range.

"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

My project consists of a base unit that is placed in the garage that detects when a beam is broken and sends a message via a 433MHz Transmitter to a variable number of satellite  units that turn on a light placed at strategic points throughout the garage.

 

I'm using the ATtiny85 for the Satellite units and they use a LDR to determine if it is dark enough to turn on light.  What I had intended on doing to set sensitivity of the unit was to press a button putting it into a settings mode and adjusting the POT and the light would respond accordingly then when I pressed the button again it would go out of settings mode and write the value to EEPROM.  What I am going to do now is just monitor the POT for change; when values differ I will go into settings mode and start a timer so that if there is no change on the POT for a definable time period I will go out of settings mode and write value to EEPROM.

Happy Trails,

Mike

JaxCoder.com

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

Write down your full pin budget.

 

There are often ways to share pins.   Think about setting a digital watch.

Anything is better than using the RST pin.

Readers may offer some tips.

 

David.

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

 

You could actually manage this with the normal reset functionality of the pin intact.  Place the button on the reset pin thus:

 

This would allow you to use the ADC to monitor the voltage on PB5/ADC0.  With the button released, R1 and the internal pullup (always enabled when RSTDISBL is not programmed) will keep the pin pulled to VCC, and the ADC should read at or close to 1023.  With the button pressed, R1, R2, and the internal pullup form a voltage divider to keep the voltage at pin at about:

VADC0 = R2 / (R2 + (1 / (1/R1 + 1/RPU)))

      = 100 / (100 + (1 / (1/10 + 1/45)))

      = 100 / (100 + 8.2)

      = 100 / 108.2

      = 0.92 x VCC

 

So that the ADC value should drop from about 1023 to about 946, notwithstanding tolerances on R1, R2, and RPU, as well as ADC accuracy.  You may need to increase the value of R2 to guarantee that the t85 won't slip into reset, but 0.9 VCC should be a good working threshold to stay above.  In any event, if you were to make your ADC detection threshold, say, 980 or so, you'd likely be fine.  Note that you'll still need to debounce the result.

 

EDIT:

 

Just for completeness, here's an accounting for 5% tolerances on the external resistors, and on the >>wide<< process variation of the internal pull-up.

 

VADC0(MIN) = R2 / (R2 + (1 / (1/R1 + 1/RPU)))

           = 95 / (95 + (1 / (1/10.5 + 1/60)))

           = 95 / (95 + 8.9)

           = 95 / 103.9

           = 0.914 x VCC

           = 935 ADC

 

VADC0(MAX) = R2 / (R2 + (1 / (1/R1 + 1/RPU)))

           = 105 / (105 + (1 / (1/9.5 + 1/30)))

           = 105 / (105 + 7.2)

           = 105 / 112.2

           = 0.936 x VCC

           = 958 ADC

 

So a threshold of 980 seems quite safe, even with resistors on the very edge of 5% tolerance.

 

"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]

 

Last Edited: Sat. Apr 4, 2020 - 04:56 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Another option would be to simply put the button on /RESET as a proper reset button.  Then in your code, monitor the sensitivity pot for changes for, say, only the first minute after reset.

"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

Thanks Joey, sounds like a sensible solution.

Happy Trails,

Mike

JaxCoder.com