ATTiny85 PB2 internal short to GND - Page 1
Forum section: electronics / general

author: MarkM
author_rank: Regular Contributor
timestamp: June 19, 2016, 05:13:50 pm
content: I designed this really basic board that sports an ATTiny85. This schematic is of the 84, but the setup is exactly the same. It's basically a PWM controller board with an on board MOSFET that uses a pot to adjust the duty cycle up and down(as well as for other functions), switch to activate functions, runs on battery power and has an LED for an indicator. I added an on board 10k resistor (R7) so I only have two wires going to an external 10k pot(0-2.5v is OK here).I've sold around 1,000pcs with the same setup in the past 7-8 months, and most of the time everything is OK. I program and test them myself, so when they go out I know they're working correctly. I'm using PB2(INT0) for the switch using the internal pullup(using sleep mode), so the switch is active low. The issue is, once in awhile PB2 creates an internal short to GND somehow making the switch active all the time, as the internal pullup and the weird connection to GND causes a voltage divider.I've seen it as low as 300ohm with the actual pin lifted off the board to confirm that's the issue and not a PCB issue. This is very odd to me. Can anyone see anything wrong with my setup? It's pretty rare, but it happens and it's always after people add the external components(LED, POT, SWITCH). My fix so far has been to add an external 1k pullup, but it shouldn't be happening.No other pins have had any issue at all. I'm thinking I could use an external pulldown resistor to make the pin active high, but I'm thinking the problem ones will waste some power when the fire switch is depressed. Sleep mode is very important to me, or I would just use another pin.I've used a similar setup to this with different AVR MCUs and haven't had an issue like this before. Any help is greatly appreciated.

author: Monkeh
author_rank: Super Contributor
timestamp: June 19, 2016, 05:27:45 pm
content: Quote from: MarkM on June 19, 2016, 05:13:50 pmThere's your clue.ESD happens.

author: MarkM
author_rank: Regular Contributor
timestamp: June 19, 2016, 05:38:33 pm
content: Something is definitely happening there, but it's similar to an arduino board. I can't find anyone with a similar issue online like this.

author: MarkM
author_rank: Regular Contributor
timestamp: June 19, 2016, 07:25:29 pm
content: I went with an external pull down resistor, so the switch will be active high from now on, I suppose. Any other ideas?

author: wraper
author_rank: Unknown
timestamp: June 19, 2016, 07:44:29 pm
content: Either people abuse this pin or ESD. IMO at least add some series resistor to the pin. If this pin can be set as output probably people just connect the led directly without resistor or short the pin to Vdd for example Or connect it to even higher than Vdd/lower than GND voltage and destroy protection diode in the MCU by this.

author: Ian.M
author_rank: Super Contributor
timestamp: June 19, 2016, 07:48:38 pm
content: I agree with Wraper. Without additional protection, the pin will still end up blowing due to ESD. You probably need something like 1nF to ground at the off-board connector (which typically reduces the peak ESD voltage by an order of magnitude) and 1K between that and the pin to reduce the internal clamping diode current. The resistor should be physically large so it doesn't flash over (no 0805 or smaller flyshit).That's not enough for *robust* protection, but is about as good as you can do on the cheap*when using an internal pullup.* It wont reach the logic 0 threshold if you increase the resistor too much to decrease the peak clamping diode current, you cant increase the capacitor significantly without reducing the switch life, and any sort of external semiconductor clamping that doesn't dump into the Vdd rail *costs*.

author: wraper
author_rank: Unknown
timestamp: June 19, 2016, 08:04:03 pm
content: As an idea, maybe people are connecting it to something else what is mains powered. If at least one side have double insulated PSU, then discharge will happen to what get connected first. If it happens to be this pin, then it will be destroyed. This is the same as for example small spark when you connect DVD player to the TV.

author: wraper
author_rank: Unknown
timestamp: June 19, 2016, 08:10:08 pm
content: Quote from: Ian.M on June 19, 2016, 07:48:38 pmNo need for big resistors, just add say 0.2-0.3mm spark gap to GND before the resistor on PCB layout.

author: MarkM
author_rank: Regular Contributor
timestamp: June 25, 2016, 05:10:17 pm
content: Thanks for the replies.