Author Topic: The MCU USB device mode right definition  (Read 15168 times)

Sandro

  • Member
  • ***
  • Posts: 6
The MCU USB device mode right definition
« on: April 21, 2016, 11:23:31 am »
Hello!


Please see the small self-powered multimedia system application
schematic ( https://goo.gl/photos/JE1hcHvK1KfiGtf27 ).
 
The iDevice (iPhone, iPod) audiodata source sends the audiodata by the
USB-interface to the AudioDAC (or to other multimedia processing
device) thru the hub IC.

The Microcontroller (MCU) with the Control Panel is intended to
control the iDevice thru USB interface too.

The MCU can send control commands (as the standard USB HID codes) to
the iDevice.

The MCU, hub IC and the multimedia processing device are connected
between each other permanently.

The iDevice is connected to the upstream port of the TUSB2036 hub IC
( http://www.ti.com/product/TUSB2036 ) thru the Apple Lightning to USB
Camera Adapter Cable:

http://www.apple.com/shop/product/MD821AM/A/lightning-to-usb-camera-adapter

This multimedia system is not supplying power to the hub upstream port
and to the iDevice.


Would you please help me with the question:

What type of the MCU USB-class device should be (USB-Host, USB-Device, USB-OTG)?


Regards,
Sandro
« Last Edit: April 21, 2016, 04:19:48 pm by Sandro »

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: The MCU USB device mode right definition
« Reply #1 on: April 21, 2016, 11:45:49 am »
Your device functions as a USB device. The iphone is the host. The device doesn't need OTG support.

Does the iphone support the hub and the devices you are attempting to attach through the hub? See:

http://stackoverflow.com/questions/9178456/how-to-connect-an-ios-device-to-a-custom-usb-device

Sandro

  • Member
  • ***
  • Posts: 6
Re: The MCU USB device mode right definition
« Reply #2 on: April 21, 2016, 04:37:54 pm »
Thank you, Jan for the fast answer.


* Your device functions as a USB device. The iphone is the host. The device doesn't need OTG support.*

Why so?

After all, the MCU sends its control commands to iDevice, i.e   c o n t r o l l i n g   the iDevice.

This is the host function?

It’s not true?


Thanks for the additional link.

There is a positive experience in connecting iPhone to the self-powered audio-DAC thru the hub:
http://blog.jdslabs.com/?cat=57

But there is no iPhone external control by any MCUs.

What you say?


Regards,
Sandro
« Last Edit: April 21, 2016, 04:39:25 pm by Sandro »

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: The MCU USB device mode right definition
« Reply #3 on: April 22, 2016, 09:34:25 pm »
A USB hub has one upstream-facing (toward the host) port and two or more downstream-facing (toward the device) ports. In your diagram, the hub's upstream-facing port connects to the iphone. Thus the iphone is the host.

Sandro

  • Member
  • ***
  • Posts: 6
Re: The MCU USB device mode right definition
« Reply #4 on: April 22, 2016, 09:38:12 pm »
Thank you, Jan.


*The device doesn't need OTG support.*

It is still uncear why so?

Can you clarify it?


Regards,
Sandro

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: The MCU USB device mode right definition
« Reply #5 on: April 23, 2016, 08:55:52 pm »
OTG is for products that can function both as a USB host and as a USB device. For example, if your device could also connect and communicate with a camera, flash drive, mouse, etc. An OTG device must have a micro-AB connector.

Sandro

  • Member
  • ***
  • Posts: 6
Re: The MCU USB device mode right definition
« Reply #6 on: April 23, 2016, 09:18:28 pm »
OK.

My device could connect and communicate with an iDevice only, not more.

1.   Do you want to say that the MCU should  a l w a y s  be (in my application) an USB-Device, not an USB-Host?
So or not?

2.   It does not contradict that the MCU should send the USB HID-code commands to the iDevice thru USB?
It is seems that sending of commands is the Host function, or not?

Regards,
Sandro

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: The MCU USB device mode right definition
« Reply #7 on: April 24, 2016, 10:13:27 am »
The upstream-facing port of a USB hub, as shown in your diagram, must connect to a host or a downstream-facing port of another hub.

If you want your MCU to also be able to communicate with a USB device (camera, drive, mouse, etc.), it will need to be able to function as a host and thus will need be an OTG device.

A USB HID-class device can send data to the host in response to received control requests (Get Input Report, Get Feature Report) on the control endpoint or in response to received IN token packets on the interrupt IN endpoint. The device cannot send control requests.

Sandro

  • Member
  • ***
  • Posts: 6
Re: The MCU USB device mode right definition
« Reply #8 on: April 25, 2016, 11:27:55 am »
OK.

Thank you, Jan.


*A USB HID-class device can send data to the host in response to received control requests (Get Input Report, Get Feature Report) on the control endpoint or in response to received IN token packets on the interrupt IN endpoint. The device cannot send control requests.*

It is possible for the HID device to send its interrupt requests to the USB-Host (and thru the Hub too)?

And if yes, many of the USB-MCU on the market can support this function usually?


Regards,
Sandro

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: The MCU USB device mode right definition
« Reply #9 on: April 25, 2016, 12:15:48 pm »
When a device has an interrupt IN endpoint, the host polls the endpoint at a frequency determined in part by the maximum latency specified in the device's endpoint descriptor. In response, the endpoint sends data if available or NAK if not.

So the device doesn't initiate the communications, it just responds to the periodic requests for data from the host.

Sandro

  • Member
  • ***
  • Posts: 6
Re: The MCU USB device mode right definition
« Reply #10 on: April 26, 2016, 08:00:08 am »
Thank you very much.

Sandro