Circuit Design For Multiple UART Connections

[Bill Porter] has a tip for designing circuits that have multiple connections to a single microcontroller UART. This stemmed from a review of a friend’s circuit design that used the UART in the project, but also called for an FTDI chip in order to reprogram via USB and a bootloader. Unlike the schematic above, the circuit called for straight connections without any resistors. With that design, a conflict will occur if two devices are connected and attempting to communicate at the same time.

The fix is easy. [Bill] discusses how to prioritize the connection by adding the pair of current limiting resistors seen above. This helps to ensure that damage will not occur, and that the FTDI chip will take precedence. Now the external hardware will not preclude the FTDI chip from accessing and programming via the bootloader. The tutorial is intended for those rolling their own boards out of an Arduino-based prototype, but it will work in any situation where you need multiple connections to a single set of UART pins.

28 thoughts on “Circuit Design For Multiple UART Connections

  1. @kubik: But you will always manage to get the damn connections mixed up some time. It’s like USB-cables, impossible to plug in the right way on the first try ;)

  2. @wernicke: You don’t? I think you’re in the minority if you mean to tell me you’ve never managed to turn a USB connector the wrong way before trying to plug it in.

    I hereby give you a challenge! Grab the nearest USB cable, now, reach behind your computer and try to plug it in the right way on the first try. And no peeking! If you did it right grab another cable (or just drop the one you have randomly on the floor) and repeat. If you get it right 10 times in a row (without peeking!) I’ll be flabbergasted.

  3. @sneakypoo – the trick to doing that right 10 times in a row is to be observant of the symbols on the connector. USB specs state that the USB logo is supposed to be facing upward towards greater human visibility when plugged in, so as long as you can ensure that orientation, you’ll nail it every time.

    @HAD:
    I would like to respond to this bit of the text in the article, though:

    “””With that design, a conflict will occur if two devices are connected and attempting to communicate at the same time.”””

    As stated, this is incorrect. You’ll get contention if you have two devices plugged in and *if even one* tries to communicate. RS-232 has no high-impedance state, and so as soon as one device tries to drive its start bit, the other device (which is assumed to be idle) will create dead short. (Hence the current limiters we see in the schematic.)

    As written, you imply that it’s safe for two devices to be plugged in, so long as only one communicates at a time. I can just smell the magic smoke now.

  4. Also works with the SPI pins. If you want to add an ISP programming header to your AVR system but you’re already using the SPI pins, stick some 1k resistors in series with the MOSI/MISO/SCK lines in the existing SPI bus. (The AVRISP manual actually recommends this.) That way, the programming signals always take priority, and you shouldn’t have bus contention issues.

  5. @Munch You mean that logo that’s molded into the connector with no visual contrast, and not present at all on many flash drives? A quick survey of computers near me shows that one violates the spec and the others have the connectors mounted vertically so the logo faces to the side.

  6. Here is another way to do it using two diodes and a resistor the RX pin is held high and the two TX pins can only pull the line low. With this design you can use a much larger resistor (100K) to reduce power consumption and still be able to operate at very high baud rates.

    VCC
    |
    .-.
    | |
    | |10K
    ‘-‘
    TX —–|<—-| |
    |——– RX
    TX —–|<—-|

  7. RE USB Connectors:
    The “windowed” side (the one with open holes) always faces up, with respect to the jack it’s plugging into. For ports on the front of your machine and on laptops, that means the windowed side faces up, but on motherboard ports on the back of a tower, the windows face towards the greater majority of the machine, which is “up” relative to the motherboard.

    Laptops with ports turned 90 degrees can be confusing, as well as some other strange cases… But for the majority of machines, the “window side faces up” rule holds true.

  8. @Alex This is not a universal rule. I have setup many Dell computers that have the ports 180deg flipped from normal. Front ports are notorious for being flipped upside down as well. I’d say your rule is about 65-75% accurate.

  9. @sneakypoo, @cpmike, @others:
    Wow… this is an easy bunch to steer off topic. (byw, it was meant jokingly. The sarcasm tag got filtered)
    OK.. I admit that for blind ports that I’m unfamiliar with I will line up a USB plug with a socket the wrong way close to half of the time. However, I never manage to plug it in the wrong way, like sneakypoo’s reply seemed to imply.
    As long as I’m OT, my bigger gripe is that some machines (my old dell D620 as an example) have their side ports set too deep for bulky USB plugs like memory sticks to work reliably.

  10. Face it, the USB “A” (flat) connector is a design by an inexperienced, rather stupid person. The mini “B” isn’t far behind. We all know that “blind” mating these connectors is very nearly impossible. Just plain dumb. In order to elevate the Stupid Competition, the HDMI connector was conceived; it wins easily. The thing that all these connectors share is the requirement of clear vision of the mating process. Given the nature of modern product design, connectors can be found in ANY orientation, ANY location, frequently dark as well.

    Clearly, not overly smart designers mate connectors at their well lit desks, hand holding them in the most optimal position for good vision. If they can mate them in this situation, the design is pronounced to be final and production begins. What a colossal disconnect from the real world!

    It’s pretty obvious that a good connector has a bit of “funnel” to get you in when you’re close. It is circular, scoop proof, and well keyed. That means that all you have to do is rotate until the “lock and key” align and mating occurs. You also need a quality detent that issues tactile feedback when mating is complete, and prevents unintentional disconnect from vibration. (Am I the only one having the detent free HDMI sporadically falling out of their laptop’s connector?) Come on guys, this isn’t rocket science!

    And if it’s really UNIVERSAL Serial Bus, why the plethora of sizes. Logic would suggest that the basic connector be “mini” sized and intelligent design used to create robustness.

    These hot shot engineers need to get out into the real world, and get their hands a bit dirty before they go dashing off designs that only look good in a computer CAD program. What is missing is the willingness to invest in prototype runs, tested in real world apps. AFTER the beta testers declare a design to be a good one, THEN make zillions of them. Ultimately, it’s about elimination of prototyping to improve the company’s economic profile on Wall Street. Maybe money really IS the root of all evil!

  11. Personally, I like the L shaped SATA connector.

    Circular connectors should be burned at the stake. A circular connector gets jammed in at weird angles, pin holes get shredded, the ‘twist until it fits’ technique destroys connectors faster than feeding the stupid thing through a paper shredder.

  12. I like the idea of a circular connector, actually. A 5 pin phono connector would work nicely (one ground, and two data pairs). The only problem I have with this kind of connector is the plug into which the connector fits into. Based on my experience with 1/8″ phono connectors on sound cards, the contacts wouldn’t last very long.

    Solve that problem, and the phono plug solution really would truly be ideal.

  13. O man, When I saw my story had 20 something comments, I feared for the worse. Start reading in and it’s all about USB connections? You guys crack me up!!

    Other suggestions here are good and it just comes down to what people want. For a quick and easy way to allow for FTDI programming without unplugging other stuff, this way works. 5mA is not much power loss and I’m not two worried about holding a RX line, I don’t think many people will be running an AVR with a UART buffer enabled and nothing plugged in.

    And for the questions about two resistors; I suggest a resistor on both in case the ‘usually connected’ device is something other then a serial port, like general IO holding both lines low or high.

    Bill

  14. Here’s the real tip: Learn to read a schematic!

    The arduino has had this ‘solution’ for years now since it has an FTDI chip and available RX/TX lines on the header. All you really had to do was to find an open hardware example that was similar and just go look at the schematic to find the solution.

    Don’t waste time trying to reinvent the wheel. Use the resources that are already out there.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.