CR4® - The Engineer's Place for News and Discussion®


Previous in Forum: Electromagnetic Disturbance at Sound Bandwidth   Next in Forum: Wire Crimping Dies
Close
Close
Close
9 comments
Guru
Hobbies - Musician - New Member Greece - Member - New Member

Join Date: Mar 2007
Location: Greece / Athens
Posts: 723
Good Answers: 28

Question About USB OTG

04/26/2017 12:16 PM

Hello everybody. I have a question about the USB OTG (On-The-Go) configuration.

It is known that we can connect two OTG devices via an OTG cable which has a Micro-A plug on the one end and a Micro-B plug on the other end. The device where the Micro-A is connected, becomes a "Host" and a "power supplier" (i.e. it supplies power to the USB cable). The device where the Micro-B is connected, becomes a "Slave" and a "power consumer" (i.e. it consumes power from the USB cable). (This setting occurs via the OTG ID pin of the Micro plugs.) However, the role of these two devices may change -if this is necessary- automatically, via the HNP protocol (i.e. without an inversion of the OTG cable). So, the (initially set as) "Host" becomes a "Slave" and vice versa. My question: Do the "power supplier" and "power consumer" roles also change via the HNP (in accordance with the change of the "Host" and "Slave" roles)??? Or the "power supplier" and "power consumer" roles are not affected by the HNP protocol and depend only on the direction of the OTG cable???

__________________
George
Register to Reply
Interested in this topic? By joining CR4 you can "subscribe" to
this discussion and receive notification when new comments are added.

Comments rated to be Good Answers:

These comments received enough positive ratings to make them "good answers".
Guru
Safety - Hazmat - New Member United States - US - Statue of Liberty - New Member Engineering Fields - Chemical Engineering - Old Hand

Join Date: Mar 2011
Location: Lubbock, Texas
Posts: 13540
Good Answers: 155
#1

Re: Question about USB OTG

04/26/2017 12:31 PM

You mean it does not have to do with which device has power already supplied? Couldn't that cause some serious problems, as in internal shorting from the "slave" device power (that is present), through the "host" device and back to ground without much of a resistance?

I have never experienced that, but have worked with "slave" units like Arduino that have an alternate power in connection that is not USB.

Other data loggers I have used, depend on the USB for power from the "host" computer (the ones that are not stand-alone types), and also depend on sending data to the "host" as well, as all these do is process signals and transmit then to "host" memory in storage file. They offer such niceties as on stream data graphing, etc. (again through the "host"). I have plugged them in as reverse order with no ill effect whatsoever, since nothing happens until power arrives from "host".

__________________
If it ain't broke, don't fix it. Just build a better one.
Register to Reply
Guru
Hobbies - Musician - New Member Greece - Member - New Member

Join Date: Mar 2007
Location: Greece / Athens
Posts: 723
Good Answers: 28
#3
In reply to #1

Re: Question about USB OTG

04/27/2017 4:37 AM

Hi James. I don't mean that this is something that I experienced. It's rather a general question, as I want to study some scenarios for a project. So, let me put it in other words in order to be more clear.

Let's assume that we have two devices -device#1 and device#2- connected through an OTG cable. The Micro-A plug is connected to the device#1 and this device (initially) becomes a Host and a "power provider" while the Micro-B plug is connected to the device#2 and this device (initially) becomes a Slave and a "power consumer". Let's suppose that the device#1 -by its nature- is not supposed to be the Host. So, the HNP protocol takes action and changes the role of these two devices, i.e. the device#1 becomes the Slave and the device#2 becomes the Host. My question is the following: does the device#2 (which is now the Host) become also a "power provider" (or the device#1 is still the "power provider" due to the OTG cable's connection)???

__________________
George
Register to Reply
2
Guru
Engineering Fields - Power Engineering - New Member

Join Date: May 2007
Location: NYC metropolitan area.
Posts: 2995
Good Answers: 416
#5
In reply to #3

Re: Question about USB OTG

04/27/2017 10:18 AM

There's a lot of "stuff" going on behind the scenes in USB devices. The answer is buried in the Wikipedia article. The micro-A male connector has pin 4 connected to pin 5, this tells the USB port that it's connected to that "you're the power source" and prevents any other powered device from supplying the power to the cable. Look in the article for ADP (Attach Detection Protocol), SRP (Session Request Protocol) and HNP (Host Negotiation Protocol), the first two control the power, the latter controls the software.

Here's a good article on how to make your own OTG host cable.

__________________
Curious minds want to know, engineering minds get answers....
Register to Reply Good Answer (Score 2)
Guru
Safety - Hazmat - New Member United States - US - Statue of Liberty - New Member Engineering Fields - Chemical Engineering - Old Hand

Join Date: Mar 2011
Location: Lubbock, Texas
Posts: 13540
Good Answers: 155
#6
In reply to #5

Re: Question about USB OTG

04/27/2017 11:09 AM

Thank you for clearing us up on it.

__________________
If it ain't broke, don't fix it. Just build a better one.
Register to Reply
Guru
Hobbies - Musician - New Member Greece - Member - New Member

Join Date: Mar 2007
Location: Greece / Athens
Posts: 723
Good Answers: 28
#7
In reply to #5

Re: Question about USB OTG

04/27/2017 11:52 AM

Hi RAMConsult.

You said: "The micro-A male connector has pin 4 connected to pin 5, this tells the USB port that it's connected to that "you're the power source" and prevents any other powered device from supplying the power to the cable. "

Yes, I know that. (I have already mentioned this in my initial post.)

You said: "The answer is buried in the Wikipedia... Look in the article for ADP (Attach Detection Protocol), SRP (Session Request Protocol) and HNP (Host Negotiation Protocol), the first two control the power, the latter controls the software."

As I said, I have already read this part of the article. And I read it again. Unfortunately, it doesn't say anything useful (at least concerning my question). (Specifically: ADP: Host provides power only when a Slave device is connected. ARP: Host provides power only if the Slave requests for power. HNP: The two devices exchange "Host" and "Slave" roles automatically as needed.) Again, my question is the following: if a Slave device becomes a Host device (due to the HNP action) does this device becomes a "power provider" too (despite the direction of the OTG cable)???

__________________
George
Register to Reply
Guru
Engineering Fields - Power Engineering - New Member

Join Date: May 2007
Location: NYC metropolitan area.
Posts: 2995
Good Answers: 416
#8
In reply to #7

Re: Question about USB OTG

04/27/2017 4:12 PM

No, the device that has the micro connector with pin 4&5 jumpered and plugged in determines the power source until it is disconnected. It's a hardware decision.

Here's a link to the original spec as published by USB.ORG, I hope you like to do a lot of reading!!

__________________
Curious minds want to know, engineering minds get answers....
Register to Reply
Guru
Hobbies - Musician - New Member Greece - Member - New Member

Join Date: Mar 2007
Location: Greece / Athens
Posts: 723
Good Answers: 28
#9
In reply to #8

Re: Question about USB OTG

04/28/2017 5:56 AM

Thanks for the answer.

I had already taken a look at this link.

__________________
George
Register to Reply
Guru

Join Date: Apr 2010
Posts: 5752
Good Answers: 576
#2

Re: Question about USB OTG

04/26/2017 1:12 PM

It's quite complicated. Maybe this explains it:

https://en.wikipedia.org/wiki/USB_On-The-Go

See the Protocols section...

(I have a Seek thermal camera and a USB endoscope and the phone knows which is connected. Pretty remarkable! )

Register to Reply
Guru
Hobbies - Musician - New Member Greece - Member - New Member

Join Date: Mar 2007
Location: Greece / Athens
Posts: 723
Good Answers: 28
#4
In reply to #2

Re: Question about USB OTG

04/27/2017 4:58 AM

Hi Rixter. I had already read this section of Wikipedia and -unfortunately- it doesn't answer my question. Please, read my post#3 in order to understand my initial question better.

__________________
George
Register to Reply
Register to Reply 9 comments
Interested in this topic? By joining CR4 you can "subscribe" to
this discussion and receive notification when new comments are added.

Comments rated to be Good Answers:

These comments received enough positive ratings to make them "good answers".
Copy to Clipboard

Users who posted comments:

G.K. (4); James Stewart (2); RAMConsult (2); Rixter (1)

Previous in Forum: Electromagnetic Disturbance at Sound Bandwidth   Next in Forum: Wire Crimping Dies

Advertisement