USB-C receptacle for USB 2.1 MCU - Page 1
Forum section: electronics / beginners

author: anvoice
author_rank: Frequent Contributor
timestamp: June 01, 2025, 06:59:24 am
content: Hello, I'm designing a device which should be capable of communication via USB-C cable. It will likely be based on the ATSAMD51 MCU, which has a USB 2.1 peripheral if I read the datasheet right. So I need a USB-C receptacle, but it only needs to support the USB 2 standard with no PD (the device may be configured via USB but will receive power from a dedicated 24V power supply or 6S LiPO battery). Given the above, I understand I don't need the full 24 positions from the USB 3 standard, but I'm a bit confused about how many pins total I need and how to connect them to my MCU. Thus, several questions:1. Am I right in concluding that I need a 12 position, or 12+12 dummy receptacle for my scenario? If I understand correctly, I need 4 GND, 4 VBUS, and 4 data (2 dData- and 2 Data+).2. Since my MCU seems to provide 2 data pins (DM and DP, corresponding to I believe Data- and Data+), I can see where I should connect those. However,it also provides 2 SOF/1KHz (Start of Frame) pins, and I'm not sure what to do with those. Do I keep them disconnected? Or do I need to attach additional hardware to those?3. If I want to power the device via USB-C for configuration, but connect 24V/battery for operation, how easy would it be to design protection against plugging in both the main power and the USB-C cable? Is there a best practice for this? For instance, I know some electronics include a jumper that selects between allowing and not allowing USB power (to prevent both the power supply and the USB voltage from acting at once), but is it possible to design a circuit that will provide USB-C power but shut it off if it detects something like a battery being connected?Thank you!

author: sleemanj
author_rank: Super Contributor
timestamp: June 01, 2025, 07:18:34 am
content: You need a socket that breaks out Gnd, Vbus, D+, D-, CC1, CC2.You may find sockets that have 6 pins to do that (eg the socket itself combines the two D+ in the socket into a single D+ on the PCB) - panel mount ones with flying wires particularly come in such varieties, but 8 (2x GND, 2x VBus, D+, D-, CC1, CC2) is more common.CC1 and CC2 should be pulled down each with a separate 5.1k resistor.I expect that the SOF outputs of your MCU are just for triggering a scope or something, they have no relevance to USB communications itself and I imagine would be ignored, but see the docs for the MCU

author: Nominal Animal
author_rank: Super Contributor
timestamp: June 01, 2025, 01:51:20 pm
content: ATSAMD51 has an USB 2.0 Full Speed (12 Mbit/s) interface, so you are looking for an USB 2.0 Type C female/receptable/socket connector.At LCSC, I'd suggest you look atGT-USB-7101A (C7469647), a surface-mount 8-pin USB-C receptacle that has two through-hole pins in the middle and two through-hole chassis "legs", but the signals on pads on the connector side of the PCB. The connector is in the same plane as the PCB, and the USB-C plug seats 1mm away from the front edge of the connector. If you 3D print your enclosure, you can do a small lip around the connector (with or without the rubber gasket) to make it nicer. The datasheet is in English.I didn't find any 6- or 8-pin USB-C receptacle that exposes D+ and D- pins at Mouser (but I didn't check themall), but there are plenty of 16-pin ones likeUJ20-C-H-G-SMT-1-P16-TRandUJ20-C-H-G-SMT-P16-TR. With these, you leave SBU1 (A8) and SBU2 (B8) not connected, all GNDs (A1, A12, B1, B12) together, all VBUSes (A4, A9, B4, B9) together, D+ to both Dp1 and Dp2 (A6, B6) and D- to both Dn1 and Dn2 (A7, B7). CC1 (A5) you connect to GND via a 5.1k resistor, and CC2 (B5) to GND via another 5.1k resistor. Only D+ and D- (and GND) go directly to your microcontroller.You can add ESD protection diodes likeST USBLC6-2SC6for D+ and D- between the connector and your microcontroller; see Figure 17 in the datasheet for how to place it in the PCB, it's very important. These protect the microcontroller against static electricity zaps (electrostatic discharge). I personally don't bother, nor do many microcontroller development boards; the D+ and D- pins often has some ESD protection internally in the microcontroller anyway.Similarly, the often seen P-channel MOSFET (source to VBUS, drain to your voltage regulator(s), gate to ground) can be used to protect against reverse polarity (but not reverse current), but I would not bother with that either: I don't see that easily happening with USB connectors (without breaking the connector).If your board does have a battery or can be powered by something besides USB, then an ideal diode likeLM66100can be used between VBUS and your voltage regulator(s) or 5V rail to protect against backfeeding that power to the host by accident; that isveryimportant. In the LM66100 case, you do need to connect the /CE pin to VOUT pin for reverse current protection. If you have two 5V sources (one of them USB VBUS), you can use aLM66200(with VOUT connected to your regulators or 5V rail). These also protect against reverse polarity, but it just shouldn't occur with USB connectors.If you do not use 5V, but use a linear regulator to 3.3V with everything using that 3.3V only, then it is cheaper and more reasonable to use a Schottky diode between VBUS and the input to the linear regulator. The diode will drop 0.3V – 0.5V, depending on the exact model and current, so use a low-drop 3.3V regulator, as the voltage after the diodes is between something like 4.0V and 5.5V (VBUS being between 4.5V and 5.5V, and only nominally 5V). Then again, I do like to keep a few LM66100 and LM66200 in stock just because they're very nice to use with USB stuff, and they're not that expensive anyway..You could add a polyfuse (PPTC) between VBUS and your voltage regulators (after the ESD protection, if any). This way, if something (like an accidental short due to poking with a screwdriver) causes too much current to be drawn, the polyfuse becomes very resistive, dropping the current. When disconnected, it will recover. They can take it a few times, but should not be relied upon doing that for normal operation; they're a cheap safety device, and look like (largish) resistors in SMD format. If you don't want to use the polyfuse, or don't happen to have one, you can just solder a short piece of wire there instead.When using bulk capacitance between the 5V rail (between the USB connector and before any linear regulators), note that USB does not allow more than 10µF total capacitance. (You can do higher if you limit the inrush current.) This means that if you do analog-y stuff, it is good to remember it is difficult to get all the digital noise off the 5V rail; it is much easier to (filter and) regulate it to some lower voltage, say 3.3V (or even 4V) for a lower noise rail. Similarly, if you use 3.3V for both the digital stuff and for analog stuff, you can use a separate 3.3V linear regulator to generate a lower-noise analog rail.Apologies for the long wall of text; hopefully you skipped it if these annoy you!

author: anvoice
author_rank: Frequent Contributor
timestamp: June 01, 2025, 07:56:58 pm
content: Quote from: Nominal Animal on June 01, 2025, 01:51:20 pmNo, I read it all because it's very useful. Thank you for the thorough reply!I mistakenly mentioned the ATSAMD51 MCU, but it'll more likely be the ATSAME51 for CAN connectivity. They're otherwise very similar.The device in question is a BLDC motor controller, so not really an analog application (though analog pins are used for current sensing). I was indeed hoping to use a single switching regulator to 3.3V rather than having a separate 5V rail. The idea is to be able to power the board by USB-C for programming, but by something like battery for normal operation of the motor. Since the battery would be at close to 24V, I would like to ensure the board (or the upstream device) doesn't fry if I accidentally plug in the battery while USB-C is plugged in.

author: anvoice
author_rank: Frequent Contributor
timestamp: June 04, 2025, 06:33:26 am
content: Looks like I misunderstood how you mentioned I should use the LM66100. I assumed the diode should go between VBUS and VBATT, but as someone pointed out that won't work since my battery voltage is close to 24V, and the maximum allowed difference between the diode pins is if I understand correctly 6V. I am trying to look for a substitute, but with no luck so far. Can I just make my own ideal diode using a transistor and comparator?

author: Nominal Animal
author_rank: Super Contributor
timestamp: June 04, 2025, 11:46:59 am
content: Yes, you can construct an ideal diode from a P-channel MOSFET and a matched pair of PNP BJT transistors (there are commonly available in 6-pin packages), similar to the right side of(Click to embiggen)where Q3, Q4, Q5, R3, R4 forms the ideal diode, which conducts when VIN > VCC. The matched pair of BJT PNP transistors Q4 and Q5 (for example, a DMMT5401) act like a comparator.If you want to add a high-side switch, to turn the ideal diode circuit completely "off", nonconducting, when a microcontroller or something pulls ENA high, you add Q1, Q2, R1, R2, where Q2 is a logic-level N-channel MOSFET, say BSS138 or NX138AK. Note how the P-channel MOSFETs are oriented. This configuration only allows conventional current flow from left to right, when VIN > VCC.Another approach would be a dual P-channel MOSFET, something like the following high-side switch,(Click to embiggen)where the P-channel MOSFETs are in a mutually blocking configuration, their gates pulled to the higher voltage between VIN and VCC (minus body diode drops) by R1. To make the switch conduct, N-channel MOSFET (BSS138, NX138AK, not much current but suitable logic level gate-source threshold voltage Vgs(th)) pulls the gates to ground whenever voltage at ENA is over 2.5V or so. (If ENA might float, you could add a 47k resistor to ground between ENA and R2 to ensure it defaults low/switch off.)This one is a bidirectional switch, not an ideal diode at all; current may flow from VIN to VCC or from VCC to VIN.If ENA is low (below 1V or so), the switch is does not conduct. When ENA is high (between 2.5V and 20V), the switch conducts, regardless of voltages at VIN and VCC (but they should be between 0V and 20V). Because MOSFET gates behave like capacitors, they may draw pretty high current when switching –– they won't draw basically any current when in steady state, being voltage-controlled devices –– so R2 is there just to limit the peak current draw; it also slows down the switching a bit (but we're talking about fractions of a millisecond here, perhaps a couple of milliseconds for the whole switch in both cases above).In both cases Q1 and Q3 are P-channel MOSFETs with a low Rds(on) (drain-source resistance) when Vgs (gate-source voltage) is negative, in magnitude about 0.6V under the voltage passing over the switch, with respect to GND.

author: anvoice
author_rank: Frequent Contributor
timestamp: June 04, 2025, 09:34:39 pm
content: Thanks for the examples!Just realized a serious mistake in my circuit (I'm attaching it for clarity). My 3.3V rail comes from a DRV8316 chip, which is currently designed to be powered by battery/24V. This means that as is, if I connect just the USB-C, not only will the DRV8316 not switch on, the MCU will be off too, making the circuit useless... I'll need to remedy this before I move on.Edit: never mind, if I was more careful I'd have noticed that the DRV8316 can operate from down to 4.5V. So the only thing I need is the high voltage ideal diode.