Maker Pro
Maker Pro

RS232 & Crossing RX/TX Lines

Hi Folks!

I'm putting the finishing touches on a custom board and I've got more/less two more circuits to lay out. One of them is a serial communications circuit.

The question I have is probably a simple one - when to cross the RX & TX lines.

In my overall circuit it works like this;

WiFi Module (TTL) => MAX232 Chip => Serial TX & RX inputs at the destination.

Now I know you have to cross the TX & RX lines to get it to work but the question is where?

For instance, should the TX & RX lines from the TTL module be crossed before going into the MAX 232?
Should they be crossed when they leave the MAX 232 for their final destination?

In my mind they should not be crossed until reaching their final destination but I can't seem to shake the feeling that this might be wrong. Can anyone set my mind at ease with a definitive answer so I can complete this circuit?
 

KrisBlueNZ

Sadly passed away in 2015
You need to work it out based on the direction of data flow.

A MAX232 contains transmitters, which take a logic-level signal and retransmit it at RS-232 levels, and receivers, which take an RS-232-level signal and convert it to logic levels. Therefore the "output" data from your WiFi module needs to feed into to a transmitter in the MAX232, whose output goes to an RS-232 input, and the "input" data going into your WiFi module needs to be driven by a receiver in the MAX232, whose input is driven from an RS-232 output.

WiFi module TTL output --> MAX232 transmitter --> RS-232 data input at destination
WiFi module TTL input <-- MAX232 receiver <-- RS-232 data output from destination
 
Connect the T1IN and R1OUT to the TTL device TX and RX
Connect the T1OUT and R1IN to the RS232 device RX and TX

Bob
 
Thanks all for the replies!

Let's see if I've got it right (I get confused on this stuff in the same way that I get confused by the reversing of chips mounted to the backside of the board - these are danger areas for me where I tend to screw them up badly );



RS232 Lines.gif
Hopefully that's correct? This is a prototype board that I'm going to get made in short order so I'm hoping to eliminate as many foreseeable issues as I can before I cross my fingers and pull the trigger!

As always, MANY thanks for the input (pardon the pun) :)
 
Thanks Kris! When I look at it now, it actually makes sense to me. I think that knot in my forehead was me learning something new :)

Further confirmation is that it uses pins 11,12,13 & 14 - that's got to be by design :)
 
Last edited:
Of course you could always put in pin strip headers and use jumpers to make the connections, just in case. :)
 
Oh, I don't know - I just followed your advice - I'm sure it's good ;)

Just kidding, well, in some ways. When I looked at what you said and then drew out the diagram it became clear(er) to me how the underlying circuit should work. This is what I was missing when I first posted. Then, when I saw that the lines all meet up in order on the MAX232 (11,12,13 &14) it really served as a confirmation. Even so, after seeing your post above I revisited the design once more (today - after it sat for a while) and I'm sure it's correct. I feel comfortable with sending the board out for prototype manufacturing. And hey, if something unforeseen comes up (I can't see it) it's on me - not you :)

To change tracks slightly, I noticed that the MAX232 chip I'm using is a 'dual-channel' chip. I'm assuming then that you can have two devices going through it? In my case one is the WiFi module and what I am trying to add in as well is a USB chip. The idea being that a person can connect either through WiFi or USB. To that end I'm looking at integrating a FT232RL chip :)
 

KrisBlueNZ

Sadly passed away in 2015
Yes, the MAX232 has two drivers and two receivers. Often the second transmitter and the second receiver are used for flow control signals (DSR/DTR, RTS/CTS etc) for the same device, but you can use them for two separate devices if each device only needs TXD and RXD.
 
OK, so here's a thought. The WiFi is there so that I can access the system board. I'm currently using BlueTooth but I would like the extra range that WiFi offers. I'm satisfied that the design will work as laid out on the WiFi side. So, it looks like a successful migration from BT to WiFi which is great!

Then I was thinking, I really should add USB in case something happens to WiFi or the end user prefers USB or whatever. So we know that the RS232 will support a second channel. I do have a roughed in schematic for adding in the FT232RL USB chip and I'm pretty sure it will work.

This leads me to wonder if I can literally just add in USB and if the person plugs in with USB - it will work, and if the person uses WiFi it will work. I guess my concern is (and it may well be unwarranted) is that if the person is using WiFi - would USB interfere at all - or vice versa. I don't know if it's a question that can be answered other then by trying it.
 
Well guys, in the end I went with being able to run BlueTooth and Wifi with the idea that BT was just a backup. It turned out to be handy, to do the initial flash I needed BT but after that, and some monkeying around, WiFi was active and it's been great ever since. The range requirement was met, it's considerably better then BT, and if I want to run an external antenna I can increase it again so there's freedom there.

The RS232 help you guys provided was spot on, before having the proto boards made I knew, for a fact, that the RS232 circuit was correct!

I'm now troubleshooting implementation issues but once more, you guys not only moved me further along with the right answers but I learned something too. Many thanks, this is a really great site, it looks fantastic, and the email had many things of interest in it too. Don't change a thing!
 
Top