2 UART devices from one Port?

Thread Starter

myztic_man

Joined Apr 27, 2009
21
Is it possible to drive two devices from one UART port?
I am looking at having both my GPS module and my data logger connected using UART but my Micro (AT89C51AC3) only has 1 UART port.

Or, is there some way to use SPI as a UART?

Thanks!
 
If you are using serial RS232 communication on the UARTs between the GPS and the Micro then that is a point-to-point communication scheme, one transmit and one receive.

If you are using the data logger only to monitor the communication between the two devices, then you can use a RS232 Sniffer device to display the messages between the two devices without disrupting them.

Here is a link that shows how to connect the monitoring device to the system.

http://www.marcspages.co.uk/tech/3104.htm

Is the GPS module equipped with serial or usb communications?
 

CDRIVE

Joined Jul 1, 2008
2,219
Here is a link that shows how to connect the monitoring device to the system.

http://www.marcspages.co.uk/tech/3104.htm
Besides the good link that SAHE gave you (nice and simple), you may want to get a copy of Serial Port Complete First Edition. I used to think that serial comm was relegated to two devices (one on one) but this book demonstrates networking multiple nodes with RS232. The book includes heaps of VB6 and PIC code.
 

Papabravo

Joined Feb 24, 2006
21,159
I used a pair of MAX3100 UARTs with SPI interfaces when I ran out of UARTs. The 16-byte receive FIFO was a big help at the 38,400 bps coming from the GPS device. The Siemens cellphone module used the other one. I ended up using the onboard UART as a monitor port.
 

Thread Starter

myztic_man

Joined Apr 27, 2009
21
If you are using serial RS232 communication on the UARTs between the GPS and the Micro then that is a point-to-point communication scheme, one transmit and one receive.

If you are using the data logger only to monitor the communication between the two devices, then you can use a RS232 Sniffer device to display the messages between the two devices without disrupting them.

Here is a link that shows how to connect the monitoring device to the system.

http://www.marcspages.co.uk/tech/3104.htm

Is the GPS module equipped with serial or usb communications?
I am not simply looking to 'monitor' the data between the GPS and the Micro, as I am performing some string handling on the data, and also need to add additional data to that being recorded.

Here is how the current system operates:
GPS Rx/Tx --> Micro Tx/Rx
The Micro gets the Serial data from the GPS at 4800 baud, and performs some functions on the NMEA stings to split up the data etc.
I then want to send some data back, via UART to: http://www.4dsystems.com.au/prod.php?id=22
A small device capable of handling all the Fat16 filesystems, which will log the data.

Both the GPS, and this device operate on Rx/Tx lines - however I only have one of each of those available on my Micro.

Would it be possible to run Rx and Tx into a multiplexer which i can then control with my Micro in order to have two devices running from the same Rx/Tx lines on the Micro?
To me this appears similar to the way in which the SS line in SPI operates..
 

GetDeviceInfo

Joined Jun 7, 2009
2,192
If I'm correct, your GPS is continuosly streaming.

TI's SN74LVC2G157 is a 2-1 data selector, in which you would dedicate a port line for selection purposes. If you wanted to Tx back to the GPS units, you should find a dual package.
 
If the periods of time that you need to communicate with the two devices, GPS and uDrive, from the microcontroller is known, i.e. you only need to communicate with one at a time, then you can probably use the multiplexer on the logic level signals (TTL) to and from the microcontroller. You may have to reestablish the connection each time you switch to the other device.

You may need to use pullup resistors, or pulldown resistors, on the logic level lines so the idle device does not read in garbage data and get confused.
 
Top