Electronic – Clarification about USB receptacle and plug

plugusbusb deviceusb-host

I need clarifications about which USB receptacle and plug I have to use for an embedded product.

I looked on line and I found a lot of documentation like this or this and I understood that:

  • If I want to realize an embedded product with device role, I have to use mini or micro USB B receptacle. So I can connect my device to an host using a cable with a mini or micro USB B plug and a USB A plug.
  • If I want to realize an embedded product with host role or OTG, I have to use mini USB A or micro USB AB receptacle. So I can connect a device like a PenDrive at my embedded product with a cable with mini or micro USB A plug and a USB A receptacle; if my embedded is an OTG I can also connect its to an host with a cable like previous case (and checking the ID pin).

That's right?

If yes I have 3 questions:

  1. If with mini or micro USB B receptacle my embedded product must to have a device role, why in the receptacle connector there is also the ID pin that can be tested by microcontroller (and so switch from device to host role)?
  2. Only the cable with mini or micro USB A plug and a USB A receptacle are USB compliant?
  3. If I'm not mistaken, many smartphones a few years ago had a receptacle mini or micro USB B but, with a particular OTG cable, they could take the role of host and read for example a PenDrive. In this case all these smartphones are not USB compliant?

Thank you in advance.

Best Answer

USB-C

If you are building a new device, use USB-C. It is much more flexible for OTG. For USB-C the connectors are the same and the roles can be decided with pull up or pull down resistors. Here is some good reading on the subject.

Other USB

USB-On the Go was added to the USB 2.0 spec as a way for a device to act as either slave or host. It does not break the compliance of a device. The posts you referenced are correct in that the host is decided by detection of the ID pin. For mini or micro USB you can attach an AB port that accepts either form-factor cable to your device. Please note, you need to build an OTG capable device to be able to sense the state of this PIN. There are several integrated chips that have this functionality built in. Whether the ID pin is grounded or floating is part of the cable.

Unfortunately, many manufacturers have chosen to build USB-OTG devices with USB-B connectors (Example) and you need a non-standard cable to make it work. This is not ideal but these cables are widely available. The good news is that if you build your device with the proper AB connector, it will still work with these cables.

USB-Types