Author Topic: Multiple Links - Same Serial Port - Possible?  (Read 25666 times)

RocketMan

  • Member
  • ***
  • Posts: 6
Multiple Links - Same Serial Port - Possible?
« on: November 04, 2010, 09:41:03 pm »
Forgive the newbie question...  I'm new to digital interfacing.   ;D

I want to put together a system that communicates serially through both a radio-modem link and an RS-485 cable link.  I would *like* to be able to connect both interfaces to the same serial port, but I'm concerned that one will interfere with the other.  If serial data from both the wire link and the wireless link are received at the same time, I'm guessing that the data to the serial port will become garbled...

Since I only have one serial port to play with, I need a little more versatility.

Is there a way to allow two interface devices to share the same serial port?  I would *really* like to be able to send the data out on both links simultaneously, but need a way to keep the received data from colliding.


Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Multiple Links - Same Serial Port - Possible?
« Reply #1 on: November 05, 2010, 09:26:07 am »
RS-485 is intended for multiple-node serial networks. The network must support a protocol that tells each node when it can transmit and when to ignore or accept received data.

Other options are to add another serial port, a USB virtual COM port, or a serial/Ethernet bridge.

RS-485 info
http://www.janaxelson.com/serport.htm#articles

serial/Ethernet bridges
http://www.janaxelson.com/ethernet.htm

Jan
« Last Edit: June 27, 2015, 09:49:34 am by Jan Axelson »

RocketMan

  • Member
  • ***
  • Posts: 6
Re: Multiple Links - Same Serial Port - Possible?
« Reply #2 on: November 05, 2010, 06:12:34 pm »
Sorry - I don't think I made my intentions clear...

I'm using an 8051 variant in my control system - I want to have a remote link that communicates over an RF modem and an RS-485 link simultaneously.  Transmitting data from the 8051 isn't difficult - just tie the Data-Transmit pin of the 8051 to the D-In pin of both devices.  But if I tie the Data-Receive pin of the 8051 to the D-Out pin of both devices in a similar manner, won't the colliding signals interfere with one another...?

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Multiple Links - Same Serial Port - Possible?
« Reply #3 on: November 06, 2010, 12:53:35 am »
RS-232 is electrically designed to link two devices.

If you want two serial ports, add a port in hardware or firmware.

If you have an SPI port, see the MAX3110E chip.

Jan


RocketMan

  • Member
  • ***
  • Posts: 6
Re: Multiple Links - Same Serial Port - Possible?
« Reply #4 on: November 06, 2010, 09:16:50 am »
I thought so...   ;D  I think what I'll do is add a switch, since the 8051 I have only implements one serial port.  Send to the radio link first - and if it fails to get a response, switch over to the RS-485 link and try again.  If THAT fails, register a fault...

Guido Koerber

  • Frequent Contributor
  • ****
  • Posts: 72
Re: Multiple Links - Same Serial Port - Possible?
« Reply #5 on: November 06, 2010, 03:30:40 pm »
If it is OK with you to always transmit on both media you may just use a mux for the receive data.

RocketMan

  • Member
  • ***
  • Posts: 6
Re: Multiple Links - Same Serial Port - Possible?
« Reply #6 on: November 06, 2010, 11:20:05 pm »
Considered that... but that brings up the question of losing responses because you have to switch from one to the other.  If you transmit on both, but only look at one for a reply, you may miss that the reply came in on the other link.

Probably better to switch both...