Level Translator TXB0104 / TXB0108 for UART

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
deadlock83
 
Posts: 7
Joined: Sun Jan 27, 2013 7:43 am

Level Translator TXB0104 / TXB0108 for UART

Post by deadlock83 »

Hi,

I am trying to connect a special modem to a microprocessor over UART. Problem is that the modem is using 2.775 volt IO and the microprocessor using 3.3 volt IO.
I found the TXB0108 which seem to be able to do the job. I soldered a TXB0104 onto a break-out board.
To make it easy to debug I ignore the microprocessor for now and I bought a USB > 3.3 volt TTL UART cable (FTDI TTL-232R-3V3-WE) so I could easily connect a terminal on my PC to the modem.

The idea is:
PC Terminal <USB> TTL-232R-3V3-WE <UART 3.3v> TXB0104 <UART 2.775v> Modem

After hooking it up and setting correct baud rate on the PC (9600) I realize that I get garbage on the screen. It's like if I press a lot of buttons in the terminal, eventually I get some garbage as reply. (I guess the modem is also getting garbage and replies with an error sometimes)

Ok so why does it not work?

I have done some investigations and there are some things that concerns me. I have measured the USB > 3.3v UART cable connected to the computer with the following results:
GND - CTS = 3.34 volt
GND - TXD = 3.39 volt
GND - RXD = 3.35 volt
GND - RTS = 0.00 volt

So what puzzles me is why I meassure 3.35 volt on RXD. I would think this would be 0 volt since it is an input. Will this confuse the TXB0104 and hence cause the garbage? Can I remedy this by placing a diode in between forcing the current direction from the TXB0104 to the USB/UART?

Any idea why the USB > 3.3v UART cable have a voltage on this pin? Could this be normal or might it be a defective cable? On the other hand I have used this cable on other microprocessors without problem...
Screen Shot 2013-01-27 at 13.17.32.png
Screen Shot 2013-01-27 at 13.17.32.png (10.05 KiB) Viewed 3673 times
- B1-B4 are directly connected to the USB > 3.3v UART cable
- A1-A4 are directly connected to my modem using 2.775 volt level
- VCCa and OE is supplied a voltage reference of 2.775 volt from the modem directly connected
- VCCb is supplied with 3.3 volt from the microprocessor

Any help or suggestions on this are highly appreciated

Kind regards
Jens

deadlock83
 
Posts: 7
Joined: Sun Jan 27, 2013 7:43 am

Re: Level Translator TXB0104 / TXB0108 for UART

Post by deadlock83 »

I have now also realized that if I connect a diode from TXD to RXD on the FTDI cable, making a loopback, I dont get any character echo in my terminal.
If I do the other way around RXD -> Diode -> TXD I get echo in my terminal. Isnt this strange?

User avatar
zener
 
Posts: 4567
Joined: Sat Feb 21, 2009 2:38 am

Re: Level Translator TXB0104 / TXB0108 for UART

Post by zener »

Do you have a scope? That would make investigating this about 100 times easier.

You have a couple of questions and I will try to give a couple of answers. First the last one. You made a loop back connector with a diode. That is interesting. I never thought to use a diode. I just use a wire! But the diode is illustrative... When you put the cathode on TXD it works, cathode on RXD it doesn't work. Yes? Why? Hmmmmm... Why do you suppose? I will let you ponder that one.

As for the first question which as I recall was basically "why doesn't this work?" There are of course many things that could make it all not work. You seem to have covered your bases reasonably well. But something is wrong obviously. You need the right baud rate. You need everything connected in right "direction". You have this magical bidirectional level translator. It magically can decide which way the data needs to go. Hmmmm. Maybe there is a very smart person inside? Well it turns out in order to do its magic it has some limitations. One of them is this:

"For proper operation, the device driving the data I/Os of the TXB0104 must have drive strength of at least ±2 mA."

That is right from the data sheet. I am not sure that is the trouble but you need to make sure that magic part is working right. Scope would be super helpful.

However, let me ask this: Is the difference between 2.8V and 3.3V that big of a deal? It might be possible just to hook the 2 ends together. You could check the specs of the parts on both ends and they might be fine with that.

User avatar
adafruit_support_bill
 
Posts: 88097
Joined: Sat Feb 07, 2009 10:11 am

Re: Level Translator TXB0104 / TXB0108 for UART

Post by adafruit_support_bill »

As Zener says, the logic levels may very well be close enough to just work. We use 3.3v logic signals to drive 5v logic all the time.

Another thing to consider is that the logic signals on one of the devices may be inverted. RS232 is active low and I have seen some TTL serial devices that are active low also.

And yes, a scope would make this all a lot easier to figure out.

deadlock83
 
Posts: 7
Joined: Sun Jan 27, 2013 7:43 am

Re: Level Translator TXB0104 / TXB0108 for UART

Post by deadlock83 »

Thank you both for the reply.

Unfortunately I have no access to a scope :(

I just changed the modem I have connected to another one (I have two of them). I also removed accidently removed the GND connection between the TXB0104 and the FT232 cable.

Turns out that it is now much more stable. I actually get a lot of characters thru correctly. Probably around 75% of them.
Of course this is still very bad for reliable communication...

Another interesting find I did when replacing HyperTerminal with RealTerm is that the CTS line from the modem is blinking a lot.

I am very novice at this but this makes me think that there is either a lot of noice, or that actually the TXB0104 have trouble knowing which direction it is going to send data and hence flips back and forth.

Then I wonder why this can be, if it is like that. It would actually work great with another chip that does snot have auto direction. I just need 2 pins in each direction.

Is there such a chip to recommend?

Jens

User avatar
adafruit_support_bill
 
Posts: 88097
Joined: Sat Feb 07, 2009 10:11 am

Re: Level Translator TXB0104 / TXB0108 for UART

Post by adafruit_support_bill »

the CTS line from the modem is blinking a lot.
It could be just normal RTS/CTS flow control. Some modems require that - although it may be configurable.
See sect. 19.4 http://www.tldp.org/HOWTO/Serial-HOWTO-19.html

deadlock83
 
Posts: 7
Joined: Sun Jan 27, 2013 7:43 am

Re: Level Translator TXB0104 / TXB0108 for UART

Post by deadlock83 »

I have now managed to get access to a scope.

On the FTDI side of the TXB0104 the signals lookk great. Sharp edges between 0 and 3.3 volts. I have decoded the binary 1's and 0's and they add up to the actual characters I send from the computer terminal.
On the 3.3v side
On the 3.3v side
image.jpg (726.23 KiB) Viewed 3481 times
On the modem side of the TXB0104 it looks good as well when I have the modem disconnected. Equal results but variyng between 0 and 2.77 volts.

However when I connect the modem it varies between around 0.25 to 2.77 volts. I guess 0.25 is on the edge between zero and one and that is why I get a lot of garbage in the terminal.

Question is why the modem forces the voltage to minimum 0.25 volts. Question is what can I try to resolve it?

All suggestions highly appreciated
Kind regards
Jens

User avatar
tastewar
 
Posts: 408
Joined: Thu Mar 17, 2011 10:16 am

Re: Level Translator TXB0104 / TXB0108 for UART

Post by tastewar »

Do you have a common ground between the two devices?

User avatar
zener
 
Posts: 4567
Joined: Sat Feb 21, 2009 2:38 am

Re: Level Translator TXB0104 / TXB0108 for UART

Post by zener »

deadlock83 wrote:It would actually work great with another chip that does snot have auto direction. I just need 2 pins in each direction.

Is there such a chip to recommend?
According the write up for the TXB0108, the standard unidirectional level shifters are the CD4050 or the 74LVX245

I know I am am a post behind. Will try to catch up.

User avatar
zener
 
Posts: 4567
Joined: Sat Feb 21, 2009 2:38 am

Re: Level Translator TXB0104 / TXB0108 for UART

Post by zener »

deadlock83 wrote: On the modem side of the TXB0104 it looks good as well when I have the modem disconnected. Equal results but variyng between 0 and 2.77 volts.

However when I connect the modem it varies between around 0.25 to 2.77 volts. I guess 0.25 is on the edge between zero and one and that is why I get a lot of garbage in the terminal.

Question is why the modem forces the voltage to minimum 0.25 volts. Question is what can I try to resolve it?
OK, here's the thing... Both Adafruit support and I believe you can just hook the 2 devices together. To be sure you could consult the datasheet for the 2.8V end and make sure it can take the 3.3. Or you could put a dropping diode and a pulldown on the cathode for the signals going from 3.3V to 2.8V.

As for your actual question, I still think it has to do with the TXB0104. There is a note somewhere that warns about pullup resistors below 50K. Uarts often have pullup resistors so that could be an issue. HOWEVER, in a 0-2.8V logic system, .25V should be interpreted as 0. I would say anything below around .8V or so should be good to go for a low.

deadlock83
 
Posts: 7
Joined: Sun Jan 27, 2013 7:43 am

Re: Level Translator TXB0104 / TXB0108 for UART

Post by deadlock83 »

Thank you tastewar for the reply. Yes there is a common ground. I did suspect the ground and even add some extra ground wires between the devices on my breadboard to make sure there is no resistance creating a voltage drop.

And thank you Zener for the suggestion of just hooking them together. Unfortunately it does not work.
The modem has a absolute maximum value of 3.1 volt for the UART and since the FTDI cable delivers 3.3 volt it will be too much. The dropping diode and pulldown resistor idea is interesting, if you could jot down a schematic for how to do this it would be highly appreciated.
Maybe I can just remove the TXB0104 and use this approach again.

Anyway, back to the TXB0104 problem I have documented my findings a bit more thorough now.

When I connect the FTDI cable to the TXB0104 everything looks correct at the scope (I have not connected the modem data lines at this time). See below:
Modem not connected
Modem not connected
drawing1.png (22.93 KiB) Viewed 3423 times
When I connect RXD from the TXB0104 to the modem the following results can be seen:
Modem connected
Modem connected
drawing2.png (23.74 KiB) Viewed 3423 times
As you can see, the lowest voltage goes from 0 volt to around 0.7 volt on the TXB0104 2.775 side.

So does these findings tell you anything about the problem? Or should I just forget about the TXB0104 and use the "dropping diode and pulldown resistor idea" instead?
Kind regards
Jens

User avatar
zener
 
Posts: 4567
Joined: Sat Feb 21, 2009 2:38 am

Re: Level Translator TXB0104 / TXB0108 for UART

Post by zener »

Great diagrams and scope shots! So I have a theory, and as was said by some smart person, without theories there is no learning. And the other great thing about theories is you can test them. My theory is the modem has internal pull ups smaller than 50k. To test this theory you could consult the data sheet for the part on the modem end if you have one. Or you could put a 10k to ground and see how far a high level drops, then calculate the value of the pull up.

I think what is happening is the thing recognizes the 3.3v end as the sender when it is high. But gets confused when it is low.

Assuming I am right (50 50 chance...) what can we do? Best guess is try a pull down. Maybe put a pot and try different values and see if you can get the voltage down a bit. Although I still think .7 should be low enough...

deadlock83
 
Posts: 7
Joined: Sun Jan 27, 2013 7:43 am

Re: Level Translator TXB0104 / TXB0108 for UART

Post by deadlock83 »

Hi,

The following can be read about the input and output levels of the modems rs232 lines:
(1) High-level DC output voltage (VOH): > 2.05 V; Typ. 2.775 V
Low-level DC output voltage (VOL): < 0.6 V
(2) High-level DC input voltage (VIH): 2.3 V ÷ 2.775 V
Low-level DC input voltage (VIL): 0 V ÷ 0.4 V

So unfortunately 0.7 volt is too high.

I have avtually tried adding a pulldown resistor (if I get the concept right, that is a resistor from the data line to ground?) I think I used a 1M resistor maybe I tried a smaller as well. Only thing that happened was that the high value dropped significantly. The low- value did not change noticeably.


Kind regards
Jens

User avatar
zener
 
Posts: 4567
Joined: Sat Feb 21, 2009 2:38 am

Re: Level Translator TXB0104 / TXB0108 for UART

Post by zener »

You can try to figure out this bidirectional shifter part, or you can try to find another way. I would go the latter route. I believe you can hook the modem outputs directly to the 3.3V UART inputs. Please let me know if that is not true. And going the other way you are fine for 0V out but you don't want to go above 2.8V for the high. You could try a pulldown there, and if that doesn't work then try a divider.

It is a common problem to get stuck on something and get tunnel vision on it and go down the rabbit hole. SImilar to when a pilot flies a plane into the ground because he/she was fixated on some little orange light or something. My boss likes things done in a time frame somewhere between fairly fast and very fast. Average speed is undesireable, and slow is right out. He wants a solution now, and move on to something else. You may have the luxury of time, I don't know. But I would try another way. You might learn something else about it anyway.

deadlock83
 
Posts: 7
Joined: Sun Jan 27, 2013 7:43 am

Re: Level Translator TXB0104 / TXB0108 for UART

Post by deadlock83 »

Thank you all for your great help!

I am always looking for alternatives :)

I had ordered a TXS0104 (people are claiming it is better for some protocols) It is pin compatible with TXB0104.
I believe you were right in that there was pull-ups in the modem that was too small and TXB0104 could not drive them to zero.
Seem however that TXS0104 manages to handle it. It looks perfect on the scope now, on both sides and it works flawless so far :)

I also read that it was possible to use diodes in one direction which was another alternative I was looking at.
http://www.savagecircuits.com/forums/co ... 3V-Devices
since both TX and RX lines are high I would probably hurt the modem regardless if I connect anything directly to it.

Thanks again for all your help
Jens

Locked
Please be positive and constructive with your questions and comments.

Return to “General Project help”