Serial port multiplexing? How to?

Started by ElderUberGeek July 3, 2007
Hi. I have only one available UART on a micro but need to connect two
serial devices (chips on the same board). Is there some type of chip
that can be used that will accept two serial inputs and then I can use
a GPIO pin to switch between the sources? The two serial sources need
not be used together (meaning when one is being used, the other is not
required).

Thanks

ElderUberGeek wrote:

> Hi. I have only one available UART on a micro but need to connect two > serial devices (chips on the same board). Is there some type of chip > that can be used that will accept two serial inputs and then I can use > a GPIO pin to switch between the sources? The two serial sources need > not be used together (meaning when one is being used, the other is not > required).
A HC4052 will MUX expand up to 4 channels, two ways. More than 4 would need a MUX & Demux in separate packages, or a SPLD, like a 16V8. The SPLD can priority encode the RX, into an INT pin, so any RX start bit, can wakeup the uC, and select that channel, as well as do the TX/RX Mux. -jg
ElderUberGeek wrote:
> Is there some type of chip > that can be used that will accept two serial inputs and then I can use > a GPIO pin to switch between the sources?
Yes, but it depends on what you want to do. I feel that you have not given enough detailed information. A good starting point might be the MAX 393. -- Torbjørn Heltne
In comp.arch.embedded,
ElderUberGeek <aribloch@gmail.com> wrote:
> > Hi. I have only one available UART on a micro but need to connect two > serial devices (chips on the same board). Is there some type of chip > that can be used that will accept two serial inputs and then I can use > a GPIO pin to switch between the sources? The two serial sources need > not be used together (meaning when one is being used, the other is not > required).
If you can leave both connected to Tx, you can switch Rx with a single 7400. If your Rx's remain quiet when not in use and they are open drain, you can just connect them together. Both assuming you are dealing with logic levels. -- Stef (remove caps, dashes and .invalid from e-mail address to reply by mail)
If you have 2 spare GPIO you can implement it in software.


"ElderUberGeek" <aribloch@gmail.com> wrote in message
news:1183454182.314158.61410@g37g2000prf.googlegroups.com...
> > Hi. I have only one available UART on a micro but need to connect two > serial devices (chips on the same board). Is there some type of chip > that can be used that will accept two serial inputs and then I can use > a GPIO pin to switch between the sources? The two serial sources need > not be used together (meaning when one is being used, the other is not > required). > > Thanks >
I used a 74126, but it was not so intuitive as both TX and RX must stay high while idle. When you switch one of the sources off you have to make sure it doesn't pull the line down. (we're talking about 0/5V) A relay works either.
In article <1183454182.314158.61410@g37g2000prf.googlegroups.com>, 
aribloch@gmail.com says...
> > Hi. I have only one available UART on a micro but need to connect two > serial devices (chips on the same board). Is there some type of chip > that can be used that will accept two serial inputs and then I can use > a GPIO pin to switch between the sources? The two serial sources need > not be used together (meaning when one is being used, the other is not > required). > > Thanks
In a similar situation, I used at TI TS3L110DR IC LAN switch. It's basically a quad 1 of 2 multiplexer with the added advantage that the ports are bidirectional. Mark Borgerson
ElderUberGeek wrote:
> Hi. I have only one available UART on a micro but need to connect two > serial devices (chips on the same board). Is there some type of chip > that can be used that will accept two serial inputs and then I can use > a GPIO pin to switch between the sources? The two serial sources need > not be used together (meaning when one is being used, the other is not > required).
As has already been said, "You haven't provided enough information." If the two chips need to communicate to each other, and one needs to communicate with the outside world but the other does not, then look at an SPI between the chips. Is likely your MCUs already have SPI modules, if not its terribly easy to make in software. Especially easy when you are writing both ends. If both MCUs need to communicate to the outside world, consider daisy chaining. Connect one to the RxD coming in, its TxD to the other MCU's RxD, and the 2nd MCU's TxD to the outgoing TxD. The first MCU keeps everything it recognizes and passes the rest and new data it has created to the second. The second MCU keeps everything it recognizes and passes the rest to the outside connector while possibly adding some new data. Daisy chaining requires no additional hardware, only a bit of software.
On 3 Jul, 10:16, ElderUberGeek <aribl...@gmail.com> wrote:
> Hi. I have only one available UART on a micro but need to connect two > serial devices (chips on the same board). Is there some type of chip > that can be used that will accept two serial inputs and then I can use > a GPIO pin to switch between the sources? The two serial sources need > not be used together (meaning when one is being used, the other is not > required). > > Thanks
If both dont communicate at same time a simple and gate would do the trick.
"Marra" <cresswellavenue@talktalk.net> wrote in message 
news:1183506500.717357.187590@o61g2000hsh.googlegroups.com...
> On 3 Jul, 10:16, ElderUberGeek <aribl...@gmail.com> wrote: >> Hi. I have only one available UART on a micro but need to connect two >> serial devices (chips on the same board). Is there some type of chip >> that can be used that will accept two serial inputs and then I can use >> a GPIO pin to switch between the sources? The two serial sources need >> not be used together (meaning when one is being used, the other is not >> required). >> >> Thanks > > If both dont communicate at same time a simple and gate would do the > trick. >
Simpler than that.... a few diodes as he doesn't have concurrent I/O conflicts....Rxd on Micro may need a pullup... Tx1 -I<I------I------ RXd on Micro I Tx2 -I<I------I Tx on Micro---I-------Rxd1 I------Rxd2
Hi,
I Have the same requirement of demultiplexing one serial port into
multiple, and one of the serial port should be selected depending on the
input select signals. I used 74HC4051 8 channel multiplexer or
demultiplexer. It can be applied to both analog and digital multiplexing
and demultiplexing. 
I used the GPIO pins for the select signals (s0,s1,s2) and the enable
pin.
and i have given the TX pin of my device to Z input. 

But, unfortunately the data is coming on all the output pins of 74hc4051
IC.
Is there any other way of demultiplexing the TX and multiplexing the RX
pin.

Any suggestions would be appreciated.

Thanks,
somu. 


In article <KpCdnZWfD_Z_GBDbRVnyiQA@pipex.net>, 
steve@NOSPAMTAfivetrees.com says...
> TT_Man wrote: > > "Marra" <cresswellavenue@talktalk.net> wrote in message > > news:1183506500.717357.187590@o61g2000hsh.googlegroups.com... > >> On 3 Jul, 10:16, ElderUberGeek <aribl...@gmail.com> wrote: > >>> Hi. I have only one available UART on a micro but need to connect > >>> two serial devices (chips on the same board). Is there some type of > >>> chip that can be used that will accept two serial inputs and then I > >>> can use a GPIO pin to switch between the sources? The two serial > >>> sources need not be used together (meaning when one is being used, > >>> the other is not required). > >>> > >>> Thanks > >> > >> If both dont communicate at same time a simple and gate would do the > >> trick. > >> > > Simpler than that.... a few diodes as he doesn't have concurrent I/O > > conflicts....Rxd on Micro may need a pullup... > > > > Tx1 -I<I------I------ RXd on Micro > > I > > Tx2 -I<I------I > > > > Tx on Micro---I-------Rxd1 > > I------Rxd2 > > If you're dealing with a breadboard, maybe. For a product, in SMT, not > so sure. One logic device may be cheaper to put down (and allow a more > reliable design) than a handful of diodes. > > To the OP: if your protocol is master/slave, and you can guarantee no Rx > unless your Tx demands a response, then just mux both at the UART I/O. > If you have multiple possible concurrent Rx sources, you're out of luck. > UART the fastest and bit-bang the slowest. > >
That's a good point. When I muxed my serial port, one device was a satellite transceiver that had it's own buffer, and was primarily a send-only device. The other device was a GPS, which I could set up once at the beginning and read at any time. I only needed the GPS data about once each 5 minutes, as oceanographic buoys aren't supposed to move too far in that time frame. They were much better candidates for multiplexing than the control console port, which could receive user input at any time. Mark Borgerson
TT_Man wrote:
> "Marra" <cresswellavenue@talktalk.net> wrote in message > news:1183506500.717357.187590@o61g2000hsh.googlegroups.com... >> On 3 Jul, 10:16, ElderUberGeek <aribl...@gmail.com> wrote: >>> Hi. I have only one available UART on a micro but need to connect >>> two serial devices (chips on the same board). Is there some type of >>> chip that can be used that will accept two serial inputs and then I >>> can use a GPIO pin to switch between the sources? The two serial >>> sources need not be used together (meaning when one is being used, >>> the other is not required). >>> >>> Thanks >> >> If both dont communicate at same time a simple and gate would do the >> trick. >> > Simpler than that.... a few diodes as he doesn't have concurrent I/O > conflicts....Rxd on Micro may need a pullup... > > Tx1 -I<I------I------ RXd on Micro > I > Tx2 -I<I------I > > Tx on Micro---I-------Rxd1 > I------Rxd2
If you're dealing with a breadboard, maybe. For a product, in SMT, not so sure. One logic device may be cheaper to put down (and allow a more reliable design) than a handful of diodes. To the OP: if your protocol is master/slave, and you can guarantee no Rx unless your Tx demands a response, then just mux both at the UART I/O. If you have multiple possible concurrent Rx sources, you're out of luck. UART the fastest and bit-bang the slowest. Steve http://www.fivetrees.com
"Marra" <cresswellavenue@talktalk.net> wrote in message 
news:1183506500.717357.187590@o61g2000hsh.googlegroups.com...
> On 3 Jul, 10:16, ElderUberGeek <aribl...@gmail.com> wrote: >> Hi. I have only one available UART on a micro but need to connect two >> serial devices (chips on the same board). Is there some type of chip >> that can be used that will accept two serial inputs and then I can use >> a GPIO pin to switch between the sources? The two serial sources need >> not be used together (meaning when one is being used, the other is not >> required). >> >> Thanks > > If both dont communicate at same time a simple and gate would do the > trick. >
Simpler than that.... a few diodes as he doesn't have concurrent I/O conflicts....Rxd on Micro may need a pullup... Tx1 -I<I------I------ RXd on Micro I Tx2 -I<I------I Tx on Micro---I-------Rxd1 I------Rxd2
On 3 Jul, 10:16, ElderUberGeek <aribl...@gmail.com> wrote:
> Hi. I have only one available UART on a micro but need to connect two > serial devices (chips on the same board). Is there some type of chip > that can be used that will accept two serial inputs and then I can use > a GPIO pin to switch between the sources? The two serial sources need > not be used together (meaning when one is being used, the other is not > required). > > Thanks
If both dont communicate at same time a simple and gate would do the trick.
ElderUberGeek wrote:
> Hi. I have only one available UART on a micro but need to connect two > serial devices (chips on the same board). Is there some type of chip > that can be used that will accept two serial inputs and then I can use > a GPIO pin to switch between the sources? The two serial sources need > not be used together (meaning when one is being used, the other is not > required).
As has already been said, "You haven't provided enough information." If the two chips need to communicate to each other, and one needs to communicate with the outside world but the other does not, then look at an SPI between the chips. Is likely your MCUs already have SPI modules, if not its terribly easy to make in software. Especially easy when you are writing both ends. If both MCUs need to communicate to the outside world, consider daisy chaining. Connect one to the RxD coming in, its TxD to the other MCU's RxD, and the 2nd MCU's TxD to the outgoing TxD. The first MCU keeps everything it recognizes and passes the rest and new data it has created to the second. The second MCU keeps everything it recognizes and passes the rest to the outside connector while possibly adding some new data. Daisy chaining requires no additional hardware, only a bit of software.
In article <1183454182.314158.61410@g37g2000prf.googlegroups.com>, 
aribloch@gmail.com says...
> > Hi. I have only one available UART on a micro but need to connect two > serial devices (chips on the same board). Is there some type of chip > that can be used that will accept two serial inputs and then I can use > a GPIO pin to switch between the sources? The two serial sources need > not be used together (meaning when one is being used, the other is not > required). > > Thanks
In a similar situation, I used at TI TS3L110DR IC LAN switch. It's basically a quad 1 of 2 multiplexer with the added advantage that the ports are bidirectional. Mark Borgerson
"ElderUberGeek" <aribloch@gmail.com> wrote in message
news:1183454182.314158.61410@g37g2000prf.googlegroups.com...
> > Hi. I have only one available UART on a micro but need to connect two > serial devices (chips on the same board). Is there some type of chip > that can be used that will accept two serial inputs and then I can use > a GPIO pin to switch between the sources? The two serial sources need > not be used together (meaning when one is being used, the other is not > required). > > Thanks >
I used a 74126, but it was not so intuitive as both TX and RX must stay high while idle. When you switch one of the sources off you have to make sure it doesn't pull the line down. (we're talking about 0/5V) A relay works either.
If you have 2 spare GPIO you can implement it in software.


In comp.arch.embedded,
ElderUberGeek <aribloch@gmail.com> wrote:
> > Hi. I have only one available UART on a micro but need to connect two > serial devices (chips on the same board). Is there some type of chip > that can be used that will accept two serial inputs and then I can use > a GPIO pin to switch between the sources? The two serial sources need > not be used together (meaning when one is being used, the other is not > required).
If you can leave both connected to Tx, you can switch Rx with a single 7400. If your Rx's remain quiet when not in use and they are open drain, you can just connect them together. Both assuming you are dealing with logic levels. -- Stef (remove caps, dashes and .invalid from e-mail address to reply by mail)