0
\$\begingroup\$

I'm playing around with building a simple keyboard, that will have just few buttons, nothing complex.

I have decided to use USB 2.0 Type C connector, like this or this.

Now when following USB 3.0 specs, it says we should use pull down resistors on CC1 and CC2 so that host can tell if device is on or not and also resolve orientation.

But USB 2.0 specs says we should use pull up resistors on D+ or D- lines and that without them host would not recognize device.

I'm confused what to do here since I have both CC1 and CC2 but also D+ and D-.

Should I follow USB 3.0 specs and pull down only CC1 and CC2 lines like this:

enter image description here

Or should I also pull D- up to 5V like this, while pulling CC1 and CC2 to the ground like this:

enter image description here

I would be thankful to someone who could explain how to use these 2.0 Type C connectors and point me to some specification I could read. And explain why use pullup on D- when I already pulled CC1 and CC1 down to ground? Or can I just ignore CC1 and CC2 lines and just use pullup on D- line if it's USB 2.0?

Edit: MCU I'm using does not have internal pullup or pulldown resistors. Pull up on D- should go through 1.5k resistor, I missed that one.

\$\endgroup\$
2
\$\begingroup\$

You want a Type C so connect the CC pins as per Type C as they don't exist in USB 2.

The rest must be done according to USB 2.

If you want to read more about it then the read the USB specs, they have everything you need.

You have also shorted D- directly to 5V, that will damage your PC and your device, don't do that. Besides the pull-up resistor would not be connected to 5V to begin with, but to 3.3V.

Depending on which USB chip you are going to use, the pull-up might be internal, so without knowing what is connected to your connctor, there is no way to answer if you should have a pull-up or not.

\$\endgroup\$
4
  • \$\begingroup\$ MCU I'm using has no internal pullup or pulldown resistors. So I should pull down CC pins, and also pullup D-. I have seen schematics, many of them, where they just pull D- up to 5V. So I would need a voltage regulator to do this right? Since I'm drawing 5V from USB and MCU is using 5V. I should look for this info in USB Type C specs? Thanks! \$\endgroup\$
    – Matija
    Jan 11 at 21:35
  • \$\begingroup\$ Would you bother to mention which MCU it is? But due to pull-up to 5V, I bet you are making a Bluepill clone with STM32F103? The internet is full of garbage circuits that are wrong or dangerous, and they get copied around. I would not plug such things into my PC. And due to Bluepill enumeration issues, you don't want a fixed pull-up, but have the MCU turn on the pull-up when it is ready to enumerate the connection. USB data is not 5V and most USB MCUs are not 5V MCUs either. \$\endgroup\$
    – Justme
    Jan 11 at 21:42
  • \$\begingroup\$ I'm thinking about using ATMEGA32A or ATMEGA32U4 MCU's. Wanted to go with STM32 but they are not accessible at the moment. Yes I have seen many circuits with ATMEGA32A that pull D- on 5V, if it really is 5V, at least that's what schematics look like. And yeah I'm just starting, but am aware that there are many junk circuits out there, so I'm looking to learn everything and do it the right way. It's a hobby for me, but will try to make it right way. \$\endgroup\$
    – Matija
    Jan 11 at 21:47
  • \$\begingroup\$ The USB AVRs such as Mega32U4 do have internal regulators, so it can take 5V in. It also has internal pull-ups, so do not put external pull-ups. Always look at manufacturer datasheets and application notes, do not blindly believe that random internet schematics are correct. (Which means, you should also verify what I say too :) But never pull a USB data to 5V, unless manufacturer says so (haven't seen one yet). \$\endgroup\$
    – Justme
    Jan 11 at 21:56

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.