Multiple RS232 devices on same wire pair

Discussion in 'The Projects Forum' started by El3ctroded, Jan 15, 2010.

  1. El3ctroded

    Thread Starter Active Member

    Feb 4, 2008
    63
    0
    I have a project where I need one board, lets call it the master, that can communicate via rs232 to multiple slaves. The slaves must each be able to receive and transmit, but only to the master, and only when first addressed by the master. Thus I have connected it this way:
    Code ( (Unknown Language)):
    1.  
    2. Master    Slave1    Slave2
    3. TxPin-----RxPin-----RxPin
    4. RxPin-----TxPin-----TxPin
    5. Gnd-------Gnd-------Gnd
    6.  
    I have the code completed and some prototypes, and it all works except one thing. If I have more than 1 slave board connected, slave transmissions fail. This is because the MAX232 chips on the slave boards hold the slave's transmit pin (and thus the Master's Receive Pin) at -5.4V (RS232 output when idle) such that the other slave cannot send data.

    So what's the best method of countering this problem? There's no way to turn off the transmit pin of the MAX232 chip. So I need a switch of some sort on the MAX232 txout pin. This is tricky for me because the microcontroller and other devices work at 3.3V.

    Thanks!
     
  2. El3ctroded

    Thread Starter Active Member

    Feb 4, 2008
    63
    0
    Looks like a simple diode and resistor does the trick LOL!
    Code ( (Unknown Language)):
    1.  
    2. Slave board's TxPin----|>|---Bus---+--Master
    3. Pulldown to -5.4-----VVV-----------|
    4.  
    The pulldown is on the Master board, not the slaves, and I get the -5.4 from the second txout pin on the master's MAX232.
     
    Last edited: Jan 15, 2010
  3. JDT

    Well-Known Member

    Feb 12, 2009
    658
    85
    RS232 is not really supposed to work this way. Because it has separate transmit and receive lines.

    A better way is to use RS485. This has a single twisted pair with terminating resistors at the far ends. Many devices can be connected along the line.

    You still have to make sure, with some knd of protocol, that only 1 device is transmitting at any time. The transmitters of all the other devices are disabled. All the receivers are always listening. See:-

    http://focus.ti.com/lit/ds/symlink/sn65176b.pdf
     
  4. El3ctroded

    Thread Starter Active Member

    Feb 4, 2008
    63
    0
    Thanks. That would work better, but it requires extra control lines, and on my master board I'm out of IO Pins...

    No, with RS232 on this particular system I don't have to make sure that only 1 slave is txing because a slave can never initiate communication, the master will never talk to more than 1 slave at a time, and there is significant time lag (10sec or more) between communication with each slave. Each slave should be assigned a unique address. The only time a collision can occur is if two slaves are addressed the same, at which point I want communications to fail because it isn't setup right ;)
     
  5. eblc1388

    Senior Member

    Nov 28, 2008
    1,542
    102
    Your method is pretty much used every where when there are several slaves connected to one master.
     
  6. El3ctroded

    Thread Starter Active Member

    Feb 4, 2008
    63
    0
    Any idea how many slaves could conceivably be connected to the master before there's too much load from all the receivers? Or is cable length the larger issue?

    Typically this would have a cable run from the master 1 to 2 hundred feet, then each slave about 10 to 20feet away from each other. I'm only planning 3 to 5 slaves, but I'm curious how many I could get away with?

    Thanks!
     
  7. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
  8. hgmjr

    Moderator

    Jan 28, 2005
    9,030
    214
    Your best bet may be to use something like an RS-232 to RS-422 converter on each of the RS-232 ports. B and B Electronics has such devices.

    Once you convert to RS-422, then your distance and multidrop problems should be more managable.

    hgmjr
     
    Last edited: Mar 20, 2010
  9. El3ctroded

    Thread Starter Active Member

    Feb 4, 2008
    63
    0
    Using Cat5 I've run 100ft to a receiver, then 20ft to another and so-on for 4 receivers, no problem.

    I'm only running at 19k baud, so that probably helps. Well, I'll see what happens.
     
  10. El3ctroded

    Thread Starter Active Member

    Feb 4, 2008
    63
    0
    Now I started to have some problems when someone uses a 100' cable but coils most of it up...

    Anyway I got to looking, and I'm posting this for anyone interested.

    The reason I didn't use RS485 in the first place was that it required extra control lines from the microcontroller which I didn't have pins for. Well, I was researching them some today and stumbled upon the MAX3490. Full Duplex comms without the control lines! Wish I had known about it sooner. And for anyone who wants to know the best way to wire it using ethernet cable and connectors, wire the +tx pin to Rj45-P1, -tx to rj45-P2, +rx to rj45-P3, and -rx to rj45-P6 on the master side, and on the slave side, wire the +rx pin to Rj45-P1, -rx to rj45-P2, +tx to rj45-P3, and -tx to rj45-P6.

    El3ctroded
     
  11. BMorse

    Senior Member

    Sep 26, 2009
    2,675
    234
    I was going to put my 2 cents in here.... anyways, I just got to reading this thread, and I had a similar issue where I had 1 master and several slaves "networked" over RS232, what I did was I used the MAX235 transceiver IC to achieve multiplexing the devices.... and I also increased the range of the wiring having these devices in between....

    RS232 Multiplexer.png

    My .02

    B. Morse
     
  12. El3ctroded

    Thread Starter Active Member

    Feb 4, 2008
    63
    0
    Interesting.

    Switching to RS485 is a good move for me here... I can support more nodes and longer lines, and as an added bonus, it cut my parts count way down!

    5 caps down to 1, 16pin rs232 chip down to 1 8pin chip, 1 diode down to 0, and 2 jumper resistors (used to make same board work as master or slave swapped for a x-over ethernet cable) down to 0

    So between parts costs, assembly time, and potential future issues, I think switching will work out very well ;)
     
  13. El3ctroded

    Thread Starter Active Member

    Feb 4, 2008
    63
    0
    Ok, I finally got around to testing the new prototypes after assembling them using the RS485 parts MAX3490 (actually I used SP3490 from Sipex, but they're the same thing)

    Master talks to slave no problem, so long as there's only 1 slave wired up. As soon as I connect more than 1 slave, I get the following:
    Master can talk to any slave. None of the slaves can talk to the master. :(

    I wired it up exactly as shown in the Max3490 datasheet in Figure 22.

    Any ideas? Thanks!
     
  14. El3ctroded

    Thread Starter Active Member

    Feb 4, 2008
    63
    0
    Ugh! Talking to the application engineer at Maxim, it looks like their datasheet may be wrong. Figure 22 will only apply to the MAX3491. Unless the app engineer missed something (the part designer will let me know later) then the MAX3490 cannot handle multiple slave devices capable of transmitting. Ugh!

    Now I have to lay out the boards AGAIN costing more $ to get prototypes but this time using the MAX3491 and figure out if I can squeeze it onto the board and multiplex one of my pins on the mcu.

    Bother.
     
  15. El3ctroded

    Thread Starter Active Member

    Feb 4, 2008
    63
    0
    Update: The image is misleading. The MAX3488 and MAX3490 can NOT be used in multi-point networks. They are only for end-to-end communication. Seems the datasheet needs some clarification on both usage and Figure 22.

    Sure would be nice to have a RS485 transceiver in an 8-pin package that automatically disables it's transmitter when it doesn't have any data to transmit!
     
  16. retched

    AAC Fanatic!

    Dec 5, 2009
    5,201
    312
    Well, you think there would be an app note or something. Im SURE they tried hooking up more than 1 slave to a 3490.
     
  17. El3ctroded

    Thread Starter Active Member

    Feb 4, 2008
    63
    0
    The designer knew it was only for point-to-point, they just didn't specify in the datasheet.

    I've managed to squeeze in the 14pin Max3491 and find an IO pin I could use on the mcu to enable/disable the transmitter, so now it's back to the board house for another go.
     
  18. polleke

    New Member

    Oct 30, 2009
    3
    0
    old trick but works:
    yes the drivers are push/pull types, however with one transistor on the send parts and one resistor on the receiving master it is possible as this way it only pulls the line down.
    if connecting more receivers you can go to max 5 as master can not give more power.
    other way is to use a small relais in a control line so that way you can put one sender on the line.
     
Loading...