Friday, 29 November 2013

Latency Tolerence Messaging in USB

USB: Enable Latency Tolerance Messaging (LTM):

USB 3.0 devices may optionally support a new feature called Latency Tolerance Messaging.  If both the xHCI host controller and the device

support LTM, it should be turned on in order to give the system hardware a better clue about the latency tolerance values of its PCI devices.

Once a Set Feature request to enable LTM is received, the USB 3.0 device will begin to send LTM updates as its buffers fill or empty, and it can tolerate more or less latency.

The USB 3.0 spec says that LTM should be disabled just before the device is placed into suspend.  Then the device will send an updated LTM notification.

So that the system doesn't think it should remain in an active state in order to satisfy the latency requirements of the suspended device.

The Set and Clear Feature LTM enable command can only be sent to a configured device.  The device will respond with an error if that command is sent while it is in the Default or Addressed state.

Make sure to check the status of LTM. LTM should be enabled once a new configuration.  If we end up sending duplicate Set Feature LTM Enable commands on a switch from one installed configuration to another

configuration, that should be harmless. Make sure that LTM is disabled before the device is unconfigured. If no drivers are bound to the device, it doesn't

make sense to allow the device to control the latency tolerance of the xHCI host controller.

USB 3.0 ARCHITECTURE

USB 3.0 ARCHITECTURE:

Physical Layer:

        The physical layer defines the PHY portion of a port and physical connection between the Host and Device.

The physical connection consist of two differencial data pairs with signalling rate 5Gbps.

In electrical aspects the path are characterised as a Transmitter,Channel and Receiver.

In electrical level each differencial link is initialised by enablink its receiver termination.

The transmitter is responsible for detecting the far end device information as an indication of a bus connection and informing the link layer so the connect status can be factored into link operation and management.

USB 3.0 cables have separate shielded differential pairs of lines for transmitting and receiving data. These lines exist along with the USB 2.0 signals.

Thus, a USB 3.0 cable contains a total of 9 pins, including the 4 pins which are part of USB 2.0 cable. The maximum length of a USB 3.0 cable is limited to 3 meters due to the high signaling rate that it supports.

As for the power distribution by the USB 3.0 host, 150mA is considered as the unit load. The USB 3.0 host supplies 1 unit load of current for unconfigured devices and 6 unit loads of current for configured devices.

The USB 3.0 host detects the device connection based on the receiver end termination, and the transmitter is responsible for doing this action. USB 3.0 uses spread spectrum clocking on its signaling.

Spread spectrum clocking spreads the energy of the signal over a larger frequency band rather than concentrating it over a small frequency band at a high level. This helps to reduce EMI emissions.

The USB 3.0 physical layer supports Low Frequency Periodic Signaling (LFPS) which is used to manage signal initiation and low power management on the bus to consume less power on an idle link.


Link layer:

The link layer is responsible for maintaining a reliable and robust communication channel between the host and device. The Link Training and Status State Machine (LTSSM) is the core of the USB 3.0 link layer and defines link connectivity and link power management states and transitions.

 LTSSM consists of 12 states:

 Four link power states for better power management:
       
    U0 – normal operational mode
       
    U1 – Link idle with fast exit (PLL remains on)
       
    U2 – Link idle with slow exit (PLL may be off)
       
    U3 – Suspend
       
    U1, U2, U3 have increasingly longer wakeup times than U0, and thus allow transmitters to go into increasingly deeper sleep.
   
    Four link initialization and training states (Rx.Detect, Polling, Recovery, Hot Reset).
   
    Two link test states (Loopback and Compliance Mode).
   
    SS.Inactive (link error state where USB 3.0 is non-operable).

        SS.Disabled (SuperSpeed bus is disabled and operates as USB 2.0 only).

Link commands are used to maintain the link flow control and to initiate the change in link power state.


Protocol layer:

The protocol layer defines the communication rules between a host and device. USB 2.0 transactions consist of 3 packets: token, data, and handshake.

A transaction is initiated with the token packet and this is always from the host. Data packets deliver the payload data and can be sourced by the host or device. Handshake packets acknowledge the error-free receipt of data and are sent by the receiver of data.

In the case of SuperSpeed, however, to save bandwidth the token is incorporated into the data packet for OUT transactions. The token is replaced by the handshake for IN transactions; i.e., an ACK packet acknowledges the previous data packet that has been sent and requests the next data packet.

USB 3.0 packets are routed to the specific device with the help of the route string in the packet header. USB 3.0 does not poll for the readiness of the devices. If a device responds with “NRDY” (Not Ready) to an IN Transaction Packet (TP) from the host, then the host stops talking to that device until the device sends the “ERDY” (ready) packet saying that now it is ready to transmit the data.

USB 3.0 supports transmitting data in bursts (multiple data packets) without receiving an acknowledgement. The protocol allows efficient bus utilization by concurrently transmitting and receiving over the bus. A transmitter (host or device) can burst multiple packets of data back-to-back while the receiver can transmit data acknowledgements without interrupting the burst of data packets.

Also, the host may simultaneously schedule multiple OUT bursts to be active at the same time as IN bursts.

USB 3.0 has enhanced the bulk capabilities of USB 2.0 by adding a protocol called “Stream”. This allows you to accept multiple commands on a pipe from the host, and allows you to complete them out of order using the stream IDs.

USB 3.0 INTRODUCTION

USB 3.0:

Universal Serial Bus 3.0 (USB 3.0) is a hardware communication interface used to connect peripheral devices to a computer. It is the third generation of the USB interface developed in 2008 and standardized by USB Implementers Forum (USB-IF).

The USB 3.0 interface provides a faster data transfer rate (DTR) than previous USB versions. USB 3.0 uses a dual-bus structural design, whereas earlier versions use a serial interface.

The USB 3.0 also replaces device polling (checking connections or determining the need to communicate) with an interrupt architecture protocol.USB 3.0 is also known as SuperSpeed USB.

A USB 3.0 device may be plugged into a USB socket and used as a USB power supply for direct current (DC) in connecting portable devices.

Compared to older USB versions, the USB 3.0 provides various features:

        1.Higher DTR of up to 5 Gbps
   
    2.Decreased power consumption
  
    3.Higher speed connectors and cables
   
    4.Backward compatible with USB 2.0
   
    5.Better power management structure
   
    6.Support of bulk and isochronous transfers
   
    7.Up to 80 percent more power with configured devices
   
    8.Up to 50 percent more power with non-configured devices
   
    9.Replaces device polling with interrupt architecture protocol
   
    10.Supports full-duplex data transfer using dual-bus architecture
   
    11.Supports a a power savings mode when idle (by either the computer or a device)

The USB 3.0 has 4-pin architecture, versus earlier versions. The USB 3.0 Type A plugs and sockets are backward compatible with USB 2.0, but USB 3.0 Type B plugs do not accept earlier socket versions.

The USB 3.0 was designed to increase power input, decrease power consumption and increase DTR speed. Currently, the USB 3.0 standard supports a DTR of up to 5 Gbps. Typically, the throughput is 4 Gbps, and the USB-IF considers a DTR of 3.2 Gbps attainable.

USB 3.0 have 8 primary conductors.Three usb twisted pair for USB data paths(D+,D-,SSTX+,SSTX-,SSRX+,SSRX-,GND,VBUS).

The power management of USB 3.0 is same as that of USB2.0 and Power distribution over the USB 3.0 deals with the issue of how USB devices consume power for downstream ports to which they are connected,It is similar to USB2.0 with increased suuply for device operating at super speed.

Earlier versions of USB used a device polling method, in which the host controller periodically looks for active data traffic. USB 3.0 replaced this method with an interrupt-based protocol, in which the devices “interrupt” the host by sending it a signal to begin data transfer.

This prevents any connected but non-active or idle devices (those not being charged by the USB port) from causing power drain by the host controller as it continually “polls” for data traffic.

Legacy 2.0 devices will benefit from this feature as well, as it is backward compatible with USB 2.0 certified devices.

Not only does USB 3.0 deliver a welcome increase in data transfer speed, it carries a heftier punch of power as well. USB 2.0 is unable to provide enough power for many devices, requiring these peripherals to use either two USB ports or their own power source in addition to the one USB connection.

USB 3.0 addresses this need with a substantial boost in its power output that will enable users to power and charge more devices, more quickly. This specification is often cited in general terms as an increase from USB 2.0’s 500 mA output to the 900 mA USB 3.0 specification.

This increase in current will also enable USB hubs to support more peripherals as well as allow even more power-hungry devices to charge via USB. so the most battery powered devices will also charge faster. 

USB 3.0 products and applications:

As the transition to USB 3.0 continues, many 2.0 devices will continue to be successfully deployed, taking advantage of the backward compatibility of the interface as the market moves toward mainstream adoption of USB 3.0.

Topping the list of applications best served by USB 3.0 are high-bandwidth devices that

currently challenge the throughput capabilities of USB 2.0, including:

    1.External hard drives (2–3 times faster than USB 2.0 predecessors)

    2.High-resolution webcams and video surveillance cameras

    3.Video display solutions

    4.Digital video cameras and digital still cameras

    5.Multi-channel audio interfaces

    6.External media such as Blu-ray drives

    7.High-end flash drives, particularly when multiple devices are attached via one USB hub

Monday, 4 November 2013

DIFFERENCE BETWEEN MSC VS MTP

MSC(Mass Storage Class)

    MSC, Mass Storage Class, is the mode originally used on devices such as external hard drives, CD and DVD drives, flash memory drivers, gaming systems, digital cameras and music devices connected to your USB port.

MTP(Media Transfer Protocol)

    MTP, Medial Transfer Protocol, was developed by Microsoft and is also used to transfer data between your computer and devices connected to it.

MTP:

1. Can copy files over  and then access on them on the device without mounting/unmounting

2. File transfer is available immediately when plugged in without having to mount

3.while in MTP mode we can use other functions of the Mobile Device.

4.No limitations for file size to be transfered.

Mass storage Class:

1. Better security since you have to get past the lock screen to mount

2. Is actually a real drive in Windows, so you can do all operations normally

3.While in MSC Mode we cannot use other functions of the mobile device.

4.Limitations for File size to be transfered-Only 4GB in size can be transfered.