Electronic – How to connect USB mini-b pins on a PCB


I want to design a PCB which contains either PIC24FJ128GA010 or PIC24fj256gb110 (still haven't decided). Now the second contains a USB 2.0 on the go and the first one doesn't. I want to power the board through USB for prototyping purposes.

Through some research I found out that USB mini-b has 5 pins, 4 as usual for D+, D-, VDD and ground. The 5th pin can be connected to ground by a USB host and not connected for a USB device. Does that mean that the MCU may behave as either device or host not both or what ? and how to connect it to each of the MCU above ? and do you suggest other USB types ?

Best Answer

The fifth pin is used as an ID pin for USB-OTG (a protocol in which a device can assume both host and guest status over USB). When this pin is tied to ground by a mini-A cable or OTG adapter, it specifies for the MCU to act as a USB host, while if it is floating, it acts as a guest. There are other intermediate resistances that can be placed between the ID pin and ground to allow a device to act as a host but to receive power from the guest or a special adapter but it's not standardized or well-supported.

According to this spec, PIC24F UUSB modules support USB-OTG. They have a specific USBID pin as listed in the datasheet. For example, the PIC24FJ128GA010 has it on pin 51 (as it is a 100-pin device that is documented by this datasheet. See pages 5 and 6.

A word on connectors: Mini-A, Mini-AB, and Micro-AB receptacle will accept an OTG adapter/cable. If that is undesired, use a Mini-B or Micro-B receptacle instead. Note that all Mini forms other than Mini-B are deprecated. Additionally, if you want only host functionality, you can pull USBID to ground and connect a USB A receptacle as a USB-OTG adapter would.

Don't forget about trace length matching for D+ and D-, as well as a ground plane under them.