0
\$\begingroup\$

Currently designing a circuit to switch between two UART lines using an analog dpdt switch. Been searching for a while and found the BL1532. The datasheet says it's a DPDT USB2.0 Analog Switch, but not sure if this chip will work for UART since USB is pretty fast (not an expert in this field).

Here is my circuit: enter image description here

The MCU can communicate from 9600 to 115200 baud rate. As you can see I drive the BL1532 select pin with an spdt switch for 3.3V HIGH and GND LOW. Any advice or opinion is appreciated

\$\endgroup\$
13
  • \$\begingroup\$ You need pull-up resistors on outgoing RX lines. \$\endgroup\$
    – Andy aka
    Commented Aug 10, 2020 at 13:36
  • \$\begingroup\$ @Andyaka You mean all RX lines? (MCU, CP2104 and HEADER) \$\endgroup\$ Commented Aug 10, 2020 at 13:41
  • 1
    \$\begingroup\$ MCU Rx is always connected to a Tx so no, I mean outgoing lines. \$\endgroup\$
    – Andy aka
    Commented Aug 10, 2020 at 13:42
  • \$\begingroup\$ @Andyaka "Header pin" doesn't sound like something that will necessarily drive the signal to a known state. It is custom to add pull-up on the Rx pin (if not available internally). \$\endgroup\$
    – Lundin
    Commented Aug 10, 2020 at 13:46
  • 1
    \$\begingroup\$ You already have a question on this at Switch between two serial ports your current idea needs to be an edit to that, not a new question \$\endgroup\$ Commented Aug 10, 2020 at 13:50

4 Answers 4

3
\$\begingroup\$

The IC in itself should be fine. I didn't see anything in the datasheet which would indicate that it wouldn't work with the voltages or speeds you have in mind.

What I checked were the supply voltage characteristics and general voltage limitations on the pins.

I also checked that there is no indication of some DC blocking or differential signaling is going on.


For your schematic: I would use pull-ups on the RX lines (all of them, can be in the 10-100 kOhm range) to prevent glitches when switching between the modes.

And some current limiting resistors like 1 kOhm in the lines for the external connection, you might switch things up and then your MCU might get damaged. Series resistors help in this case.

And if your header is going to be used by "the general public" you should probably beef it up against ESD with some protection diodes at least.

Another thing which isn't shown if there is a common ground for the external headers available. That is needed for the communication to work. It might work ok on your test because you have a hidden shared common ground but will not work if you connect it to a battery running device.

\$\endgroup\$
2
  • \$\begingroup\$ I added a TVS array diode connected to the RX/TX header pin lines \$\endgroup\$ Commented Aug 10, 2020 at 13:56
  • \$\begingroup\$ Yes, there is common ground for the header pins (forgot to specify). Header pins are VCC, TX ,RX and GND. Would be used to communicate with other serial devices \$\endgroup\$ Commented Aug 10, 2020 at 14:01
3
\$\begingroup\$

The analog mux chip will work. Specifications are completely overkill for simple serial port switching though, so it depends on your definition of good, for example if a cheaper chip is better.

\$\endgroup\$
1
  • \$\begingroup\$ You're right, but it's 8-10 times cheaper than a practical analog switch from Analog Devices, Nexperia or TI \$\endgroup\$ Commented Aug 10, 2020 at 14:08
2
\$\begingroup\$

For baud 115200 below 5V, the 30~50MHZ analog switch is enough. FTDI FT232 is up to 8Mbps, or 8MHz. It uses external 16MHz crystal. You can use dual 2-channel SPDT (Vishay DG9415DQ, MPS MP2735), triple SPDT (such as TI 74HC4053/CD74HC4053, Nexperia 74LVC1G53) to include SW1. Or single SPDT + single DPDT as in your schematic. You can check 74HC series MUX IC.

\$\endgroup\$
-1
\$\begingroup\$

Your better option is to use a hub or bridge of sorts. Look into FTDI - they make many UART to USB converters, which might be a better option. I believe they have all the way up to quad-uarts at this point, like the FT4232. Depending on your MCU, you might have a USB output and an available driver.

Alternatively, if you prefer to use SPI or I2C, there's the MAX14830. This will bridge to other UARTs as well from I2C or SPI.

MAX14830 datasheet

\$\endgroup\$
6
  • 1
    \$\begingroup\$ There is a CP2104 in the schematic which is a USB to UART bridge. For which problems are your suggestions a solution? \$\endgroup\$
    – Arsenal
    Commented Aug 10, 2020 at 13:50
  • 1
    \$\begingroup\$ This has nothing to do with the question or the problem. \$\endgroup\$ Commented Aug 10, 2020 at 13:52
  • \$\begingroup\$ @Arsenal if he's looking for a USB to dual UART, then the FTDI solution is the one he should investigate. But I gave him the option of the SPI to UART because I got the impression that he was uncertain about the USB, and did say "Any advice or opinion is appreciated"... \$\endgroup\$ Commented Aug 10, 2020 at 14:01
  • \$\begingroup\$ @ChrisStratton, one of us misread his problem statement, re-read it and then see my answer to Arsenal. \$\endgroup\$ Commented Aug 10, 2020 at 14:02
  • \$\begingroup\$ Indeed you misread the question. If you're not seeing that, read their previous question this was linked to for likely closure as a duplicate. \$\endgroup\$ Commented Aug 10, 2020 at 14:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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