Protecting VIA pins

Let's talk about anything related to the 6502 microprocessor.
Post Reply
User avatar
cbmeeks
Posts: 1254
Joined: 17 Aug 2005
Location: Soddy-Daisy, TN USA
Contact:

Protecting VIA pins

Post 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!
Cat; the other white meat.
User avatar
BillO
Posts: 1038
Joined: 12 Dec 2008
Location: Canada

Re: Protecting VIA pins

Post by BillO »

I'd just use resistors. Maybe 1K. You can get 8 in a single DIP package or use discrete resistors.
Bill
barnacle
Posts: 1831
Joined: 19 Jan 2004
Location: Potsdam, DE
Contact:

Re: Protecting VIA pins

Post 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
User avatar
GARTHWILSON
Forum Moderator
Posts: 8773
Joined: 30 Aug 2002
Location: Southern California
Contact:

Re: Protecting VIA pins

Post by GARTHWILSON »

barnacle wrote:
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.
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
User avatar
drogon
Posts: 1671
Joined: 14 Feb 2018
Location: Scotland
Contact:

Re: Protecting VIA pins

Post 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
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
User avatar
BigDumbDinosaur
Posts: 9425
Joined: 28 May 2009
Location: Midwestern USA (JB Pritzker’s dystopia)
Contact:

Re: Protecting VIA pins

Post by BigDumbDinosaur »

cbmeeks wrote:
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.
x86?  We ain't got no x86.  We don't NEED no stinking x86!
Post Reply