Hi all.
I have a project where I am interfacing with PSX/PS2 controllers using an Arduino. To give a quick run down, the protocol is simply modified SPI, and the controllers take approximately 3.3v for power. To shift the logic level of the Arduino, I am using an IC, TXB0106 bidirectional, 6 bit level shifter (https://www.ti.com/lit/gpn/txb0106). Bidirectional is a little overkill, but I liked the convenience of using a single IC for all the pins.
So I've connected the IC using a breakout board to a breadboard, and I've connected the B pins to the Arduino and VccB to 5v. I've also connected the A pins to the PS2 controller and VccA to my 3.3v input, currently it is just the Arduino's 3V rail. I've also connected the OE, "enable" pin, to 3.3V.
The issue is that, when I run a simple test program with the Arduino that switches a pin between 0v and 5v rapidly, the output will sometimes show 0v and 3v to match, but sometimes rather than switch from 0v to 3v or vice versa, it goes low impedance, and the scope reads like 1.5v for the entire interval. I can attach a screenshot or a file of the scope to maybe communicate what I'm saying better. I don't want to give up on this IC yet but I am unclear as to what I could be doing wrong. The data sheet seems to indicate that no further components are required except maybe bypass capacitors. I don't have them installed currently. I'm not sure what not having them does. I don't really have an electronics background so I'm sort of in the dark here. Any advice would be appreciated!
+1 on a wiring diagram. But I've seen multiple people here and elsewhere try to use these bidirectional level shifters, no one successfully. If the 5V Arduino is the master, you can use a 74LVC125A to shift MOSI, SCLK and CS down to 3.3V, and you can just connect MISO directly, with no level shifting. The Arduino will read the incoming 3.3V as high. Adafruit's SD card modules use that method, and it seems to work fine.
Sorry this isn't really responsive to your question. I've just never seen anyone figure out the TI shifters.
hammy:
We need a wiring diagram of what you have actually wired .
Have you commented up the ground connections ?
OK, I've attached it.
What do you mean by commented?
ShermanP:
+1 on a wiring diagram. But I've seen multiple people here and elsewhere try to use these bidirectional level shifters, no one successfully. If the 5V Arduino is the master, you can use a 74LVC125A to shift MOSI, SCLK and CS down to 3.3V, and you can just connect MISO directly, with no level shifting. The Arduino will read the incoming 3.3V as high. Adafruit's SD card modules use that method, and it seems to work fine.
Sorry this isn't really responsive to your question. I've just never seen anyone figure out the TI shifters.
Yeah, posting here was sort of my last resort before I look at something else. A bidirectional shifter is pretty overkill for my application, since 3 of my wires are strictly inputs, and 3 are strictly outputs, but I liked the convenience of using a single IC for all 6 of my wires. If this doesn't work I may just try using transistors.
A 100nf bypass cap on the TXB010x would be a good idea...
Do you know/have any details on the low voltage side? The reason is that the TXB parts are only compatible with push-pull CMOS outputs. If you’ve got open drain/collector outputs on the LV side, they will absolutely not work. In addition, some low output current devices are not able to drive enough current input into the level translator for it to know which direction to buffer.
WattsThat:
A 100nf bypass cap on the TXB010x would be a good idea...
Do you know/have any details on the low voltage side? The reason is that the TXB parts are only compatible with push-pull CMOS outputs. If you’ve got open drain/collector outputs on the LV side, they will absolutely not work. In addition, some low output current devices are not able to drive enough current input into the level translator for it to know which direction to buffer.
Yeah, regarding the bypass cap, I bought a set of 100 nF through hole caps for that purpose, but for whatever reason, texas instruments' TSSOP breakout board is literally the width of your average breadboard. I need to go buy another breadboard so I can lay 2 next to each other so I can get enough space to actually plug them in. Haven't made it to the store yet. Could that be causing my issue?
You know, I never considered the type of outputs there are on either side. I wish I knew enough about the difference between different outputs, I don't really have a background in electronics. I believe a pull up resistor is mandatory on the inputs, is that what open drain means?
If you need a pullup resistor to make an output have a voltage present, yes, it’s either open drain (for a mosfet) or collector (for a bipolar transistor). Said a bit differently, if an output has no voltage present until a pullup resistor is added, it is open drain/collector and not push-pull.
An open drain device only sinks current, unlike a push-pull output which both sinks and sources current. With an open drain output, the only current source is through the pullup resistor. This tends to be low current and it depends upon the resistor value. Ohms Law provides the current where voltage divided by the resistance is the current.
Conversely, push-pull can provide a much higher current. You may hear this stated as push-pull has a lower output impedance which just means it can supply more current than a high impedance source. Impedance is the AC equivalent of DC resistance. Think of it as a frequency dependent resistance.
It is the output impedance of a logic device that the TXB010x uses to determine the bus direction. When a pin is high impedance, it’s an input, when low, it’s an output.
Oh! You meant commented out the digitalWrite(pin, LOW) lines in my Arduino code. No, I haven't done that. Looking at my scope, the 5V side is consistent, moving between 0V and 5V at the interval I specified. It's the 3V side that appears to go high impedance and get stuck at 1.5V during some of these intervals. I think, based on WattsThat is saying, the IC I am using simply will not work for my application.
WattsThat:
If you need a pullup resistor to make an output have a voltage present, yes, it’s either open drain (for a mosfet) or collector (for a bipolar transistor). Said a bit differently, if an output has no voltage present until a pullup resistor is added, it is open drain/collector and not push-pull.
An open drain device only sinks current, unlike a push-pull output which both sinks and sources current. With an open drain output, the only current source is through the pullup resistor. This tends to be low current and it depends upon the resistor value. Ohms Law provides the current where voltage divided by the resistance is the current.
Conversely, push-pull can provide a much higher current. You may hear this stated as push-pull has a lower output impedance which just means it can supply more current than a high impedance source. Impedance is the AC equivalent of DC resistance. Think of it as a frequency dependent resistance.
It is the output impedance of a logic device that the TXB010x uses to determine the bus direction. When a pin is high impedance, it’s an input, when low, it’s an output.
OK, I think it's becoming more clear now. So for my inputs, since they require a pull-up, could I simply use a pull-up to 5V and interface with them without a level shifter?
And for my outputs, assuming the above is true, a simple 2-transistor setup should work to drive the outputs. They just need to be able to handle up to ~500 kbps data rate. I could theoretically connect the outputs directly but I am unclear whether all PSX/PS2 controllers can handle 5V... I'm hoping this project will work with a variety.
For level shifting at high speeds, I prefer a 2-chip solution.
cd74HC4050 powered from 3.3V to bring 5V signals down to the 'slave' device, and
sn74ACT241 powered from 5V to bring 2 to 3V high levels back to 5V for the 328P 'master' device. Digikey.com has both.
CrossRoads:
For level shifting at high speeds, I prefer a 2-chip solution.
cd74HC4050 powered from 3.3V to bring 5V signals down to the 'slave' device, and
sn74ACT241 powered from 5V to bring 2 to 3V high levels back to 5V for the 328P 'master' device. Digikey.com has both.
Okay. I'll give that a try, but I may still try a test circuit with some transistors, just in case it doesn't work for some reason.
OK, I got the cd74HC4050 and plugged it in. It works, pretty well I'd say! Getting good button readings from the controller, I think I'm almost ready to get it hooked up to the PC as a first test. One thing I'm seeing that I don't like, though, is that even with a pretty low ohm value pull-up resistor, the high bits are only about 4 volts. The Arduino is okay with this, but I am concerned about reliability, especially if I decide to try and support the multi-tap PSX peripherals, they run at 500 kbps. Is this okay? Any idea what the reason for this is? What's curious is that, without a pull-up resistor, I'm seeing above 0 volts, which is very strange. It only happens when the controller is connected, otherwise the pin reads 5 volts - with the pull-up.
I attached images of the scope readings with and without the pull-up resistor. Should I just consider this working and move on?
Has anyone tried Nexperia's LSF0204PWJ 4-bit bidirectional multi-voltage level translator?
I have an issue were I am designing two boards, one has a ATMEGA4808 MCU (5V) and the other has a ATSamD21J18 MCU (3.3V). I need for the board with the 4808 MCU to be a slave of the D21J18 MCU. I am planning on using SPI for the communications but like you I have an issue with the logic voltage levels. I ran across the LSF0240PWJ chip in my research. It looks like it was made for just such project. It uses the voltages from both boards as a reference and the adjust the inputs/outputs accordingly. The datasheet schematic looks like it uses a mosfet just like the Nano Every board uses BSS138s between the 3.3V ATSamD11D14 USB controller and programmer and the 5V ATmega4809 MCU. The price of the LSF0240PWJ is around 60 cents at Mouser. I have some on order to test with.
I'm a newbie and I thought I would run it past the forum for review. I hope I am doing this forum thing right.