4

I am attempting a project with USB OTG functionality. I've read quite a number of documents already but there is some contradicting information out there, so I want to find out if anyone can shed some light on a couple of things.

First some background on what I aim to achieve. I want to design a low cost device that needs some form of diagnostics interface. At the moment the idea is to have a microAB USB port which can be used to either connect to a PC, or to a custom bluetooth module(powered by the device) to connect to a smartphone for instance, the device acting as the OTG host in the latter case.

My questions are:

Is this the right type of application for USB OTG?

What is the maximum amount of current a OTG host may supply, and/or a OTG peripheral may consume? I've read a couple of places that this is only 8mA, but the USB OTG supplement to the USB2.0 spec states 8mA to 5000mA. I am more inclined to believe this spec, but I just want to make sure I am not misunderstanding something.

Lastly, can any USB pheripheral only device be connected to a OTG host provided that the driver is available, or do I need a OTG specific device.

Gustavo Litovsky
  • 7,619
  • 3
  • 25
  • 44
Merwe
  • 77
  • 2
  • 7
    5000mA???? That is 5A! USB limit is 500 mA. – Leon Heller Feb 21 '13 at 13:58
  • Yeah, I also thought it was odd, maybe there is a mistake in the spec – Merwe Feb 21 '13 at 14:03
  • 1
    OTG as a chipset/phy hardware feature does generally mean that if you have appropriate software on your device and put it with a cable or software override into host mode, you can host generic USB peripherals. However your whole scheme sounds rather complicated and may not be the best way to achieve your ultimate need. – Chris Stratton Feb 21 '13 at 16:23
  • I don't see why you are not connecting your device directly to a smartphone and instead through a custom made bluetooth device?! Is being wireless a requirement? In that case, why do you connect it to the PC via USB? It seems to me that you are overcomplicating something here. – Ali Alavi Dec 23 '13 at 19:30
  • 1
    An OTG device can actually provide a current up to 5A since this is a Host system, it isn't limited to the 500mA. OTG is an extra spec on top of the USB2.0 and it defines a current up to 5000mA (see http://www.usb.org/developers/onthego/USB_OTG_and_EH_2-0.pdf for the OTG & EH spec) – Jan Claes May 21 '14 at 13:33

2 Answers2

2

The situation you're describing is not true OTG. True OTG is when you connect two OTG devices together and they negotiate which one becomes the host. But OTG controllers do allow switching between host and device modes at run-time, so you're on the right track. An OTG host will work normally with non-OTG devices.

8mA is the minimum current that an OTG host must support on VBus. I don't see 5000 mA in the OTG spec tables. Are you sure you're not looking at battery charging? Regardless, you should check the specs for the Bluetooth device to see what current it needs, then design to meet that.

Adam Haun
  • 21,331
  • 4
  • 50
  • 91
  • So there are OTG hosts (like smartphones) which will reject a USB device that requests 100 mA because it's too much current? But all traditional USB hosts are required to provide 100 mA minimum before enumeration, right? – endolith Jul 05 '16 at 21:06
  • 1
    I don't know if any OTG hosts would actually reject a 100mA request, but it's theoretically possible. – Adam Haun Jul 06 '16 at 06:09
  • From what I've read, a standard USB peripheral that wants to communicate with an OTG Host needs to support "Data-line Pulsing" or "VBUS Pulsing", and I guess VBUS is just not provided otherwise, so a normal device can't connect to these hosts anyway? – endolith Dec 17 '20 at 17:02
  • 1
    If I remember right, the peripheral only needs to support VBUS pulsing if it wants to use the host negotiation protocol to take over the host role. The default host/device assignment is set by the cable, which ties the ID pin to ground (?) on the host side. HNP happens after enumeration. VBUS is always present, and all self-powered devices MUST monitor it to be spec-compliant, whether they're OTG or not. – Adam Haun Dec 17 '20 at 22:19
0

You don't actually describe a usb OTG situation. The first option, connecting to a PC would be normal usb slave. The second option, using bluetooth to connect to a smartphone doesn't include usb in any way.

And yes, USB OTG allows for any peripheral to act as a usb slave without change, as long as the USB OTG Host knows what to do with it. This is why 12 year old (Like 32mb) usb flash drives still work on OTG Hosts. That's the point of OTG Hosts, they act as a regular host when needed, the only limitation is the manufacturer's support for different devices.

Passerby
  • 72,580
  • 7
  • 90
  • 202
  • 2
    I don't think you read the question carefully enough. The OP is connecting via USB to a PC (OP's device is a peripheral) or to a Bluetooth module (OP's device is the host). The Bluetooth module is then providing a wireless link to a cell phone. – DrFriedParts Feb 22 '13 at 03:50
  • 1
    @DrFriedParts You mean OP means he is going to connect it to a commercial USB Bluetooth Adaptor, instead of a serial/spi bluetooth module? That seems like a kinda roundabout exercise in frustration. OP needs to clarify. – Passerby Feb 22 '13 at 04:38
  • @Passerby, that is correct, although I am not going to try to connect tor a commercial Bluetooth module, but a custom design, meaning an off the shelf bluetooth module designed to be incorporated into ones hardware without going through all the RF drama. The reason for this "roundabout" way of doing things is to keep the cost of the device it is connected to to a minimum, since the Bluetooth will only be used for diagnostics, and does not always have to be connected(a USB-OTG enabled MCU is relatively cheap). An installer then only has to have one Bluetooth module for multiple devices. – Merwe Feb 22 '13 at 05:49
  • @Merwe Do you have a link to said module? Because a common one is a serial/uart to bluetooth one like the HC-05 and HC-06 ones on ebay. No usb needed. – Passerby Feb 22 '13 at 07:25
  • @Passerby, the module I intent to use has both a UART and USB interface. The reason I want to use the USB is in order to be able to connect to a PC as well, without having to have some kind of TTL to serial/USB converter. The link: http://www.rovingnetworks.com/products/RN52 – Merwe Feb 22 '13 at 08:28
  • @Merwe, I have used RN52 but that was interfacing with the microcontroller through UART. I reckon if you want to use it with the USB, check how to connect the module to USB. I hope you don't have to use a middle man such as a USB converter at the module runs on 3.3V. Correct me if I'm wrong I would like to know if USB communication works with this module – David Norman Jun 22 '13 at 02:50
  • @David Norman, the project I intended to use this on got put on the back burner, and I switched jobs in the meantime, so I never actually got to use one of these modules. As far as I understand, in order to use the USB interface on these devices, it has to be used in HCI mode, which means that the Wi-Fi stack has to be implemented on an external processor, as opposed to using SPP mode with the UART interface, where the stack on the module is used. – Merwe Jun 24 '13 at 06:48
  • @Merwe, oh k well if you get back on the project let me know. I have got the module to work with the micro but not through USB and I want to know how it reacts with the USB. – David Norman Jun 24 '13 at 23:52