6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Fri Sep 20, 2024 9:34 pm

All times are UTC




Post new topic Reply to topic  [ 18 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Tue Feb 02, 2016 6:53 pm 
Offline
User avatar

Joined: Wed Aug 17, 2005 12:07 am
Posts: 1228
Location: Soddy-Daisy, TN USA
I want to build a circuit using a 3.3v microcontroller and a couple 65C22's. (A Mockingboard clone).

The 65C22 can run at 3.3v (IIRC) so connecting it directly to the mcu should be straightforward.

However, the Apple IIe's slot voltages are at 5V+ typically (ignoring the -5 and +12).

So, could the 65C22 be used to level shift the voltages to/fro the slot and the MCU? In other words, use 5v when talking to the CPU and 3.3v when talking to the MCU?

Or, should I put some level converters between the 65C22 and CPU?

The MCU shouldn't ever talk directly to the slot (5V). If it did, I would probably put a dedicated level shifter in there for any one-offs.

Thanks for any input!

_________________
Cat; the other white meat.


Top
 Profile  
Reply with quote  
PostPosted: Tue Feb 02, 2016 7:11 pm 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3367
Location: Ontario, Canada
You have various options.

  1. Apple 6502 running at 5V <---> level shifter <---> 65C22 running at 3V <---> microcontroller at 3V

  2. Apple 6502 running at 5V <---> 65C22 running at 5V <---> level shifter <---> microcontroller at 3V

  3. Apple 6502 running at 5V <---> 65C22 running at 5V <--- microcontroller at 3V

Sounds like it's option 1 you have in mind. 74LVX4245 is a level-shifting transceiver that might suit you. Note that with option 1 you need to level-shift more than just the data bus. The VIA has register-select and control inputs that need shifting too. Your best bet might be a mixture of option 2 & 3.

Option 3 is unidirectional (notice the one-way arrow). You can omit the level shifter when the output of a 3V device drives the input of a 5V device and the inputs of the latter are specified to accept TTL voltage levels. IIRC the inputs of WDC 65c22's do NOT accept TTL voltage levels, so get a Rockwell part to use this option.


Quote:
The 65C22 can run at 3.3v
I believe that's true for WDC parts. Rockwell et al aren't specified for 3V operation but would probably work.

HTH!
Jeff

_________________
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html


Top
 Profile  
Reply with quote  
PostPosted: Tue Feb 02, 2016 7:31 pm 
Offline
User avatar

Joined: Wed Aug 17, 2005 12:07 am
Posts: 1228
Location: Soddy-Daisy, TN USA
Ah, thanks for the reply.

I have a couple of the WDC versions.

http://www.mouser.com/Search/ProductDet ... 22S6TPG-14

Quote:
IIRC WDC 65c22's do NOT accept TTL voltage levels, so get a Rockwell part


Sorry, but I'm not 100% sure I know what you mean here. In the past, I've used these parts to build a Mockingboard clone but I used all 5V parts (no MCU). Are you saying that I will have trouble interfacing with a 3.3v part? Sorry, if I'm being dense here.

From what you said, it sounds like option 2 might be my best bet because the MCU is the only part that *has* to be 3.3v and it does need to be bi-directional. I'm just going to need about 26 level shifters! :-)

Thanks again.

_________________
Cat; the other white meat.


Top
 Profile  
Reply with quote  
PostPosted: Tue Feb 02, 2016 7:44 pm 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3367
Location: Ontario, Canada
cbmeeks wrote:
Quote:
IIRC WDC 65c22's do NOT accept TTL voltage levels, so get a Rockwell part


Sorry, but I'm not 100% sure I know what you mean here.
This strictly pertains to the case where you're trying to operate without a level shifter.

It's generally true that a device running on 3V will output high and low logic levels of roughly 0 and 3 volts. So, the input of the device receiving that signal needs to recognize 0 as a valid logic low (no problem) and recognize 3V as a valid logic high. Problem! A WDC 65C22 running on 5V won't (according to the specs, at least) recognize 3V as a valid logic high.

The specs for Rockwell and many others are different. Their inputs deem anything over about 2V to be high -- that's the way things work with TTL voltage levels. So it gives us a free ride when it comes to level shifting! But in one direction only.

There's a different trick for going from 5V levels to 3V -- use a pair of resistors as a voltage divider. But, again, this is uniudirectional.

_________________
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html


Last edited by Dr Jefyll on Tue Feb 02, 2016 7:51 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
PostPosted: Tue Feb 02, 2016 7:48 pm 
Offline
User avatar

Joined: Wed Aug 17, 2005 12:07 am
Posts: 1228
Location: Soddy-Daisy, TN USA
AH! Yeah, actually I remember that now. I just wasn't putting 2 and 2 together.

You answered two of my questions then. I was thinking the 65C22 could be used as a level shifter because on the 5V side, it would know 0v = off and 4.5-5v (or so) = on. And then on the 3.3v side, 0v = off and 3 - 3.3 (or so) would be high. But it sounds like 3.3v isn't enough to register as high.

Some IC's, however, will give you that "free" bi-directional level shifting...just not the WDC 65C22.

Makes sense. Also, kind of a bummer too. I might look into the Rockwell version as well. At least I know what to look for now.

Thanks again!

_________________
Cat; the other white meat.


Top
 Profile  
Reply with quote  
PostPosted: Tue Feb 02, 2016 8:05 pm 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3367
Location: Ontario, Canada
cbmeeks wrote:
Some IC's, however, will give you that "free" bi-directional level shifting...
Free, yes; bidirectional -- no. :(

Say we have a 5V-powered Rockwell 65c22 and a 3V microcontroller. The free level shifting only happens in regard to signals sent from the uC to the 65c22. (ie- from a 3V output to a TTL compatible input)

Sending in the other direction you need a different trick. In the case of a 6522 pin that's an OUTPUT, then use a pair of resistors as a voltage divider to reduce the 5V signal to a 3V signal that can be accepted by the uC. Or of course a level-shifter IC can do the job.

_________________
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html


Top
 Profile  
Reply with quote  
PostPosted: Tue Feb 02, 2016 8:10 pm 
Offline
User avatar

Joined: Wed Aug 17, 2005 12:07 am
Posts: 1228
Location: Soddy-Daisy, TN USA
Dr Jefyll wrote:
cbmeeks wrote:
Some IC's, however, will give you that "free" bi-directional level shifting...
Free, yes; bidirectional -- no. :(

We have a 5V 65c22 and a 3V microcontroller. The free level shifting only happens in regard to signals sent from the uC to the 65c22. (ie- from a 3V output to a TTL compatible input)

Sending in the other direction you need a different trick. In the case of a 6522 pin that's an OUTPUT, then use a pair of resistors as a voltage divider to reduce the 5V signal to a 3V signal that can be accepted by the uC. Or of course a level-shifter IC can do the job.


Ah, OK. I see what you mean now.

This is a hobby project so I will probably just take the easy (lazy?) route and use level shifters. :-)

Thanks.

_________________
Cat; the other white meat.


Top
 Profile  
Reply with quote  
PostPosted: Tue Feb 02, 2016 8:14 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8510
Location: Southern California
Dr Jefyll wrote:
There's a different trick for going from 5V levels to 3V -- use a pair of resistors as a voltage divider. But, again, this is uniudirectional.

Do add a capacitor in the range of 22pF to 47pF across the top resistor to keep the speed, because of the slight capacitance of the load.

_________________
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?


Top
 Profile  
Reply with quote  
PostPosted: Tue Feb 02, 2016 8:26 pm 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3367
Location: Ontario, Canada
Option 1 should suit you, then.

1. - Apple 6502 running at 5V <---> level shifter <---> 65C22 running at 3V <---> microcontroller at 3V

As noted, in addition to its data bus the VIA has register-select and control inputs that need shifting too. So you'd need two of those 74LVX4245 (or whatever). But the cool thing is, if you build your card that way then the card could talk to 3V devices or 5V devices. Just have a jumper that selects 3V or 5V to power the VIA. (The level shifter won't mind "shifting" signal from 5V to 5v. :) )

_________________
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html


Top
 Profile  
Reply with quote  
PostPosted: Tue Feb 02, 2016 8:35 pm 
Offline
User avatar

Joined: Wed Aug 17, 2005 12:07 am
Posts: 1228
Location: Soddy-Daisy, TN USA
Good idea.

So, on those transceivers, would I have to encode the logic to switch between A -> B or B -> A?

I have a handful of these:

https://www.sparkfun.com/products/12009

Which uses the BSS138.

_________________
Cat; the other white meat.


Top
 Profile  
Reply with quote  
PostPosted: Tue Feb 02, 2016 9:01 pm 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3367
Location: Ontario, Canada
Attachment:
74LVX4245.pdf [352.19 KiB]
Downloaded 70 times
cbmeeks wrote:
So, on those transceivers, would I have to encode the logic to switch between A -> B or B -> A?
You mean the 74LVX4245, I guess. Pin 2, the direction input, determines whether the A side is inputs and the B side outputs, or vice versa. If you place this device in the data bus between the CPU and the VIA (as with option 1) then both directions are required, because read cycles and write cycles involve opposite directions of signal travel. So pin 2 would connect to the R/W signal from the 6502 (or card slot).

Depending on your skill level, it may be best to use option 2 or 3 instead. The Sparkfun card with the BSS138's is interesting. But I wouldn't recommend it for use with option 1.

Quote:
I'm just going to need about 26 level shifters! :-)
It might help to tell us the details. (I have no idea what a Mockingbird is.)

_________________
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html


Top
 Profile  
Reply with quote  
PostPosted: Wed Feb 03, 2016 10:18 pm 
Offline
User avatar

Joined: Wed Aug 17, 2005 12:07 am
Posts: 1228
Location: Soddy-Daisy, TN USA
Quote:
It might help to tell us the details. (I have no idea what a Mockingbird is.)


Well, it's actually a "Mockingboard".

https://en.wikipedia.org/wiki/Mockingboard

Basically, it's a sound card that was designed for the Apple II series of computers in the 80's. :-)

_________________
Cat; the other white meat.


Top
 Profile  
Reply with quote  
PostPosted: Wed Feb 03, 2016 10:31 pm 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3367
Location: Ontario, Canada
What are the details of the connections you hope to establish? How many input pins will the 65c22 need to read from? How many output pins will it write to? And are there any bi-directional signals -- such as a data bus that carries data back & forth between two devices?

If would be helpful if you post either a basic diagram or a careful description of what the 65c22 connects to -- on the Apple side AND the Mockingboard side. What is the device that creates the sounds? You mentioned a microcontroller...

_________________
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html


Top
 Profile  
Reply with quote  
PostPosted: Thu Feb 04, 2016 8:33 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10938
Location: England
I think cbmeeks mentioned elsewhere that this is a Propeller project. That's a 3v3 chip, and it's a frequently asked question as to how to interface it to a 5V world. One answer is to use 1k series resistors for the Propeller's inputs:
Quote:
To input from a 5V system, a series resistor in the 1k-100k range is probably·the best approach.·There are parasitic catch diodes on every pin of the device which will clamp incoming out-of-range voltages to within ~0.4V of the VSS and VDD rails. This will force the resistor to drop 1.3V (5.0V-(3.3+0.4)) for an incoming high signal.

There are other more complex circuits - try searching or image searching for
[parallax propeller 5v interface]

(That quote is from Chip Gracey, founder of Parallax and designer of the Propeller. Presumably the internal diodes can handle the currrent - 1.3V through 1k is 1.3mA. The diode has to dissipate 0.52mW. I think.)


Top
 Profile  
Reply with quote  
PostPosted: Thu Feb 04, 2016 1:59 pm 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3367
Location: Ontario, Canada
BigEd wrote:
There are other more complex circuits - try searching or image searching for
[parallax propeller 5v interface]
Thanks, Ed. Actually I was hoping cbmeeks would define the problem. (How many 3V->5V level conversions? How many 5V->3V? How many bi-directional?) With your link it's more a case of defining solutions... :)

... regarding which I have some misgivings. I'll explain.

Quote:
There are parasitic catch diodes on every pin of the device which will clamp incoming out-of-range voltages to within ~0.4V of the VSS and VDD rails. This will force the resistor to drop 1.3V (5.0V-(3.3+0.4)) for an incoming high signal.
Okay, this is the 5V->3V case. I see this "just add a series resistor" technique mentioned often, but it overlooks the possibility that the 3V supply will actually be driven higher than 3V due to the current passing through the resistors and the parasitic catch diodes. It's not unlikely if the 3V supply is lightly loaded (eg: only driving some CMOS chips). That's why when lacking full details I recommend not just a series resistor but also a resistor from the 3V node to ground, resulting in a voltage divider. (Garth's suggestion of a cap will reduce delay.) The voltage divider means no current through the diodes and no chance of the 3V supply rising above 3V (which I admit may be harmless, but it's a violation of the specs).

Quote:
To output to a 5V system might be a simple matter if the threshold voltage is TTL (~1.4V) or CMOS (2.5V). You can connect straight in.
This is the 3V->5V case. I agree about the ~1.4V TTL input threshold -- that's the "free" conversion we mentioned earlier. 3V is well above 1.4V, and the datasheet will show the input can accept 3V as a logic high. But as for CMOS levels, 3V (or 3.3V) is only marginally above the 2.5V half-way point, and it's likely the datasheet will not show 3V as an acceptable logic high. But it will probably work.


BigEd wrote:
That quote is from Chip Gracey, founder of Parallax and designer of the Propeller
I accept that Mr Gracey is a very well-qualified person. But it would be a mistake to suppose such a person always provides comprehensive answers. In this case he has "dumbed it down" quite a bit, and that's worth noting.

_________________
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 18 posts ]  Go to page 1, 2  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: