Is this possible, UART: One Master, Two Slaves?

Thread Starter

Chandler Timm Doloriel

Joined Apr 5, 2018
52
Hi Folks,

I am wondering if this configuration is possible to implement. If yes, what's the concept behind it.

UART connection.PNG
Both STM32 and PIC18 reads the same sensor data (external voltage, current and temp) that is measured at the PIC16.

You may ask, why would I not use SPI or I2C communcation. The answer is that I'm trying to understand someone's design (why would he prefers UART over other protocol). So, I need to know first what the concept behind UART: One Master, Two Slaves.

I have an idea about addressing and SPI functionality implemented in UART, but still needs someone's idea to clarify this.

You're help is very much appreciated.

Regards,
Chandler
 

nsaspook

Joined Aug 27, 2009
7,587
Sure, it's easy to have receive only slaves. The only issue is unit addressing. That can be in-band (via selection bits in the data channel) or out-band (chip select gpios from master to each slave.) In theory a true serial port physical interface (232,422,485) should be able to transmit data over longer distances than SPI or I2C.
 
Last edited:

geekoftheweek

Joined Oct 6, 2013
517
The Tx from master to slave would work other than having both receive the same byte... you would need some sort of chip select mechanism. The Rx from slaves to master would be an issue. If both slaves have their Tx pins enabled they would short the other's signal high or low depending on what it's idle state is. If you were to turn on and off the slave UART as you want to send or receive data then it could work. You will need other signals though to tell the slave to turn on and off the UART as well as either another signal to tell the master the slave UART is running, or wait enough time for the slave to get ready.
 

John P

Joined Oct 14, 2008
1,834
You can do a quick and dirty implementation of this by connecting the 2 TX lines from the slaves together via diodes (use Schottky diodes) so that each one can pull the line low. Then tie the connection point high via a resistor. This works because an inactive UART will have a high output, so whichever one is active will drive the line low. But you need to have some sort of protocol that decides which processor will transmit; if they both talk at once, you'll have garbage on the line.
 
Top