Page 1 of 1
Protecting VIA pins
Posted: Fri Jun 27, 2025 2:16 pm
by cbmeeks
Sorry if this is a newbie question. Let's say I have a VIA port attached to I/O pins of a micro-controller like ATMega128P such as an Arduino.
The VIA would have port A set as inputs and the Arduino would be outputs.
Now, what would happen if I accidentally set the VIA port A as outputs too and the Arduino started to output 5V?
Seems like that could cause some damage. I suppose putting something like the '245 in between would help with that. Then tie the output in one direction.
What are your suggestions?
Thanks!
Re: Protecting VIA pins
Posted: Fri Jun 27, 2025 2:52 pm
by BillO
I'd just use resistors. Maybe 1K. You can get 8 in a single DIP package or use discrete resistors.
Re: Protecting VIA pins
Posted: Fri Jun 27, 2025 3:34 pm
by barnacle
As Bill says - current limiting resistors. Calculated for the worst case of the total current through the substrate on each part - choose the smaller! - if all pins are being driven, and without exceeding the current limit on any pin.
The bad time is when one is driving low and one is driving high, but don't forget what other pins may be driving.
1k will limit to 5mA each pin; I'd prefer a bigger resistor. If you're going only between logical inputs and outputs, half a milliamp is plenty into CMOS inputs. And I discovered yesterday that resistor packs are around 80c each, but resistors are half a cent...
Neil
Re: Protecting VIA pins
Posted: Fri Jun 27, 2025 4:53 pm
by GARTHWILSON
1k will limit to 5mA each pin; I'd prefer a bigger resistor. If you're going only between logical inputs and outputs, half a milliamp is plenty into CMOS inputs.
The W65C22S can handle several times that much current. If it's only for a short time, like 100ms or less, not to mention a few instructions' time, 50mA (the internal current limit of the pin) won't hurt it, according to my experiments. That would mean 100Ω (or actually less, since the current-limiting action inside the VIA will mean the resistor won't have 5V across it anymore). Regardless, I would put a 22pF or 47pF capacitor across the resistor if you need to preserve any fast response. If there were a threat of damage, you'd still have to be careful not to have the '245 that's between the VIA and the microcontroller set to output into the VIA's outputs; so that's probably not a solution.
Re: Protecting VIA pins
Posted: Fri Jun 27, 2025 5:24 pm
by drogon
In the early days of the Raspberry Pi we did all sorts of things - like design a completely new IO board (e.g. The Gertboard) to "protect" the Pi, use Zener diodes for over voltage, resistors to protect the 2 outputs scenario and so on.
After a (short) while this became boring and just got in the way and added cost and complexity to something that's otherwise disposable.
I'm not suggesting that vintage parts are disposable, but modern ones that you can still buy for a few pounds? Go for it.
-Gordon
Re: Protecting VIA pins
Posted: Fri Jun 27, 2025 5:52 pm
by BigDumbDinosaur
The VIA would have port A set as inputs and the Arduino would be outputs. Now, what would happen if I accidentally set the VIA port A as outputs too and the Arduino started to output 5V?
Big-time contention, for sure, if using the W65C22S. Like the others suggested, some series resistance should avoid disaster. Alternatively, you could use the W65C22N, which has built-in current limiting resistors on its outputs. That would protect the C22, but no telling what might happen to the Arduino.
Incidentally, the latest data sheet for the W65C22 shows an FMAX vs VDD curve that is the same as that of the 65C02, implying that the C22 could be easily overclocked.