Serial Question -- TTL for RX and RS232 for TX

Hey guys... I have one for you!

I'm trying to interface with a device and noticed that the serial RX signal is TTL. So if plug in the RX and TX line into the Arduino and I get events. Now, if I try to send something I can't because the TX line needs RS232 signal. So if I plug the TX line into the RS232 TX driver I can send.

Here is the problem. If I plug the TX line into the RS232 driver and leave the RX directly to the Arudino as TTL signal, I don't get any incoming events. I can send fine but can't receive. If I plug the RX and TX directly on the Arduino again I can receive but not send. Once I remove the TX from the Arduino it floats and I start getting a bunch of 0's and noise. Do I need some kind of pull up/down resistor to make this work with both.

I need a solution when I can keep the RX line connected to the serial RX on the Arduino and the TX line through a TTL to RS232 driver. Any suggestions?

Hi Richard,

Not sure how much more I can describe. But I'll try...

The incoming wires (tx/rx) come in via RJ45 Jack - don't have circuit detail of this device trying to figure out. I took the blue wire which is the RX and plugged it into the Mega board serial 1 rx. Connecting blue & white wire to tx pin on mega. Writing a simple when serial.available loop receives data fine since the incoming data is TTL based.

If I remove the TX line... The rx signal seems to float because I get weird values coming in when there shouldn't be. Problem is keeping the tx line connected to ttl doesn't work because it needs rs232 signal. So if I plug the tx line into a TTL to rs232 converter (max232) it can send data however keeping the rx plugged into the arduino I no longer receive.

Does that help more?

I think you are confused over what needs what. If you have an RS232 device you will need to convert it to TTL both on the RX and the TX. Not only is there a voltage change but also a logic inversion. You can plus an RS232 output into an arduino input and appear to get something. However that something will be rubbish and also will be over stressing the output.

By inference:

  • As the RCV works fine, there is no level inversion.
  • As there is no magic smoke, it is most likely 5V
  • The needed connection to TX indicates an ad-hoc ground to low-level.
    This will be disturbed by sending characters, with the reported results.
  • As Mike and Richard pointed out, there is no such thing receiving with one level and sending with another.
    Also the unusual connector is an indicator for non-RS232.

So simply find out what line is ground, and connect it correctly.

  • As there is no magic smoke, it is most likely 5V

There have been quite a few cases reported here where people have connected an RS232 TX directly to the arduino's input. The result is they think the characters being received are strange.

No smoke issues and it works when they feed it the right voltage the right way up. It looks like something is saving them from their errors but I don't know what.

There really is no magic here... I'm trying to figure out a proprietary communication protocol. The model is that you can loop in and out essentially allowing unlimited devices to share the "serial" data. So keeping the rx as TTL 5v makes sense as the receeving devices can Listen and the tx line makes sense being rs232 signal because having a buffer is important. I never said this is a regular rs232 or ttl device... If that were the case I would have had it working.

As I stated, I did not connect anything I have not posted about. I simply use a prebuilt ttl to rs232 converter. For the tx side which is powered and connected to gnd on the arduino. The device is not connected to gnd of the ardunio.

I did not connect gnd. That could be my problem. I'll test and report back.

The amazing part at this point is that you got this far without the grounds connected together.

Not really... He needed the - as I called it - "ad-hoc" ground from the RX low pin of the Arduino.

So keeping the rx as TTL 5v makes sense as the receeving devices can Listen and the tx line makes sense being rs232 signal because having a buffer is important.

This still makes little sense to me.
You have three ingredients here:

  • 0/5V vs. +/- 15V
  • Signals inverted vs. signals proper
  • Push/pull vs. Open Collector

This is how I currently have it connected:

RX TEST: When plugged in as follows I get correct RX values but cannot send

RX PIN FROM DEVICE > MEGA RX1 (confirmed this is TTL 5v signal)
TX PIN FROM DEVICE > MEGA TX1 (confirmed this is RS232 as the device responds when I send data to it)
GND PIN FROM DEVICE > MEGA GND (which seems to not affect anything when plugged in)

TX TEST: When plugged in as follows I can TX correctly but cannot receive

RX PIN FROM DEVICE > MEGA RX1 (confirmed this is TTL 5v signal)
MEGA TX1 > TX INPUT OF RS232 Shield (MAX232) > TX PIN OF DEVICE TO PIN 2 OF DB9
GND PIN FROM DEVICE > MEGA GND (which seems to not affect anything when plugged in)

Also note:

  • If I remove the TX PIN FROM DEVICE (PIN 2 OF DB9) signal floats and I get a bunch of weird data

So my only option is to add some switching circuitry (transistor) to make it so when sending I switch to the RS232 driver and when done, I switch back to the TX1 Pin of the Mega. I wonder if that is by design so the device can only send or receive but not both at the same time? Not 100% sure because I don't have their design, but it seems like the only logical method to make this work. Unless you guys see something I may be missing...

Richard,

I appreciate all your help and feedback on this however, you are assuming I have the source design! I have said it numerous times that I do not have the source schematic diagram so I am running blind here. I am trying to FIGURE OUT what they are doing. I cannot get access to the schematic or port details so I'm trying to figure it out.

That being said, you don't need to worry about DB9 and RJ45 ... just what is coming from them. I have connected every other wire coming from the device and the GND does not affect anything, thus my conclusion that they are doing something unorthodox given the mixing of TTL and RS232 hence a "proprietary connection".

The only thing I have that are KNOWNS are exactly what I have written:

  • RX from device is TTL
  • TX to device is RS232
  • Connecting the RX and TX wires to Arduino Serial receives data perfectly (but cannot send)
  • Removing the TX wire causes RX signal to float (as you asked why do I connect the TX when testing RX -- this is why)
  • Connecting device "GND" does nothing
  • Connecting the TX line into RS232 driver (TX pin 2 on RS232 shield) sends data perfectly however cannot receive anything via TTL when connected.

That is all I have... there is no schematic diagram unless you want the Arduino and/or the RS232 shield which is available here: http://www.cutedigi.com/pub/Arduino/arduino_RS232.pdf ... I'm just plugging wires from the source device via trial and error and have found everything I need -- RX and TX the problem is I cannot use both at the same time -- could be by design, hence my question to people with more experience. I just used my troubleshooting skills to come up with this.

Again, I do not have the source schematic, I repeat, I do not have the source schematic thus I'm trying to figure it out. I think I'm almost there... however, doing a switching model is not ideal, I'd like to just be able to use RX and TX at the same time.

Frankly, I don't think you have the RX, TX, and GND identified properly from the mystery source device. I'd bet even money that you have GND confused with either TX or RX.

Could be the case, I will look at this again!

Since I'm dealing with a "Proprietary Connection" (not Apple or MSFT -- I am the first one to do this based on the company) I'd rather not disclose the device as I'm also trying to go down the legit path of obtaining the details. I'm asking here on the basis of understanding what could be causing the issue.

Any way to detect this besides just plugging wires and testing like I did? What are the best tools to do this?

  1. "Just plugging in wires" is a dangerous method. You are lucky you haven't destroyed the serial interface of the mystery box.
  2. What is powering the mystery box? Are there any other electrical connections to it? Specifically, is there anything that might be GND? Use your meter and try to see which wire seems to be connected to GND.
  3. Can you look inside the mystery box? Can you trace the wires back to whatever chip they are using to drive the serial port?
  1. Yes I know, but I'm a professional :wink:
  2. I've determined it is ground by the basis of the color coding used on other devices used with the system and connection - however, i will dig deeper
  3. Yes, that is my next step, was taking the lazy route of not having to take another device apart. I felt like I got close enough -- maybe I was wrong. :-/

Any way to detect this besides just plugging wires and testing like I did?

But did you? There have been three wires to be identified.
(1) Ground. This device must be powered somehow. Ground should show a stable 0V WRT the power supply ground.
(2) Transmit (from the point of that device) That can be toggling, it depends on the activity of the device. As you said you have already received somthing useful, this is easy!
(3) Receive (from the point of that device) That is (can be) a high impedance input. It should NOT read 0V but some100 milivolts. You can further check be pulling it up and down with a 10k resistor, and you should have 0V and 5V there.

Note: Those hints base on the assumption that there is no RS232 interface involved.

But did you? There have been three wires to be identified.
(1) Ground. This device must be powered somehow. Ground should show a stable 0V WRT the power supply ground.
(2) Transmit (from the point of that device) That can be toggling, it depends on the activity of the device. As you said you have already received somthing useful, this is easy!
(3) Receive (from the point of that device) That is a (can be) a high impedance input. It should NOT read 0V but some100 milivolts. You can further check be pulling it up and down with a 10k resistor, and you should have 0V and 5V there.

Note: Those hints base on the assumption that there is no RS232 interface involved.

  1. Ground - I will verify GND for sure -- this is my next task. I only have 8 wires to check... probing another device revealed that only 3 pins were actually connected to the RJ45 to traces.
  2. TX (from the point of device) works stable only when RX from device is also plugged into the Arduino serial. (as stated before)
  3. RX (from the point of the device) -- this is the real unknown. I have successfully sent a command only when sending it RS232 signal from the Ardunio. Sending TTL directly does nothing.

Also, why do you guys think that a Half-duplex model would not be a possible source design for RX/TX? Could it be that bringing Arduino TX LOW sets the receiver in source device to RX mode and TX HIGH in TX mode? Maybe that is by design of the source device to keep an endless loop from potentially happening and keeping a device from sending data while receiving, etc.? Reason why I thought of this is because data lines can be daisy-chained and a half-duplex model seems more fitting. Just a thought.

Well... took a device apart... looks like they are using a MAX3082 (RS422) driver... no clue why it's working. guess because it has failsafes (Mixed-signal and digital signal processing ICs | Analog Devices)

Also, the MAX3082/MAX3085/MAX3088 are intended for halfduplex communications....

These devices feature fail-safe circuitry, which guarantees a logic-high receiver output when the receiver inputs are open or shorted. This means that the receiver output will be a logic high if all transmitters on a terminated bus are disabled (high impedance).

Still unclear why it works using TTL and RS232 but I'll stick with RS422 to keep things "in spec".

Agree. Just ordered some more parts... I'll report back how it turns out. Thanks again!

Agree with that

Got it working with rs422... Thanks.