Hello! This is my first post, although I've been reading and learning from the forum for a few months now. I recently took the plunge into building a 65c02 computer, but I should say that I am an absolute beginner at any kind of hardware design. I've played a bit with Arduino in the past, but otherwise my background is in software, and I'm still trying to really understand some of the basics.
In my board, I have an MCU (an ESP32) that performs some I/O tasks, one of which is interfacing with a PS/2 keyboard. The MCU runs at 3.3V, while the PS/2 interface runs at 5V, and so I've had to add a level shifter in between the two. Originally, I just had a couple MOSFETs (one for the clock line, and the other for data) with a 10k pull-up resistor on both sides.
This worked well, but it took up a bunch of space on my board, so I decided to try my hand at a proper bidirectional level shifter, and landed on the TXS0108E (which seemed to be like a good fit, particularly given that, at some point, I also want the MCU to talk to the 65C02 side of the circuit, which also runs at 5V). My circuit looks a little like this:
(Note that the TXS is on a breakout that also includes decoupling capacitors.) I don't have any pull-up resistors here, because my understanding is that the TXS has them built in—and, indeed, the lines are high on both sides when there is no activity.
Now to my problem: for some reason that I do not understand, the signal on both lines looks like this:
This is the data line, as the keyboard is trying to send data to the host. You can kinda see the transmission happen, but it's dirty and causes all kinds of spurious readings at the keyboard end. If you zoom in to the solid-yellow areas, they turn out to be some kind of very tight sine wave at ~2x the clock speed of the keyboard.
This only seems to happen if the keyboard is connected to the TXS breakout board. As far as I can tell, is happens regardless of whether the MCU is connected at the other end. (FWIW, the MCU's pins connected to the lines are both set to inputs.)
This is what I've tried so far:
- I've validated that the signal coming out of the keyboard is clean (-ish… there is a bit of ringing, but it doesn't look like what's showing up in the scope).
- I
think that all the connections are OK—I originally wired this on a breadboard, but then soldered it on a protoboard, just in case.
- The TXS seems to work as I would expect; if I manually pull the lines high and low, I see the correct change on the other side. Speed shouldn't be an issue here, as the PS/2 protocol is in the teens of KHz.
- I've googled the TXS and found a bunch of folks having trouble with it, but their problem seems to have been not tying OE to +3V, which I don't think is my problem.
Obviously, I can go back to my MOSFETs (or even just use a voltage divider), but now I feel like I'm missing something very foundational, and so I would love to take this as an opportunity to learn something new. I'm kinda hoping that someone with more experience will immediately see what's wrong
Thanks in advance for all your help!
-
TXS0108E datasheet in case someone needs to read it.
- The
breakout board I'm using. Given that it came from China and was suspiciously inexpensive, I've already swapped a few different ones in, so I really hope that's not the problem!