Page 2 of 2

Re: 5v-3v3 bidirectional buffer

Posted: Tue Nov 21, 2023 11:05 am
by gfoot
It's an open-drain interface so you're meant to pull it to your power rail with resistors. Are you seeing the keyboard pulling up to 5V itself? I'd imagine this is harmless, and it'd be fine for you to connect that down to your 3V3 rail with diodes, clamping it at that level - the keyboard's end should be very high impedance so not much current should flow through the diodes.

Edit: It sounds like keyboards may well have their own pull-ups, e.g. about 2K. It is possible that the keyboard also requires the line to reach close to 5V at the bottom of that pull-up resistor. So the diode solution might not be good, you might need more active level conversion, either an open-drain level converting IC or a couple of transistor-inverters, one for each direction, like this: https://www.falstad.com/circuit/circuit ... geCCnlUJAA

In that example the left portion represents what's in the device, and the right is what's in your host; and I've rigged it so that the device and host both periodically pull the signal line low, so you can see that they then both see a good voltage swing at their inputs when the other device does this to the signal line. You can try removing the device's pull-up resistor and see that the circuit works fine whether it has one or not.

Re: 5v-3v3 bidirectional buffer

Posted: Tue Nov 21, 2023 11:20 am
by AndrewP
gfoot wrote:
It's an open-drain interface so you're meant to pull it to your power rail with resistors. Are you seeing the keyboard pulling up to 5V itself?
I can't speak for Neil but I saw both keyboards pulling all the way up to 5V. I didn't use pull up resistors.
PS2 Keyboard.pdf.png
Above is what I want to build. And basically what I have built on a breadboard without the 10KΩ pull-ups on the clock and data lines. I'm not sure the 100Ω current limiting resistors are necessary but if not I'll jumper them with 0Ω resistors.

As a bit of an aside the (poorly named) /CODE PULSE signal goes high only after all the packets for a key-press have been sent (that's why I have two 10KΩs in parallel so I can play with RC timing values if I turn up a keyboard that is very different). That allows me to feed the '595 shift register (not in the schematic) into a '40105 FIFO (also not in the schematic) and that means that I only have to service an interrupt once per key-press. Overkill? Absolutely. Fun? Yes!

Re: 5v-3v3 bidirectional buffer

Posted: Tue Nov 21, 2023 11:49 am
by BigEd
Just to note, some PS/2 keyboards, but not all, can run with 3V3 supply and signalling.

Re: 5v-3v3 bidirectional buffer

Posted: Tue Nov 21, 2023 12:10 pm
by gfoot
Yes, I'm not sure how much you can rely on the keyboard being 3V3-tolerant but YMMV. Note I edited my post to include a link to a possible circuit in falstad, using two transistors per signal line, that allows connection to a 3V3 host but still gives good voltage swing at the device regardless of its own pull-up capability.

Re: 5v-3v3 bidirectional buffer

Posted: Tue Nov 21, 2023 2:27 pm
by barnacle
Hmm. I've seen comments on t'net that suggest they will work on 3v3, but that's almost certainly going to be keyboard dependent :mrgreen:

Re: 5v-3v3 bidirectional buffer

Posted: Tue Nov 21, 2023 3:09 pm
by sburrow
speculatrix wrote:
But all the TXB family are a little limited on power output, I think.
Perhaps this is a newbie-style question but, where would you find that in the datasheet?

Attached is what I see on the datasheet, am I looking in the wrong place?

Thank you!

Chad

Re: 5v-3v3 bidirectional buffer

Posted: Tue Nov 21, 2023 3:29 pm
by John West
sburrow wrote:
speculatrix wrote:
But all the TXB family are a little limited on power output, I think.
Perhaps this is a newbie-style question but, where would you find that in the datasheet?

Attached is what I see on the datasheet, am I looking in the wrong place?
Those are the Absolute Maximum Ratings, which are the "don't go over these or you'll break it" limits. You wouldn't get close to them in normal operation (and note (1) makes that explicit: "These are stress ratings only, and functional operation of the device at these or any other conditions beyond those indicated under Section 6.3 is not implied.").

You'd normally find the output current under Electrical Characteristics, but I can't see anything there. That suggests to me that these chips aren't intended to supply any meaningful current - they're expecting to drive high impedance CMOS inputs.

And looking at the block diagram in section 8.2, that's confirmed: ignoring the driver that's controlled by the one-shot (used to get outputs to their final voltage quickly, then disengaged), in the steady state the output is in series with a 4K resistor. Drawing 50mA will give you a 200mV drop - assuming zero output impedance and full voltage swing on the driver, which isn't guaranteed.

It makes sense. There's no direction control, so the outputs have to be weak enough to be over-ridden by anything they're connected to.

Re: 5v-3v3 bidirectional buffer

Posted: Tue Nov 21, 2023 3:59 pm
by barnacle
I was more concerned with the statement from the datasheet for the 104:

8.3.2 Input Driver Requirements
Typical IIN vs VIN characteristics of the device are shown in Figure 8-2. For proper operation, the device driving
the data I/Os of the TXB0104 device must have drive strength of at least ±2 mA.

Which if I'm driving sixteen address and eight data and a handful of other pins, is likely over 50mA. And I like micropower devices :mrgreen:

Neil

Re: 5v-3v3 bidirectional buffer

Posted: Tue Nov 21, 2023 5:19 pm
by sburrow
Ah ok, so the TXB0104 is made for chip-to-chip communication, not necessarily peripherals (such as a PS/2 Keyboard).

And I see what you mean about the 2 mA adding up for you. You are running a couple of buses through these things, not just a couple of signal lines.

Thanks for informing me more on this!

Chad

Re: 5v-3v3 bidirectional buffer

Posted: Wed Nov 22, 2023 2:54 pm
by Dr Jefyll
gfoot wrote:
or a couple of transistor-inverters, one for each direction, like this:
Ouch! Oh, man, do I hate that color scheme! :roll: I find black on white to be a big improvement:
circuit (edited) 1.png
And what's shown below is, in most circumstances, an improvement to the circuit itself.

-- Jeff

Re: 5v-3v3 bidirectional buffer

Posted: Fri Dec 01, 2023 4:30 am
by kakemoms
I have been using the https://www.ti.com/lit/ds/symlink/txb0108.pdf for some years and haven't had much problems. I even used it to interface a NMOS 6502 some years back(!). The address bus don't need it.. I used the 245 there.

Anyone tried to overclock the 65C02? E.g. driving it at higher voltage to get a few more MHz.

Re: 5v-3v3 bidirectional buffer

Posted: Fri Dec 01, 2023 5:13 am
by barnacle
For this proto board I've decided to stick with 3.3v throughout and see what's still unhappy. The board is already complex and four extra chips really don't help it.

Neil

Re: 5v-3v3 bidirectional buffer

Posted: Fri Dec 01, 2023 5:15 am
by GARTHWILSON
kakemoms wrote:
Anyone tried to overclock the 65C02? E.g. driving it at higher voltage to get a few more MHz.
Forum member "Plasmo" got one running at 40MHz @ 5.3V: viewtopic.php?p=85784#p85784 (see the edit).

Re: 5v-3v3 bidirectional buffer

Posted: Fri Dec 01, 2023 5:36 am
by BruceRMcF
sburrow wrote:
Don't know if this is closer to what you are wanting or not, but I'll be using the TXB0104D:

https://www.ti.com/lit/ds/symlink/txb0104.pdf

It doesn't have 8 bits, but it is bi-directional and super flexible.

Thanks!

Chad
Looks like a interesting part to think about for connecting to a 3.3v serial flash ... MOSI, SCLK and /SELECT, with an additional bit available for a second /SELECT for an SPI block pin header for another 3.3v SPI bus part.