0
\$\begingroup\$

I am curently working on a project where a MCU got only one UART port available, however I need to run two peripherals with UART interface (not simultaneously) so I was wondering if I can connect two peripherals UARTs on the same UART of the MCU while playing with enabling and disabling the peripherals one by one for communicating with the MCU?

Your feedbacks and recommendation are appreciated about this situation

Regards

\$\endgroup\$
  • 1
    \$\begingroup\$ As long as both peripherals tri-state when disabled, it should be fine. \$\endgroup\$ – uint128_t May 13 '16 at 3:40
  • \$\begingroup\$ Just put a switch on the tx and rx lines. \$\endgroup\$ – Lundin May 13 '16 at 9:06
2
\$\begingroup\$

Since you need to be connected to only one device at a time, you could use a multiplexer to switch between the two chips, like the NX3L2467:

enter image description here

You only need a DPDT switch; this is a 4PDT one so you're only using half of the circuit. But all of the DPDT switches I found had very unfriendly packages to work with such as VQFN, BGA etc. This part comes in a 16-pin TSSOP package; not as nice as a DIP to work with but doable. You can get TSSOP16 to DIP adapters. It also has a very low on-resistance (0.5Ω). It will work off of 3.3V which I assume is your supply voltage.

| improve this answer | |
\$\endgroup\$
0
\$\begingroup\$

Yes its possible. What configuration you are looking for is something like a multidrop,where the master(uC) is connected to all slaves and all slaves can talk back to the master. However you need flow control among the slaves sending to the master,as all the slaves Tx will be connected to a single Rx of the master.

If you have only a few peripherals(slaves) that need to talk to the master and may be a SPI/I2C available in your master,you could use something like a Quad Serial UART. This will simplify software complications

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Hello, thanks for your reply. Can you ellaborate a bit more on flow control issue ? Our project is to use a MCU , one GPS module and one GSM module. We don't need GSM and GSP to run in the same time. \$\endgroup\$ – chris May 13 '16 at 5:08
  • \$\begingroup\$ By flow control i mean that, as long as u ensure the slaves dont send to the master simultaneously or when another slaves is sending to the master,you should be fine \$\endgroup\$ – AlphaGoku May 13 '16 at 5:10
  • \$\begingroup\$ Yes, it is clear, this is what I was thinking. :) We just organize the dicussion between the different elements so that two guys talk together without being interrupted by a third one... \$\endgroup\$ – chris May 13 '16 at 5:28
  • \$\begingroup\$ That should work then \$\endgroup\$ – AlphaGoku May 13 '16 at 7:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.