23201a - trying to do a loopback test

What I want to do is read the output of a depth sounder, which is 4800 baud RS-232 data. I will be reading it with an Arduino. But before doing that, I want to make sure I have the serial interface correct, so I am hooking it up to my FTDI cable. And just as a quick sanity test before hooking up an external source, I tried a loopback test by connecting Rx to Tx, typing characters in a terminal program and looking for echoes. It fails when Rx and Tx looped back on the DB-9 but works if I remove the 23201a and just connect Rx to Tx to loop back FTDI. So my terminal program works fine for this test and my FTDI cable sends and receives data just fine (I use it often for programming; it works).

What I have is an FTDI cable to a small breadboard. In description that follows, colors are FTDI standard; abbreviations are on the 23201a. Black->GND, Red->VCC. I looped back pin 2<->3 on the DB-9 and tried Yellow to RX, Orange to TX. I get nothing. I tried switching Orange to RX, Yellow to TX. Nothing. I unplug the 23201a from the breadboard and loop from Orange to Yellow and I get echoes. So my FTDI loopback works. What does the 23201a need besides VCC, GND, RX and TX?

For reference, below is the standard FTDI pinout. Source: http://www.ftdichip.com/Products/Cables/USBTTLSerial.htm
1 GND GND Black Device ground supply pin.
2 CTS# Input Brown Clear to Send Control input / Handshake signal.
3 VCC Output Red +5V output,
4 TXD Output Orange Transmit Asynchronous Data output.
5 RXD Input Yellow Receive Asynchronous Data input.
6 RTS# Output Green Request To Send Control Output / Handshake signal.


It seems like you might be misunderstanding the point of our RS-232 adapter, which is for connecting a computer serial port to a logic-level device, such as your FTDI adapter. If your depth sounder is a device that also connects to a computer COM port, you might not have the necessary connections for it to work (there are 5 lines going one way and 3 going the other way). If all you need is the serial lines, this should still work. However, you have to pay attention to the directions of the TX and RX lines, and just trying it both ways is almost guaranteeing you’re going to destroy something. It sounds like your initial connection was Tx to Tx, which is wrong; you have to connect transmit to receive.

- Jan

Yes, all I need is serial lines. Tx and GND is all the depth finder provides. But until loopback is working, lets not worry about that.

I am just trying to use the FTDI to assure myself the serial data is coming in as expected before I wire it to the Arduino. I did the same thing with a GPS module - first I wired it to my FTDI cable on the breadboard and saw I was getting data and then I wired it to the Arduino. Now I am doing the same test with the depth finder, only first I have to get the RS-232 adapter working. A simple loopback will assure me it does.

Anyway, let me repeat my question:

I really expected loopback to work with only those four lines connected and pin 2 shunted to pin 3. it does not. Do I need to hook up something else?

Sorry I didn’t answer the question. Yes, those four connections should be enough. My point was that you could have destroyed it with the bad connections to TX and RX (the RX-RX connection should be okay). You might also consider doing the test the other way around, with a DB9 connection to a COM port on you PC, and then connecting TX to RX on the logic side.

- Jan

Seriously? I have been dealing with serial connections for over 30 years. Trial and error to get Tx/Rx right is SOP because they are often backwards (depending on your POV) and I have never before encountered a device that could not handle having them swapped. The data just doesn’t go through and you try it the other way. But your part doesn’t work, so it must be the customer’s fault. Too much power or raw voltage to the wrong pin is another matter. This is the second Pololu part that has failed on me when wired according to spec and the second time I have been accused of destroying it. I sense a pattern.

Yes, seriously, and it should be really easy to understand why you should not do that. Your standard operating procedure is not good, and with an approach like that, you’re probably going to keep destroying things. Shorting two TX lines to each other is absolutely not “wired according to spec”.

- Jan

Amazing! You really expect me to believe that? You can read here:
about TX lines. They are driven high when not sending. There is no short because there is no path to ground. It is just high signals joined in parallel with nothing to read them. You’re blowing smoke.

I do not see what part of the page you link to is supporting your point. None of the diagrams show a TX-TX connection, and we specifically say “TX outputs… cannot simply be wired together”. Even if the lines want to go the same idle level, as soon as you try to send something on one of them, they will not be at the same level.

- Jan

They cannot simply be wired together because then you get them in parallel and cannot read the data. You use an AND gate in that case so the line can be driven low, not because there is a short if you don’t. If either Tx line has a path to ground, then there is a short in it before it is connected to anything else. If neither has a path to ground, there is no short if they are connected. Tx to Tx makes data unreadable, but it is absolutely not a short. This is not theory; I have decades of experience with serial devices. The early modems were the worst about not being standard. Some were DCE, some DTE. You would try one cable and if necessary the other (a null modem and a straight cable). Same is true in TTL. Go talk to one of your engineers.

A digital output is a direct connection to VCC or GND (through a FET), depending on whether the pin is driving high or low. When you connect a digital output driving high to one driving low, you have a short from VCC to ground, and this can certainly break things. Unless you are exceptionally careful and know what you’re doing, connecting two digital outputs together is terrible engineering and you should not be surprised or outraged if the part doesn’t survive. The second you tried to transmit data, you had a digital output driving low shorted to a digital output driving high (ground was shorted to VCC through the two pins)

This isn’t a definitive source by any means, but you might find it slightly informative: why can’t you connect outputs of a logic circuit together.

- Ben

That second never occurs in this situation, so the conjecture about what might happen is just intellectual flatulence. It is obvious you think I am incompetent and we will both be happier if I buy elsewhere.

Shorting TX to TX is bad in theory and in practice, and if your chip is damaged, this could very well be an instance of it being bad in practice. It sounds like the experience you’re talking about is with consumer devices that might have additional protection built in; here, we’re talking about direct connections to a chip.

Regarding your reply to Ben, if you never tried to transmit data, how did you perform your loopback test?

- Jan

I think this kind of attitude is probably why you keep breaking things.

You should go look at the comments on your Colorado competitor’s similar component. One of the first ones is about how easy it is to get confused and suggests swapping 2 & 3 to figure it out. I was hooking up one of their modules without the DB9 and I did have the RS-232 TX/Rx backwards for a second or two, but as has always been my experience (as well as that of others, obviously) it did no harm. When I swapped the other way it worked like a champ. My attitude is a lot better with working parts.

No one is saying you’re the first one to be confused by this. We’re just saying that the “try whatever” approach is poor, and you should not be surprised or outraged when it results in damaged components.

- Jan

An acquaintance that is a full engineer tells me that we are both right. He said there is no way that having same voltage level Tx and Rx switched should kill anything, but I have admitted to doing something that isn’t best practice so he would not expect a hardware vendor to provide a replacement.

This statement is true, but because it relies on the assumption that you had the same voltage level on the two Tx pins, I don’t think it applies to your situation. As soon as you tried to perform the loopback test (the one you mentioned in your first post), the pins were not at the same voltage level. For the start bit and every 0 bit in the byte you tried to send, the FTDI TX pin was driving low while the 23201a TX pin was driving high. And even if you didn’t perform the loopback test, the two outputs might not have been at the same voltage level, depending on how you powered things (e.g. you could have been shorting a 3.3V supply to a 5V supply, which can just as easily break things). If you ask your friend whether connecting two outputs together that are at different voltage levels can damage anything, what does he say?

- Ben

That’s not a relevant question. there was only one pin supplying voltage. He and I were discussing what actually happened, not hypothetical situations.

No, you and he were discussing an idealized scenario, and given the description of what you did, it is almost certainly not applicable to your situation. Your device apparently broke, so can’t you see how unlikely it is that you were using it in an ideal way? Instead of stubbornly clinging to the position that you did nothing wrong when even your friend says your approach was poor, you should be trying to understand what might have gone wrong, which would entail asking someone whose opinion your respect (it doesn’t seem like we fall under that category) what kind of things could damage a device. You did connect two outputs together (two pins were “supplying voltage”), and you should be willing to consider the possibility that both were not at the same voltage level. Such a consideration is not intellectual flatulence, it’s the likely explanation for your problem. If you’re not willing to talk to your friend about this, it makes it seem like you’re not serious about understanding what happened and would rather just find support for your position that the product itself is at fault.

Also, you keep contradicting yourself, which makes it sound like you have no idea what you did. In your first statement, you said you conducted a loopback test while trying both possible connection scenarios:

Now you’re saying you did not conduct a loopback test with TX connected to TX? Which is it?

Do you not believe me when I say that transmitting data with TX connected to TX means that there was a time when both outputs were not at the same voltage level? Can you tell your friend exactly what you did (e.g. have him read your opening post) and ask him if you ever had two outputs connected together that were not at the same voltage level? I think he’ll tell you that my question is completely relevant and that you and he were not discussing what actually happened. There’s a reason why your friend says that connecting two outputs is “not the best practice”.

- Ben

In my 3 decades of experience with serial connections, I have often encountered devices that were not clearly identified as DTE or DCE and the approach has always been to try the cable that seems most logical first and then try one with 2 & 3 (Tx and Rx or visa versa) swapped. Not one ever has had a problem. What my friend said was that even though he knows that you can swap serial data lines like that and not have problems, it is not best practice to ever use trial and error and that if you let a vendor know you did, the vendor will have the right to refuse to back his product. So he agrees with us both in that he agrees with me that it was DOA, but he agrees that you have an out and don’t have to back your product because I did a harmless trial and error test.