Short and Efficient: How to Communicate with Multiple Slave Serial Ports Using a Single Microcontroller Serial Port?

Original article authorized by the public account: 24c01 Hardware Electronics

Sometimes, when a circuit needs to implement a master-slave configuration, the commonly used communication protocols are usually SPI, I2C, or RS485 bus forms. Among these, I2C is particularly simple and convenient for on-board communication, requiring only two wires to establish a bus.

However, sometimes due to certain reasons, we must consider another design, which is to allow the serial port to implement a master-slave bus design. For example, if the main MCU on the board has only one serial port but wants to communicate with two other MCUs using this single serial port. However, we know that conventional serial ports can only send data in a one-to-one manner, that is, the master RX connects to the slave TX, and the master TX connects to the slave RX to achieve communication. So how can we implement a master-slave configuration?

Short and Efficient: How to Communicate with Multiple Slave Serial Ports Using a Single Microcontroller Serial Port?

Circuit Implementation:

The master TX can be connected to multiple slave RXs simultaneously, meaning the master sends data in a broadcast manner, and each slave can receive the information sent by the master (the sent information must include the slave’s information so that the slave knows whether the master intends to communicate with it).

Short and Efficient: How to Communicate with Multiple Slave Serial Ports Using a Single Microcontroller Serial Port?

Since the idle state of the serial port is high, and low state represents data/start bit, the slave can send data by using diodes to build an AND gate, performing a logical AND operation on the TXs of the two slaves. Thus, when Slave 1 sends data, Slave 2 is in an idle state (outputting 1), so Slave 2 does not interfere with the data being sent by Slave 1.

Short and Efficient: How to Communicate with Multiple Slave Serial Ports Using a Single Microcontroller Serial Port?Similarly, integrated logic gates can also be used, such as the SGM7SZ08 dual-input AND gate, which can achieve the same effect. The circuit diagram is as follows:Short and Efficient: How to Communicate with Multiple Slave Serial Ports Using a Single Microcontroller Serial Port?Original article authorized by the public account: 24c01 Hardware ElectronicsShare, like, and enjoy ❤

Leave a Comment