Confusion about ID-pin used in USB-OTG

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Confusion about ID-pin used in USB-OTG

32,954 Views
allankliu
Contributor III

KL25Z is one of cheapest microcontrollers with USB-OTG. I am going to design a USB-OTG board as Android peripherals, something like ADK, USB host shield for Arduino, IOIO based upon PIC24F256.

I have following components:

  • Samsung Galaxy Nexus i9250 as Android equipment, with USB host controller APK;
  • FRDM-KL25Z, which is configured as USB device only. Therefore, I can only use its as USB CDC device and its OpenSDA debugger for external target;
  • KL25Z128 sample, to be applied from Freescale, for my new OTG board.
  • TPS2055A USB power switch, to turn on/off VBUS from my new OTG board.
  • LDO for on-board circuit 3.3V, KL25Z128 on-chip LDO is used as backup via a jumper.

Now, I am confused about ID-pin in mini/macro A/B sockets and cables.

I have a micro B OTG cable with i9250, which is macro B plug (to mobile) and standard A acceptance. By chaining it to other cables, including standard A-standard B, standard A-mini B, standard A-macro B, it works flawlessly with many USB devices, such as ST-Link debugger (B), FRDM-KL25Z OpenSDA debugger (mini B), CDMA feature phone (macro B).

Since macro B-Standard A acceptance plus standard A-macro B cable becomes a macro B to macro B cable. I swap the plugs between Nexus and other macro B devices. I found the VBUS output is disabled after swap. After checking specification, this chaining cable is not encouraged, and its blocks ID-pin, because ID-pin is not available in standard A sockets. Therefore, ID-pin of OTG cable must be always be GND. And ID-pin of standard A-macro B cable must be always open or 1MOhm to GND.

What kind of OTG cable is best choice if I want a single cable for connecting OTG devices? I can not find many macro A cable from the market, including macro A-macro B cables. Although macro A/B acceptance is available. Actually mainstream OTG devices usually use macro B acceptance, or mini A/B acceptance like M52259DEMOKIT. Can I use macro B acceptance in device A as well as device B?

How ID-pin be detected by A/B devices? According to USB spec, if ID-pin is GND, it is device A, if ID-pin is open, it is device B. Device A source VBUS. After HNP, VBUS will be switched to device B. However, how this happens if ID-pin is connected both devices? It only makes sense if ID-pin is isolated between A/B, otherwise grounded ID-pin will be read by both devices and start VBUS contention.

What is suggestion on A/B devices' acceptances, GND or open? If ID-pin ground and open is done in cable, ID-pin of socket should be open. PC USB cable is ignore ID-pin and always offer VBUS. If ID-pin is grounded, then device will always offer VBUS as well.

Is it necessary to detect VBUS with ADC? I am always afraid of VBUS contention, is that necessary?

I found anther thread for ID-pin as Re: Kinetis K40 USB OTG

An external PHY is used, it seems ID-pin is programmable. Why a OTG device wants to define different type by programming ID-pin?

0 Kudos
1 Reply

5,233 Views
allankliu
Contributor III

After internet research, I found some pix describes USB macro A to macro B cable. Obviously, ID-pin in device A is always grounded, and ID-pin in device B is always open. The ID pins of each side are disconnected in cable.

As a result, device A detects grounded ID-pin should offer VBUS, and device B detects open-ended ID-pin should not offer VBUS. Device B can only source VBUS after HNP negotiation.

Sorry for Chinese in attached pix, but it is quite clear. Meanwhile USB user guide KLQRUG.pdf (pg98) presents OTG schematics as well.

USB_ID.gif