1
\$\begingroup\$

in my project I have a USB type-C 3.1 2nd Generation (24 pins), which should provide 5V to a charge battery/battery system. In addition, there is a uC powered at 3,3V where the maximum voltage on GPIO pins is 3,6V.

The question is: can I connect directly the UART pins of the uC to the Rx/Tx pins of the USB port? If I connect the USB to a laptop or wall adapter, what will it be the voltage in Rx/Tx pins? Is there a risk that I overcome the maximum 3,6V of the UART pins of the uC?

Note: I prefer to not use a bridging between a USB port and an enhanced UART serial port.

enter image description here

enter image description here

\$\endgroup\$
  • \$\begingroup\$ Can you? Yes it's certainly physically possible to do this. The real question is what you're hoping to achieve by doing this though. \$\endgroup\$ – brhans Feb 14 at 14:39
  • 1
    \$\begingroup\$ @brhans My doubt is about the protection of the uC. I mean, if I connect the usb connector to a Laptop or Wall Adapter, is there the possibility that through Rx/Tx I will have a Voltage higher than the Maximum allowed voltage on GPIO pins of uC (3,6V)? \$\endgroup\$ – Alessandro Feb 14 at 14:45
  • 4
    \$\begingroup\$ Never mind the levels, these are completely incompatible interfaces. \$\endgroup\$ – Finbarr Feb 14 at 14:47
  • 3
    \$\begingroup\$ So the plan is to use an USB connector for something that's not actually USB? Seems like asking for trouble. The voltage will depend on the USB-UART adapter you use. \$\endgroup\$ – lnowak Feb 14 at 15:43
  • 1
    \$\begingroup\$ The plan is: 1) To use normal USB cable to charge the battery through USB connector 2) To use the USB serial adapter with TTL for debugging For the second one everything should be ok, I use the adapter for debugging. But what about I use a normal USB cable and i connect to the elctronic PCB? \$\endgroup\$ – Alessandro Feb 14 at 15:58
1
\$\begingroup\$

From your last sentence it sounds like you actually want a working UART over USB. This will not work. The Rx/Tx pins in an USB-C connector has nothing at all to do with the UART in your microcontroller.

However, you will not physically damage the pins. USB doesn't use high voltage on the signal pins even if you use a high voltage for charging. This is even true for the initial USB.

\$\endgroup\$
  • \$\begingroup\$ So whatever I connect to USB connector I will not have high voltage on Tx/Rx and so I will not burn the uC, right? \$\endgroup\$ – Alessandro Feb 14 at 16:18
  • \$\begingroup\$ @Alessandro Correct, unless you connect an USB killer! Such a device will kill everything else and not only your port. :) \$\endgroup\$ – pipe Feb 14 at 16:26
  • \$\begingroup\$ If you are going to abuse the USB pins for other signalling, connecting 3v3 logic through 1.5 K series resistors might be electrically reasonable as that is about what USB uses for device detection anyway and easily tolerated by a UART for typical baudrates and cable lengths. But expect a USB host to thrash its confusion into any system logs, potentially each time the UART signal returns high. So perhaps best to only generate output after enabling it by a specific command from your external debug setup. \$\endgroup\$ – Chris Stratton Feb 14 at 18:20
0
\$\begingroup\$

You want an USB serial adapter with TTL levels (i.e. 3.3V levels). While connecting the serial to the USB might not damage anything it will certainly not work. You need to the adapter for it to make any sense.

\$\endgroup\$
  • \$\begingroup\$ Yes exactly. I would like to use the USB serial adapter for debugging. The only concern is about using a normal USB cable. Is there the risk to have high voltages in the Tx/Rx connector and so burns the uC? \$\endgroup\$ – Alessandro Feb 14 at 15:54
  • \$\begingroup\$ The converter has USB on one side and usualy 4 wires on the other for GND, Vcc, TX and RX. And it doesn't put 5V on RX/TX if it is for 3V signal levels. Go buy a converter and be happy. \$\endgroup\$ – Goswin von Brederlow Feb 15 at 16:23
0
\$\begingroup\$

To summarize, you are making a device that uses Type-C port to charge some inside battery when connected to a Type-C laptop, and also want to use the Type-C Rx/Tx pins as UART interface to some internal IC from some debug adapter. Your concern is whether your device can suffer a damage if someone plugs your device into regular Type-C laptop port (with regular C-C cable).

Your concern is not founded. The voltage level on Rx pins will occur only during "Rx detect" stage, where a common-mode pulse will be applied with 400 mV amplitude, making the voltage at 800 mV at best, and only for 10-20 ms. However, the voltage will have a negative peak as well, but your UART will likely tolerate this.

You can use the Rx/Tx wires as you wish, however you need to keep in mind that the Rx+/Rx- (and Tx) are typically twisted in pairs, so you might incur substantial cross-talk if you don't use the wires correctly. You need to use, say Rx- and Tx- as signal ground wires, and Rx+ and Tx+ as your UART signals.

More, to get any voltage from your laptop, you need to have 5.1k pull downs on each of CC1 and CC2 wires, otherwise the Type-C port will output no VBUS.

Also please be aware that USB Type-C specifications also "went an extra mile" and do define DAM - Debug Accessory Mode, precisely for the purpose of extensive debugging. The attach/discovery protocol is crazy IMO, but you might want to take a look at appendix B of the specs if you are serious. The transport layer is not defined, so you can use the simple propriety UART functions.

\$\endgroup\$

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.