Author Topic: How do host service each devices?  (Read 6634 times)

ChongHan

  • Member
  • ***
  • Posts: 41
How do host service each devices?
« on: November 14, 2014, 11:51:42 pm »
Hi all,

Good day. From my understanding, USB 3.0 service port to port. For example, if we want to send data to 3 connected device which they are connected to the same host controller, when we program to transmit data, we need to send the data port to port. We cannot multicast the data to all devices. Am I right?

If we transmit data to port 1 and immediately send data to port 2. So, how we know that at the time we transmitting data to port 2, is it the data from port 1  already reach at device 1?

Best regards
ChongHan

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: How do host service each devices?
« Reply #1 on: November 15, 2014, 11:07:20 am »
If your application calls a function to send the data synchronously, the call returns after the data has been sent. Then you can send data to the next port.

 

Barry Twycross

  • Frequent Contributor
  • ****
  • Posts: 263
Re: How do host service each devices?
« Reply #2 on: November 16, 2014, 01:08:11 am »
You are right there is no multicast, except for ITP packets (which are generated by the host controller).

The USB model is you send data to a device, not a port, but with USB 3 the data is routed, so it will appear on only one port of a hub (or host port). It may have to pass through hubs on the way.

At the protocol level, data is ACKed, except for isochronous. For SuperSpeed (USB 3) the data is sent on the downstream link and the device ACKs that on the upstream port. If the host doesn't receive a suitable ACK, it'll retry of eventually fail the transaction. For isochronous data, it is sent to the device and there is no way to know if it was received.

At the host controller level a transaction is added to a transaction ring, and an event is added to the event ring when the ACK is received.

The OS can use this, as Jan mentions, to complete a transaction when its ACKed or fails. Either by returning from a synchronous call, or sending an asynchronous completion.

ChongHan

  • Member
  • ***
  • Posts: 41
Re: How do host service each devices?
« Reply #3 on: November 17, 2014, 02:02:36 am »
For what i understand from Jan reply, is it there are no need to wait ACK from device for a period of time? Just (open port 1 -> send data -> close port 1) then (open port 2 -> send data -> close port 2) ..........??

Is there any waiting period for ACK at host?

Let's say I want to send a set of data to each connected device (devices as port 1, port 2 and port 3), I need to open, send date then close the port 1 by 1 right?

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: How do host service each devices?
« Reply #4 on: November 19, 2014, 11:07:15 am »
As Barry says, applications communicate with devices, not ports. An application can open a handle to a device and leave it open as long as it needs to keep communicating.

For USB 3.0, in a non-isochronous OUT transaction, the host sends a DP and the device returns an ACK, NRDY, or STALL TP.  How long the host driver waits for an ACK before giving up depends on the driver.

We can probably answer your concerns better if we have an idea of what you trying to accomplish. Are you writing a host applications or device driver? What USB class are the devices, or if they use a vendor-provided driver, what transfer type(s)?

ChongHan

  • Member
  • ***
  • Posts: 41
Re: How do host service each devices?
« Reply #5 on: November 24, 2014, 09:16:44 am »
I am trying to make a application to send a vendor command to device, and the device will send a set of data to host.

I am using Cypress FX3S peripheral controller. I connected these three controller and use Bulk Transfer to transfer the data from device to host.
My application flow as below:

1) Host send a vendor command to Device 1 to trigger it to send a set of data to host using bulk transfer.
2) After host receive the data from device 1, host will send another vendor command to device 2 and trigger the bulk transfer as same as in device 1.
3) This process continue until the host receive all the data from these 3 connected devices.

Therefore, I am afraid the data will mess up if I cannot manage to handle the data transaction from each device.

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: How do host service each devices?
« Reply #6 on: November 24, 2014, 11:41:25 am »
If you wait for completion, as in your description, you should be OK.