PORTS Forum

Ports and Interfaces => USB => Topic started by: sanjay on July 24, 2018, 11:18:41 pm

Title: Query Regarding USB OTG implementation
Post by: sanjay on July 24, 2018, 11:18:41 pm
Hi,

I want to build USB OTG communication for one of our product with dynamic switching to host to device capability.

I want to Implement following scheme
- Our target board will have USB OTG port and will be using USB 2.0 Communication. I want to connect USB to Bluetooth converter to this
USB Port and thus want to use mobile to communicate with our target board using USB.

I am newbie to USB and exploring the USB. As per my understanding about USB, target board will be work as USB Host and USB to Bluetooth 
converter will work as USB Device. Let me know if my understanding is clear.
 
I have following queries:-
- Do I need to write any code about Bluetooth on my target board?
- Which class will be used by target board for implementing as USB host?
- As my target board will work as USB Device also, how to dynamically switch from device to host or host to device mode?

Regards,
Sanjay
Title: Re: Query Regarding USB OTG implementation
Post by: Jan Axelson on July 25, 2018, 09:26:28 am
Yes, the USB/Bluetooth converter is a USB device that communicates with a USB host.

From USB Complete, Fifth Edition

http://janaxelson.com/usbc.htm

Bluetooth

USB/Bluetooth adapters convert between Bluetooth’s short-range RF wireless interface
and USB. The Bluetooth specification from Bluetooth Special Interest Group
(SIG), Inc. (bluetooth.org) defines protocols for communicating with these devices. An
adapter can be a separate device connected internally or externally, an element on a
motherboard, or a subsystem on a chip.

The specification defines two controller types. A Primary Controller has two USB
interfaces, one with bulk and interrupt endpoints and one with isochronous endpoints.
Using two interfaces enables the USB host to select an alternate isochronous
interface without interrupting pending bulk or interrupt transfers. An Alternate
MAC/PHY (AMP) Controller has one interface with bulk and interrupt endpoints.
USB Bluetooth devices use these values in the device or interface descriptor:


Descriptor     Field     Value       Description
Class            0xE0     wireless   controller
Subclass       0x01     RF           controller
Protocol        0x01     Bluetooth Primary Controller
                   0x04     Bluetooth  AMP Controller


Another option for USB/Bluetooth adapters is to use a USB/serial port adapter that
interfaces to a serial port/Bluetooth adapter. The host then uses protocols defined in
the Bluetooth UART transport layer.

For information about OTG role switching, see the OTG spec:

http://www.usb.org/developers/onthego/

and my USB Embedded Hosts book:

http://janaxelson.com/usb_embedded_hosts.htm

What kind of device programming you need to provide depends on the device hardware and the protocols you are using.


Title: Re: Query Regarding USB OTG implementation
Post by: sanjay on July 28, 2018, 02:10:51 am
Dear Jan,

I am sill not clear about which class to be used by target board for implementing as USB host when interfaced with USB to Bluetooth Dongle or USB to Bluetooth converter? Is it USB CDC class to be used in  target board for implementing USB host for interfacing USB to Bluetooth Dongle or USB to Bluetooth converter?

Is there any difference between USB to Bluetooth Dongle and USB to Bluetooth converter? are both same?

Regards,
Sanjay
Title: Re: Query Regarding USB OTG implementation
Post by: Jan Axelson on July 28, 2018, 02:39:45 pm
The USB class for Bluetooth is 0xE0 wireless controller.

Dongle and converter are the same thing.