SESSION#1 (10/OCT/2020)

Course overview:

  1. 6 weeks
    3.5 hours/session

Notes:

  1. USB3.0
    o superspeed
    o data rate = 5 Gb/s
    o 8b/10b encoding
    o for every 8 bits of data, we are encoding it in to 10 bit format
    o effective data transfer rate = 5 * .8 = 4 Gbps = 500MB/s
  2. USB3.1, 3.2
    o superspeedPlus
    o data rate = 10 Gb/s, 20Gb/s
    o 128b/132b encoding
    o for every 128 bits of data, we are encoding it in to 132 bit format => we are cosnuming 4 bits more for every 128 bits
    o effective data transfer rate = 10 Gbps * 128/132 = 1.21GB/s
  3. To acheive various requirements
    o USB protocol implements features in to different layers(more inline with OSI : 7 layers)
    o USB3.x
    o Protocol layer
    o Generates the packets
    o handling incomding pakcets and forward it to next connected devices
    o Link layer
    o Link integrity checks, flow control, power management
    o LTSSM : low power capabilities, error recovery, configuring the link for link parameters
    o U1, U2, U3 => various level of power saving
    o Physical layer
    o handling lower level asepcts of the link
    o encoding, clock recovery, serializaiton, de-serializaiton
  4. USB topology
    o Host
    o Interconnect
    o Device
    o hub (type of device)
  5. WHy USB is called host centric protocol?
    o everything at any point of time is completely scheudled by the Host
    o offcourse function has right to stay, I am busy, I got in to error => Even for this to happen, it is the Host which most of the times initiating that whole transaction.
    o Laptop => Host
    Pendrive => Function
    Cable => Interconnect
  6. what is USB Hub?
    o A USB topology component which has one Upstream port and multiple downstream ports (tehcnical definition)
    o USB topology supports connecting up to 127 devices
  7. Any port that is facing towards Host is Upstream port
  8. Any port that is facing away from Host is Downstream port
  9. Every USB connection is a end to end connection(host to device connection)
    o E2E = multiple Port2Port connection
    o Port2Port : 1 Downstream port connected to 1 Upstream port
    o Device only has upstream ports only
    o Host only has downstream ports only
    o Hub is mix of upstream and downstream ports
  10. The data rate of USB specification is it fixed to the generated specified speed?
    o Yes. data rate is fixed
    o if there is nothing to transfer
    o USB link will either enter in to low power state (U1, U2, U3)
    o USB will transmit idle symbols(does not add to actual bandwidth)
    => However when transfers do happen, they will happen at scheudled data rate.
  11. If data rate is fixed, how USB is backward compatible?
    o USB3.x connections
    o USB3.x connections + USB2.0 connections
    o USB3.x link(wire) : will have both SS wires + USB2.0 wires
    o USB3.x Hub : will have SS hub + HS/FS hub
    o USB device : eiterh USB3.x based or USB2.0 based
    o USB Host : also has SS related controller and driver + USB2.0 related controller and driver
  12. Pins in different USB generations
    USB2.0 => 4 pins (D+, D-, V+, Gnd)
    USB3.x => 8 pins (SSTx+, SSTX-, SSRX+, SSRx-, V+, Grn)
  13. USB topology compulsory requires host.
    o processor in turn communicates with USB Host (AXI, AHB or nay other on-chip protocol)
  14. if no new data transfers are added in USB4, is the changes only in PHY?
    o USB4 supports various otehr technology Tunneling
    o PHY is not respondible for creating the packet or encpasulating the packets.
    o it is the upper layer resposbiluity
    o configuraiton layer
    o adapter layer
  15. what are the componetns inside the Hub?
    o Hub is kind of routing logic
    o when packet comes at upstream ports, it is responsible for routign it to one of teh DS ports, vice versa.
  16. when we say USB is working 480Mbps, it is the link data rate, not the effective data transfers
    o I need to send 1MB of data => there will be lot of overhead added due to other packets being invovled and otehr framing that is invoeld.
  17. Hub works some what to similar to Switch
    o but not exactly switch
    o Switch has fixed port to which it is going to send the packet
    o Hub broadcasts the packet to all teh devices(till USB2.0)
  18. Concept of descriptors in each hub/device, through which Host knows what type of device is connected
    How host differentiate the device connected is whether hub or usb 2.x/3.x device??
  19. if large number of devices are connected then timeout may happen, how is it handled?

20 Can we control hub to communicate with only 2 devices even though it connected to more than 2 devices
o it is not possible

  1. How the enumeration happens between Hub and device for USB 2.0 ??
  1. USB protocol by itself it not a soruce or not a sink of the data.
    o it only facilitates very high speed data transfer between Host and funciton controller, with lower power consumption, proper error handling, interrupt handling.
    o Host has a buffer memory <—-> Function controller has assosiated data buffers(technically called as Endpoints)
    USB2.0 helps establish this conneciton between HOst memory and FUnction controller memory
    SPI : also a medium for data transfer
  2. UTM acts as USB2.0 PHY
    o one side interfaces with USB line(D+,D-)
    o otehr side with USB2.0 core
    o UTM de-serializes the data coming on D+/D-, gives this data in 8b format to USB2.0 core
    o if we put togetehr 8b data patterns => they are group packets => SOF, Token packet, Data packet, Handshake, pacekt, special packet
    o USB2.0 core understands what type of packet is coming, it figures out how to respond to those packets.
    o Through above packet USB2.0 core figures out whether data write is happening(writing in to pendrove), data read is ahppening
    o it gives this details(write or read) to Function controller(ex: printer, music player, pendrive storage)
    o FUnction controller inturn eitehr accepts the data(in case of writes), provides the data(in case of reads)
  3. Device(function) has 2 types of address spaces
    o Descriptors
    o registers which are configured during device manufacturin
    o Descriptors are part of the device
    o these Descriptors tell everything about what the device is.
    o what type of device, how many EPs, what types of transfers supported, etc
    o Host reads all tehse Descriptors initially => Enumeration
    o core function memory
    o core function emory is not invovled during Enumeration.
    o this is used during funcitonal operations
    o Ex; playing audio on USB audio player => data goes in to this core memory, then audio plaer will play this.
  4. Device is connected
    o Host figures out what type of device is connected
    o LS, FS, SS
    o If device is FS
    o Host-device involve a Speed negotiation process, where they agree for eitehr to work at FS or HS
    o Now that speed is agreed, Host initiates ENumeration to the device.
  5. FS uses Frames, 12Mbps
    frames : 1ms duration
  6. HS uses uFrames , 480 Mbps
    uframes : 125us duration
  7. Speed negotiation involves transfer of J,K pattern(Chirp patterns) between Host and device
    o through which they agree either for FS or HS
  8. D+, D- does not carry inverted data,
    they carry same data with a pattern which would effectively cancel the noise of each otehr.
  9. Once device detection is done, Device initiates the Speed negotiation by sending Chirp K pattern.
  10. Speed negotiation has 2 possiblities
    o connection established at HS
    o connection established at FS
  11. FS, HS mode technically means
    PHY fixing its transmitting and receiving circuitry for eitehr 12Mbps or 480Mbps
    o it needs to be given time.
  12. USB supports 4 types of transfers
    o Control => used for accessing the descriptors in the device
    o remainig 3 below are used for accesisng function core memory
    o Isochronous
    o Interrupt
    o Bulk
  13. Enpoint is a virtual channel that is used to establish the connection between Host and the device.

EP is more like a memory mapping
o when Host targets a specific EP, it is actually doing transfers to the correspdning memory mapping of the EP
o this memory can be 2 types
o used for wrtiign purpose
o used for reading purpose

ex: I want to write data in to pendrive
    o Host will see which all EPs in this device  support write type of transfer
        o EP2, EP5 are supporting this
        o Host will target a DP for EP2
            o the payload that is coming in this DP, will be stored in to correspdning mapped location of the device
            o function controller will get indication (DMA request) that a data write has happened to the memory correspdning to EP2
            o function controller will go and read this data from memory location mapped to EP2
  1. EP0 is a special type of EP, which is bidirectional
    o Every USB function must implement EP0
  2. we can divide all USB peripheral applications in to 3 categories
    o Polling based peripheral
    o Mouse, Keyboard
    o When a enter some key on USB based keyboard, this ASCI data needs to be given to Host
    o But USB is host centric(device can’t initiate this ASCI data transfer to Host
    o it(device) waits for interrupt type of transaction to be initiated to one of its interrupt based EP
    o whenever its interrupt request
    o device will say I have data available(ASCI data entered by user on keyboard)
    o it sends Data packet with ASCI data to the Host
    o Host is polling devices if they have any data.
    o essentially host is polling all Interrupt based EP’s
    o it is asking them(Interrupt based EPs), do you want to any data transfer with me? => periodic transfer or non-periodic(on need basis)?
    o Host has to poll Interrupt based EP in my keybaord at every regular interval(once every 10ms, etc)
    o to this reuqest, device EP will respond. o It is possibel for same device to have different EPs of diffrent transfer types
    hence technically we can’t say device is interrupt based or iscobaord based => we should rather refer from EP perspective. o Isochrnous
    o BUlk
    o any EP that is not Isochronous, Interrupt, control(EP0), that EP is bulk endpoint => lowest priority transfer EP’s
    o only if BW is available, these transfer happen
    Ex: printer
    o We give a print => print happens after 5minutes => USB Host decided to keep it on low priority, becuase it has many other high piority trnasfes(Iscochronous, Interrupt)
  3. If we have too many interrupt EPs in connected USB devices, does it load host with lot many poll services?
    Yes. Probably will reduce the frequency of polling.
    • Interrupt transfer does not consume much of bandwidth => it is just a token packet sent to the EP (3 bytes)
    • even if we assume 100 EPs => 300 bytes of data => which is very small part of whole frame. => still does not take out signifnace BW of host
  4. EPs can be categroeis in to 2 categories
    o Periodic transfer : Interrupt and Isochronous
    o non-Periodic transfer : Control and Bulk
    Ex: where Control is non-periodic?
    Lets say Audio player is connected to Host, we are palying a song.
    we connect one more device(ex: mouse, printer, etc), Host will do enumeration to this new device, only when it gets the BW.
    o COntrol transfer is one time, not to be done in continuous manner.
  5. USB2.0 transacitons happen in broadcasting model
    o Every packet goes to every device
    o This packet transdfers starts with TOken packet
    o TP : ADDR
    o Host will create TP with ADDR=12, EP=2
    o as this packets gets broadcasted
    o But, only Device#12 will recognise that this packet is for me.
    o otehr devices even though they get TP, they ignore that packet.
  6. LS, FS communicaiton is done using Frame
    o frame is 1ms interval in the USB communication time is called frame.
    o 12Mbps (FS)
    o How many bits will be transfered in 1 frame?
    o 1210241024 bit/sec
    o how many bits per frame(1ms) => 1210241024/1000 = 1572 Bytes/frame
  7. HS communicaiton is done using microFrame
    o Micro frame is 125us(1ms/8) interval in the USB communication time is called microframe.
    o 480Mbps (HS)
    o How many bits will be transfered in 1 uframe?
    o how many bits per uframe(125us) => 7864 bytes
  8. goign forward, some time I will call frame or uframe , there is no much different from useage perspctive.
  9. USB1.0, USB2.0 works in Broadcast model
    o where every host generated packet goes to every connected device
    o it is the device function address(that was asisnged usidng enumeraiton) and incoming TP ADDR field matching which tells whether {TP, DP, HP} is meant for this device or some otehr device. USB3.0 is not Broadcast based, it is directed.
  10. Frame or uFrame = SOF, n'{Token packet, Data packet, Handshake packet}
    SOF is always generated by Host, it is broadcasted to all teh devices => iit is a indication that a frame is starting
    Token packet is awlays generated by Host, it is broadcasted to all teh devices => some transaction is getting inidciated.
    Data packet can be eitehr H->D or D->
    Handshake packet can be eitehr H->D or D->
  11. Host wants to perform Iso write to Device ADDR=5
    o Host will check which all EPs in DEVICE#5 are ISOCHORNOUS & OUT Direction => EP1 (lets say ISO_OUT)
    o since ISOCHORNOUS is periodice transfer, it needs to be given prioritu
    o Host will schedule a token_packet with ADDR=5, EP=1
    this TP, followed by teh DP
    this TP gets broadcasted to all teh connected devices(every hub and device)
    DEVICE#5 will have this TP ADDR matching, then it will check the EP number
    o do I have EP#1? Yes
    o DEVICE#5 will now expect to get a data pacekt from the Host(EP1 is ISO_OUT means I need to get DP)
    o HOst provided DP will come to Device#5
    o what to do with that data packet?
    o Device#5_EP#1 is mapped to some buffer location in teh internal SRAM/memory
    o this data(paylaod coming in Data packet) is automatically(by means of internal DMA) is stored in to this pre-defined SRAM location.
    o as its starts storing the data in SRAM buffer(mapped to EP#1), USB2.0 core protocol layer generates a DMA request to the function controller
    o Function controller understands I am getting a DMA request
    o it is a indication that there is write happened from Host to EP#1 (dma_req[15:0] = 16’b0000_0000_0000_0010)
    o FUnction controller(ex: printer, music player, etc), will issue a read request(addressing the dma_req) to the same buffer space where the data is getting stored. Memory rpvodes the data to funciton cotnroller.
    o Essentially data is moving from HOST -> FUNCITON CONTTOLLER (with SRAM acting as a buffer)
    o SRAM buffering makes sure that there is no backpressure or bottlenecks gets established
    o If EP#1 is blocked, Host we will do EP#2, if it is also blocked, it will do transdfers to otehr EPs
    o without buffer above concept will not be possible
    o HOst wants to read data from the device
    o above process almost happens in reverse manner (IN transaction)
  12. All the driecitons in USB are with respect to Host
    IN : Host reading from teh device
    OUT : Host writing to the device

SESSION#2 (11/OCT)

revision:

  1. What is USB
  2. Protocol overview
  3. USB-IF
    o what is driving factors for USB protocol
  4. Data rates supported by different generations
  5. Different components in USB topology
  6. How USB transfers happen

questions:

  1. Who will program the function controller??
  1. These descriptor are read only ?
    o majority of descriptors are read only

agenda:

  1. USB2.0 transfer types
  2. Endpoints
  3. USB3.x

notes:

  1. USB device can be thought of as 3 elements
    UTMI + USB2.0 core + USB Function
  2. Two types of address spaces
    o address space targeting the function descriptor(device descriptors, configuration descriptors, interface descriptors, endpoitn descriptors)
    o descriptors are set of registers which are pre-loaded by teh device manufacturer.
    o these descriptors are read by USB Host once the device is connected => Enumeration
    o descriptors are always accessed using control transfers
    o control transfers are always pefromed using EP0
    o Device function memory
    o EPs other than EP0
    o EP are categorized as below
    o what type of transfer they support?
    o Isochronous, Bulk, Interrupt
    o what is the direction of the transfer?
    o IN
    o Host wants to read data from Device
    o OUT
    o Host wants to write data to Device
    o what is buffer pointer?
    o EPs typically will have 2 buffer
    o EP buffer space can be accessed by USB protocol layer(internal DMA), Function controller
    o using only one buffer, it becomes a bottleneck, where only one of the PL or FC can only access
    o 2 buffers will imrpvoe this, where both can accessed 2 different buffer spaces => hence improving the effective throguput.
    o what is buffer size?
    o How much buffer has been allocated to this EP.
  3. 2 kinds of transfers are possible
  4. A frame means 1ms, uframe means 125us
    uframe will consist of 7864 bytes don’t think that: we keep adding the bytes, when it totals 7864 bytes => it means uframe is done => This is not correct way of understanidng.
  5. We can think of communcaition between Host and device in the intervals of eitehtr 1ms or 125us
    • Host will divide the whole time in to steps of eitehr 1ms or 125us each.
    • during this step, Host sends one kind of packet to tell devices that a frame is going to start
      o SOF
    • During the frame it is possoble have idle period where there are no transfers are happening
  6. Once TOken packet comes, device will check ADDR
    then it will extract the ENDP
    o there will be registers inside USB core => will give all the information of USB_EP2_BUF0, USB_EP2_BUF1, USB_EP2_CSR, USB_EP2_INT
    o Using the fields of USB_EP2_CSR (config and status of EP2) will tell all about EP2
    o what type of transfer, direction, maxium payload size supported
    o Buffer0, what is the starting address, what is the size
    o Buffer1, what is the starting address, what is the size
    o PL will check is, is it IN or OUT EP?
    o IN
    o PL will prepare itself for providing a data packet to the Host
    o
  7. whole process
    Host giving SOF to all teh devices
    Host broadcasting TOken packet
    o one device gets selected, only that device will be actively accepting the traffic till next token packet(otehr devices will be mute)
    o EP numebr will provide IN or OUT
    o EP is IN
    o Function controller would have already populated the SRAM buffer with data at locations correspeonding to EP_NUM selected
    o USB core protocol layer will start reading data from this buffer location(correspeonding to EP_NUM)
    o It gets the data
    o It(protocol layer packet assmbler block) frames DATA_PKT
    PID – DATA – CRC16
    why no Sync and EOP?
    o this framing is done by the UTMI(PHY) => it is not part of functional core.
    o UTMI block gets PID-DATA-CRC16 as the input on parallel interface(8 bit data bus or 16 bit)
    o UTMI serialzes this data, before sending PID, it always sends a predefined SYNC pattern
    o then it sends PID in serail manner(1 bit at each edge of clock)
    o then it sends DATA in serail manner(1 bit at each edge of clock)
    o then it sends CRC16 in serail manner(1 bit at each edge of clock)
    o finally it sends EOP
    o HOST is the recieving device(can we call Host as device, technically yes)
    o Also has UTM
    o It will see Sync pattern => a packet is starting
    o UTM does not do any analysis of the DATA packet or any other packet for that matter.
    o it just removes SYNC and EOP pattern, deserializes the packet data and give this data to Protocol layer
    o Protocol layer will get PID – DATA – CRC16
    What is teh PID?
    Using PID, it will figure what type of packet is coming.
    It will collect all the data
    Last 2 bytes will be CRC16
    o It does the CRC check, it stores the data to a internal memory.
    o once CRC check is passing
    o Host will send ACK packet inidcating that transfer happened successuflly.
    o else it will send NAK to indicate something went wrong. o is this the whole process that happens in 1 frame? o there can be multiple such transfers are possible in signle frame. frame = SOF, n'{TP, DP, HSKP}
  8. USB2.0 very important asepct
    o D+/D- at one point will be sending HOst-> device
    o at some other point in same frame time(125us), it will be sending data from Device -> Host
    o this swithing happens many times in signle frame duration.
    ex: uFrame, we are writing some data to pendrive, getting a data Keyboard, playing a song on audio player.
    o these applications are initiated at application level.
    1st: data to pendrive
    2nd: getting data from KBD
    3rd: Playing a song on audio player
    USB drivers(Host), will figure out which all connected devices needs my attention(needs me to do transfer)
    PENDRIVE
    o What is ADDR I have assigned to them?
    o what type of transfer to do?
    o ISO, Bulk, INt?
    o What is teh direction of the transfer?
    o IN, OUT
    KBD
    AUDIO_PLAYER
    Host will figure out which EP of PENDRIVE to use, EP of KBD to use, which EP of AUDIO_PLAYER to use.
    As part of its communication process, it anyway sends SOF
    o in the current frame(~uframe) interval, I need to address 3 devices
    BULK
    INT
    ISO
    o INT, ISO are periodic in nature, they require guaranteed BW
    o if the Host is not able to accommodate the BW for Bulk transfer, it will not initate any trnasfer to PENDRIVE in current frame duration. It will only adress KBD and AUDIO_PLAYER.
    o Assuming that there is enough BW(AUDIO_PLAYER does not require lot of data per frame), it leaves BW for PENDRIVE.
    o HOst will do transfers all the 3 devices in this uframe duration
    Host knows
    o ADDR, EP combination
    o if it has to give the data, it knows what data to give.
    o Host decides for KBD->PENDRIVE->AUDIO_PLAYER in Uframe packet order
    o Host sends SOF to all the devices (D+/D- are working H->D)
    o Host sends TP to all the devices (D+/D- are working H->D)
    o KBD sends DP to the Host (D+/D- are working D->H)
    o Host sends HSKP to the KBD (D+/D- are working D->H)
    o Host – KBD communication is done for current frame duration.
    o Host sends TP to all the devices, PENDRIVE gets selected (targeing on OUT EP of the USB core) (D+/D- are working H->D)
    o Host sends DP to PENDRIVE (D+/D- are working H->D)
    o PENDRIVE sends HSKP to the Host (D+/D- are working D->H)
    o Host – PENDRIVE communication is done for current frame duration.
    o Host sends TP to all devices, AUDIO_PLAYER gets selected (targeing on OUT EP of the USB core) (D+/D- are working H->D)
    o Host sends DP to AUDIO_PLAYER (D+/D- are working H->D)
    o ISOCHORNOUS transfer will not have Handshake phase
    o Even if packet is corrupted, or got dropped, we don’t want to rectify that
    o ex: Playing a song, we decide to ignore a glitch in the song.
    o Host – AUDIO_PLAYER communication is done for current frame duration.
    D+/D- are bidirectional
    o They has to switch probably 10-20 times in 125us duration of uframe.
    o This is all what makes PHY implementaiton very complex at USB2.0 level.
    o when we go to USB3.0, it has dedicated line for transfer and dedicated line for receive, this switching is not require.
  9. Does this switching of D+/D- introudce any latecnh? how controller comes to know of latency?
    o D+/D- switching will involve latency
    o as part of Host and device are concerned, it does not matter for them, except of reduction in overall throughput. It does not impact their timing.
    o Host and devices are implemented as state machines.
    o If a TP came at some time
    o even if there is some interval gap between TP and DP, it does not matter, due to the FSM based implementation
    o it is expected to have gaps between one packet to other packet
    o SYNC and EOP is what makes sure that these packets are identified and gives in proper format to the PL of the device.
  10. Host has scheduled a KBD read operation once every 30 uFrame(1uFrame is 125us, 30 uframe 3750us => 3.75ms)
    o In the best case(even if we take fastest KBD typing person)
    o Host schedules Interrupt type of transfer once every 3.75ms duration(more technically every 30 uframe)
    o when we(host scheduler) reaches the 31st frame, it will see that, I need to do a IN transfer to KBD
    o IN TP
    o 2 possiblities
    o KBD doesnt have any data => NOT A ERROR CONDITION => KBD will send one type of packet which tells that I don’t have any data.
    o Host will not respond back, no HSKP packet
    o KBD has any data => It will frame DP with the data typed by the user
    o Host will send HSKP packet to the KBD
    o In case of audio player , host scheudle trnasfers more frequently compared to KBD.

10 FOR ALL ABOVE REASONS, WE CALL USB AS HOST SCHEDULED PROTOCOL.
o everything in USB is scheduled by Host.
o wiht some guideliens as provided by teh USB spec.
o few guidelines:
90% BW must be given for periodic transfers.
10% BW only for non-periodic transfers.

  1. uFrame does not mean continous set of bits, it can have lot of idle period where nothing is happening.
  2. Frame number is more of Sycnhronizaiton mechanism between Host and device
    o Host is giving indication of which frame number
    o more importantly, device will keep track of previous frame number it received
    o if the new frame number does not match the expected, it will indicate frame is dropped.
  3. Packet sizes
    all token packets + SOF are 3 Bytes
    data pacekts are variables size => 0 bytes to 1024 Bytes + PID Size + CRC16 size
    HSK and special packets are 1 bytes only (they don’t need CRC)

frame_number : 11 bits
ADDR : 7 bits
2**7 combinations = 128 combinations
once a device is connected in to USB topology, it is given a unique address by the host(that can be 1 to 127), 0 is not used.
ENDP : 4 bits
CRC5 : 5 bits
CRC16 ; 16 bits

  1. if we give out token for IN EP
    o Device will issue Interrupt indicating error scenario
  2. Endpoints can be understood as buffer space, which has been divided among multiple endpoints
    o FUnction controller and USB core are aware of this buffer space mapping.
  3. frame
    o how different packets make up the frame time duration.
    Summary: Do not visualize uframe as 7864 Bytes(technically not possible), because of inter packet gaps.
    o it is good to visualize uframe as a 125us step, which is being shared across multiple devices as per current requests.
  4. USB transfer types
    o how Host <-> device communication happens for each of these transfer types
    o control transfers are used for control and status operations.
  5. for all the transfer slides
    o gray : H->D
    o no shade : D->H
  6. Control.Setup.Data0
    o host tells to device, which descriptor and how much data it wants to access(write access or read access)
    o THIS Data0 sets up everything. Device will prepare itself either to receive the data or to transmit the data. => WHICH will happen during DATA Stage.
  7. Data stage of control transfer
    o Host has done Setup stage => device is ready either for IN or OUT
    o Host states the data stage
    o IN
    o 3 possiblities
    o IN token is received properly, Device is in position to send data
    o It will send data(D->H)
    o This DP goes to Host
    o Datax (0/1) can be corrupted => Host reports Data error
    o Datax is proper => Host sends ACK
    o IN token received property, Device is in error condition, not able to respnd with data packet
    o STALL
    o D->H (i am stalled, I can’t respond)
    o IN token might be received error/corrupted
    o Device does not respond at all.
    o NAK (D->H) ???
    o in both STALL/NAK responses, there is no 3 rd phase transfer
  8. Why control transfers needs to be this complex, why can’t just TOken packet be issued?
    o Host needs control on what control and status infomraiton it wants to get from the device.
    o Host needs which EPDescriptor or which Interface Descriptor or which configuraiton descripotr to read?
    o Normal {TP, DP, HNDSK} flow does not help
    o TP does not come with any address value of the register or descriptor, it only comes with ADDR+ENDP(device_address, ENDP number)
    o if TP does not have address, how does Host tell which specific descriptor I want to read?
    o Hence it requires a even complete mechansim to read this finromation
    o SETUP STAGE => in turn requires 3 phases => THIS is how all USB transfers happen. => {TP, DP, HNKSHKP}
    o In response to this SETUP Stage, Data stage is setup
    o Data stage can’t be just one packet is being setup => it also requires Host to cotnrol when to do
    o How Host will tell when transfer(Data packet transfer) should start?
    o Host will send token packet again
    o In response to that Data packet will happen
    o in response to that HNDSHK packet will happen
    o SUMMARY: Any proper communication between Host and Device must involve 3 stages of communication{TP, DP, HP}, with the execption of following
    o Iscochronous which does not have Handshake packet (CTRL TFR does not use Iscochronous)
    o STALL, NAK, Token error happens => All 3 phases won’t be there.

22.
8 bytes means – Just DATA0 (since DATA0 can hold 8byes); correct sir
only correct for Control transfers

  1. If I manufacturing a Printer with USB interface (printing and Scanning)
    o This printer USB core must have atleast how many Endpoints? 3
    o EP0 : Control
    o EP1 : Bulk IN
    o EP2 : Bulk Out
  2. Why pipe terminology used in bulk transfer?
  1. What packets are possible by what?
    Host
    SOF, Token, Data, ACK
    o what all handhsake packets and special packets can Host send? Not possible
    o Stall
    Device
    Data, ACK
    o what all handhsake packets and special packets can device send? Not possible
    o SOF, Token
    Possible
    o Data0/1/2, Mdata, ACK, NAK, STALL
    o what all special packets?
  2. with all this complexity we disucssed so far, we can get at best of 480Mbps => which is not really meeting the curernt application requirements.
    consumers want more out of electornic devices.
    o USB2.0 is not able to provide beyond 480Mbps due to its design limitations or UTMI limitations.
    o That is where a new generation of USB is evolved, which increases teh speed of operation almost by 10 times.(5Gbps/480Mbps)
    o this requires completely new way of looking at things, while ensuring that new technology is still compatible with older devices, drivers, cable, etc, essentially called as backward compatiblity.
  3. If backward compatiblity is not there, what will happen?
  4. will you throw some light on utmi components/major blocks??
  5. How could differentiate analog ips and digital ip in utmi ?
    o The whole UTMI itself is a analog compoennt.
    o For our verification prupose we can model the UTMI beahvior. o UTMI
    o clock generation
    o clock recovery(sync the clock with incoming packet)
    o serailziation
    o de-serailziation
  6. USB2.0 communicaiton, perpherals don’t have any say in communication mechasim, except
    o giving data or accepting data
    o giving ACK/NAK/STALL and otehr special packets
  7. USB3.x
    o there are 3 layes
    o each layer generating a specific category of packets
    o protocol layer packets => 4 : Header packet, ITP, LMP, Data packet
    o Header packet, Data packet is always goes in Unicast model => Goes from Host to one device only, Device to Host only
    o ITP : goes from Host to all teh active downstream ports (multicast)
    o link layer => link layer packets
    o They go only from one port to other port, they don’t go beyond that
    o physical layer => Ordered sets
    o They go only from one port to other port, they don’t go beyond that
  8. What is End 2 end, port 2 port?

Host -> Hub0 -> hub1 -> hub2 -> device
o Host —> Device (end 2 end connection)
o E2E connection has 4 P2P connections
o taking example of Host -> Hub0 (Host downstream port is connected to Hub0 upstream port)
o If Host generates a link layer packet(LLP), it must be consumed by Hub0 upstream port(it can’t be forwarded to other devices, Hub1, etc)
o If Hub0 upstream port gneerates LLP or OS to Host, Host must consume it.

  1. Usb 2 link management and power management: which components in utmi will handle ?
    o UTMI is essentially responsible for understanding the signling on D+,D-, covnery this to Protocl layer
    o it si protocl layer which makes the decision, when to enter suspend and resume.
  2. Like ltssm, is there any fsm in handling ??
    o every design needs to have an FSM.
    o Protocol layer has many FSM implemented.
    o USB2.0 spec does not mention any FSM, it is left to the design engiener to decide this.
  3. Course material

SESSION#3 (17/OCT)

revision:

  1. Theoretically 480Mbps is the data rate, but in reality it will be even lesser
    o there are factors which add in to the BW reduction
    o SOF
    o Token packet
    o Handshake packet
    o special packet
    o inter packet gap (switching time)

questions:

  1. How the FA gets assigned.
    o device is essentially refered to as function.
    o Once the function is connecred, it is given with default of 0 address
    o all the enumeration happens to 0 address, till the time FA is assigned.
    o once FA is updated, we will use the updated ADDR for all access to the device.
  2. what if 3 devices are connected at same time
    o Host has the control
    o device detection -> speed negotation -> enumeration
    logically, Host will decide which device it is going to enumerate at any point of time.
  3. Host connected to Mouse and Mass storage device
    o We are doing a transfer to Mass storage device
    o how Host keeps track of Mouse clicks? with two wire D+/D-
  4. During the data recovery from the bit stream, the bit toggles are important
    100 series of 0s or 1s => 100 0s can be treated as 99 0s or 101 0s
    keeping some toggle in between these long stream of 0’s and 1’s can help with easy data reocery.
  5. What is SOF in USB2.0?
    o Start of frame that is send every 125us in USB2.0
    o even if there is no packet to be transfered
    o SOF is an indication of which part of time frame we are in
    0th frame
    1st frame
    2nd frame
    o Host intimation to all the devices that, we are all now in nth frame of communication.
    o to acehvie same purpose, USB3.x uses ITP.
    o USB3.x => ITP sent for every time interval, it is sent to all devices, to make sure all the devices get sense of time and which part of timeframe they are in.
  6. USB2.0
    power management is Host controlled. It is the host which will decide on device suspend and resume beahvior.
  7. USB3.x
  8. USB3.2 supports multiple lanes(2 lanes)
    o if one lane can give 10 Gbps
    o 2 lanes can give 20 Gbps

9.

SuperSpeed:

USB3.0 now called as
USB3.2 Gen1 (can also be written as USB3.2 Gen1x1)
5 Gbps

From here SuperSpeedPlus:

USB3.1 now called as USB3.2 Gen2
10 Gbps
1 line : USB3.2 Gen2x1 => 10Gbps

USB3.2 now called as USB3.2 Gen 2×2
20 Gbps (due to 2 lanes)
2 line : USB3.2 Gen2x2 => 20Gbps

Dual channel (x2)
Both lanes used for data transfer.
USB 3.2 Gen 1×2 and USB 3.2 Gen 2×2
USB4 Gen2x2 and USB4 Gen3x2
USB4 Gen2x2 : 10Gbps * 2 = 20Gbps
USB4 Gen3x2 is also dual-channel transmission, which is doubled on the basis of USB4 Gen2x2 and becomes 40Gbps.
USB4 Gen3x2 : 20Gbps * 2 = 40Gbps

10.
USB3.2 Gen2x2 => SUperSPeedPlus (basic data rate : 10 Gbps)
USB3.2 Gen1x1 => Superspeed (basic data rate : 5 Gbps)

  1. USB communicaiton can be divided in to 4 layers
    o Device or Host
    o USB function power management, USB device power management
    o Protocol layer
    o USB device power management
    o End-end communication
    o Hub portion is empty
    o Hub does not process the protoocl layer generated packets, they are always meant for device only(Host only)
    o Hub only forwards those packets without any consumption or processing.
  2. Technically every elements of USB topology is a USB device
    o Hub is a USB device
    o Host is also a USB device
    o A device can consist of multiple functions
    o each funciton can have up to 32 End points
    o USB3.x gives provision where power management can be done specific to function or whole device.

o USB3.x implements LTSSM, it is speicifc to each function
o it allows a function to be kept in low power state, while other function of same device continues to be funcitoning in U0.
o Link layer
o Physical layer

13.
Upstream
Port facing towards Host
Downstream
Port facing away from Host
Uplink
Link which carries traffic towards Host
Downlink
Link which carries traffic away from Host
Device
any part of USB topology is essentially a USB device
Function
represents the peripheral in USB topology
Descriptor
Register which describe the complete function behavior.
Endpoint
Virtual channel that represents the connection between Host and device
Essentially represents the buffer space of the device.
Hub
Special type of USB device with upstream port and multiple DS ports.
Host
Enumeration
Super speed
Super speed plus

SESSION#4 (18/OCT)

revision:

  1. USB3.x updates compared to USB2.0
  2. USB3.x topology
  3. USB3.x version naming conventions
    x1
    x2
  4. Superspeed and SuperspeedPlus
    Superspeed : 5 Gbps, 8b/10b encoding
    SuperspeedPlus: 10Gbps(+), 128b/132b encoding
    o we increase teh speed by adding double lanes
  5. Different layers in USB3.x
    HOST:
    o Host application
    o Class driver
    o USB Driver
    o Host controller Driver
    o Protocol layer
    o Link layer
    o Physical layer
    – lower 3 layes is what gets implmeneted as hardware.

Device:
o Device function
o Function driver
o Device controller Driver
o Protocol layer
o Link layer
o Physical layer
– lower 3 layes is what gets implmeneted as hardware.

Notes:

  1. Protocol layer
    o Generate Token-data-handshake based packet flow. (these are E2E traffic)
    o End to end flow control
    o USB3.x supports data bursting(sending data transfers without waiting ACK packet to come, which is not possible in USB2.0)
    o It has a limitation: Where the receiving device needs to tell how much space is there in its buffer (This concept is different credit based flow control that happens between Link layer to link layer)
    P2P : Credit based flow control
    E2E : Flow control, where the receiving device tells how much space does it have. SO that we don’t sends bursts beyond what can be stored in receiving device.

Protocol layer is responsible for generating various types of packets.

  1. Link layer
    o ensures that packet transfers are happening reliabily
    o packets are not getting dropped
    o packets are not corrupted
    o When a packet comes from Protocol layer, it does the framing. It adds the CRC
    o when packet comes from other device, it checks the packet, does de-framing.
    o link training, flow control, error recovery
  2. Physical layer
    o encoding (decoding)
    o scrambling (descrambling)
    o serialization (de serialization)
    o gets instructions from Link layer on when to move from one state to another
  3. Physical layer
    o Once we connect the device in to USB topology
    o Circuit gets closed
    o WHich results in flow of current
    o It enables the concept of far end receiver detection (other side of the link)
    o This information is provided to Link layer that a device is connected, now link layer cna initiate the link training.
    o There is no dedicated line in USB link for clock.
    o Essentially both PHy are not exactly in same clock domain.
    o They get synchronized by means of using SYnc pattern.
    o Physical layer has control symbols used for
    o Achieving Byte alignment
    o framing data
    o Managing the link
  4. Data symbols and control symbols
    Physical layer gets all the data(various types of packets generated in both Protocol and Link layer) as 8 bit data patterns
    • Physical layer converts these 8 bits patterns in to 10 patterns
      o 2 reasons
      o Ensure there are more number of 1->0 and 0->1 transitions(which helps with proper data cpaturing)
      o Ensure that the DC balance is maintainted
      o Data = 10000000-00000000-0000000000000000000011100000001 => 40 bits
      o Data = 1000010100 1111000010 010000100101000111100011100011100001 => 50 bits (after 8b/10b encoding)
      There is a well defined formula which does 8b data to 10b data conversion.
      o control symbol
      o 8 bits => 256 patterns
      o 10 bits => 1024 patterns
      after mapping 256 patterns to 256/1024 patterns, we are still left with some more patterns in 10 bit data, which we haven’t used.
      o those unused patterns are used as control symbols(K-symbols) 10’b1100001000 => pattern is not used in 8b/10b mapping, this can be used as a control symbol.

What is mapping:
8’b00000000 -> 10’b1010000011 (this 10 bit pattern can’t be used for control symbol)
8’b00000001 -> 10’b1010000010 (this 10 bit pattern can’t be used for control symbol)
there will be 256 mappings

  1. order
    8 bit data comes from Link layer -> Scrambled(LFSR based formula) -> 8b/10b encoded => 10b data is transmitted on USB physical link
    receiver receives 10 bit data
    10 bit data -> decoded 10b/8b decoding -> 8b data => descrambled => 8 bit data given to Link layer

All this 8b/10b encoding and scrambling is being done to ensure that we reduce the bit level data corruption as much as possible.

  1. Link layer
    o flow control
    o link power management
    o reliable delivery of packet headers
    o buffering
    o when a protoocl layer generated packet a transmited by link layer, it keeps a copy of the transmited packet
    o if the packet got corrupted(NAK) at the receiver side during link tranmsit process, the same packet can be re-transmitted.
    o when we get confirmation that packet is received property(ACK), buffer will remove the corresponding packet.
    o when packet comes in, it detects the type of packets, it does error checking.
  2. Protocol layer
    o in SS, device has ability to inform the Host that now I am ready or now I am not ready. Hence Host does not need to poll(ask) device if it is ready.
  3. By mvoing from USB2.0 to USB3.x, what are the advantages?
    o
  4. Signifniance of each of the elemtn in USB topology
  5. Devices
    o Peripheral can either be in SS or non-SS mode at any point of time, they can’t be in both the modes simultenously.
  6. Lets say one device got connected, how the data flow happens from the point device is connected.
    o what all things happen at each layer?
    o Physical layer
    o Device got connected
    o Circuit gets closed
    o Hub detects device is connected
    o Host also detects that device is connected
    o Device takes default address of ‘0’
    o Physical layer indicates to link layer that device is connected and receiver is detected.
    o Since device got detected, Link layer at the other end of the port(Hub to device) initiates the link training process.
    o Detect -> U0 (only state in USB LTSSM, where Protocol layer packets or Link commands can be transmitted)
    o Speed is also agreed(FS, HS, SS, SS+)
    o Now the Link is in U0 state
    o Link layer does flow control, checks if there is buffer space availalbe in other side of the link.
    o Link layer notifies the Protocol layer about buffer space availbality.
    o Not Protocl layer initiates the transfer(transaction packets, data pacekt, ITP)
    o 1st thing to do is: Enumeration process, it does control transfers to get the descriptor information.
    o By the time Enumeration completes, Host has assigned a address to the device.
    o Host has complete informaiton about the device.
    o Host starts sending packets to device as per the application requiremnet.
    o Ex: We want to transfer 100MB movie file
    o Protocol layer frames Data packets
    o These data packets can’t hold complete 100MB information
    o 1024 bytes per packet.
    o Protocol layer keeps framing packets
    o Packet#0 => 1024 bytes
    o Packet#1 => 1024 bytes
    o Packet#2 => 1024 bytes
    o Packet#3 => 1024 bytes
    ….
    o Packet#n => 1024 bytes
    o These packets are given to Link layer
    o Link layer checks if receiving device(other end of the link) has enough buffer space
    o Link layer will add framing symbols
    o Updated packet will be given to Physical layer
    o Physical layer does scrambling, 8b/10b encoding, serializes, transmits this serial data.
    o receviing device(not the end device), does de-scrambling, decoding, de-serialization and gives this data to Link layer
    o Link layer has 2 categories of packets coming in
    o Link commands : COnsumed by Link layer itself
    o Protocol layer packets => These are forwarded to Protocol layer(if it is Hub it does nto process the packet, it just forwards it to next port in the topology)
  7. Hub works in cut-through mode
    o It does not process the protocol layer packets, that are not meant for it. It just forwards those packets as they are. Hence we are not losing any bandwidth.
  8. USB2.0
    o data flow happens by means of frame or uframes
    o each communication is TP+DP+HP
    o similar concepts also apply to SS data flow with some variations.
  9. USB2.0 packet categories
    o 16 types (PID 4 bits was mapped 16 types of packets)
    o Token, Data, HSK, Special packets
  10. SS packet categories
    o protocol layer packets
    o Link management packets
    o Transaction packets
    o Data packets
    o ITP
    o Link commands
    o 2 types
    o one used for flow control
    o one used for link integrity
    o Ordered sets
    o TS1, TS2
  11. every SS packet has packet header
    o packet header comes with ROute string, which is used to decide in what direction packet needs to be routed till it reaches the destination device End point
  12. USB2.0 requires
    Device to send HSK packet, before host can send next TP, DP
    USB3.0, this requiremnet is not there
    o Host can send multiple Data packets, without waiting for DEvice to send HSK packets. (Data Bursting)
  13. OUT transfers
    USB2.0 => OUT_TOKEN, DP, HSP
    USB3.0 => DP, HSP
    o DP = DPH + DPP
    DPH : Data packet header
    DPP : Data packet payload
    DPH itself containts complete token packet infomration, ehnce a separate TP is not required.
  14. IN Transfers
    o USB2.0 => IN_TOKEN, DP(D->H), HSP(H->D)
    o USB3.0 => IN_TOKEN not used
    HSP(H->D), DP(D->H)
    HSP plays the role of IN TOKEN Packet.
    HSP(H->D)
    Data (Successfull completion)
    Stall
    NRDY -> When EP is ready send ERDY asynchornously(without Host polling)
    o If 2 devices sent STALL, it has got 16 byte header => it also has a transmitter identifier
  15. How BW gets allocated?
    o Driver level implmentation
    o Devices are classified in Bulk, ISO, INT
  16. Data bursting takes complete benefit of Dual simplex connection.
    o we send DPs back to back, without waiting for ACK to come. it reduces overall data flow latency.
  17. in USB2.0, TOken packet used to carry 2 things
    ADDR, ENDP
    in USB3.0, there is not dedciated Token packet, it is Transaction packet header which carries this information.
    o ROute string, ADDR, ENDP
  18. IN Transactions require response from the device(DP, NRDY, STALL), before it can send next IN Transaction.
    OUT Transaction does not have this restriction.
  19. Protocol layer packets
    o ITP
    o Transaction packets
    o Data packet (Header + Payload)
    o LMP (exception: It is only Port to port packet, rest all packets are end to end packets)
    o ALl above packets compolsority have 16 byte header(majorly they replace need for separate TOken packet)

End 2 end pacekts: There are generated by either Host or device, they are finally consumed by the target device or the host, in between Hubs don’t process these packets.

  1. Data packet
    16 byte DPH + DPP(Data + 32 bit CRC)
  2. ITP repalces the role of SOF packet in USB2.0
    o since USB3.0 doesn’t have SOF packet, someone needs to replace it roles.
    o SOF lets devices know the frame time stamp
    o ITP: Generated by Host to indicate to the current time stamp.
    o So devices will keep themselves rpepated to receivpt periodic transfer packets.
  3. Link layer to Physical layer : 4 types of packets can come
    o Header packets (ITP, TP, DPH, LMP)
    o till now it was only 16 symbols, how it became 20 symbols when it is leaving Link layer?
    framing is done => 4 symbols are prepended.
    o DPP
    o Link commands
    o 8 bytes
    o 4 bytes are used for framing (SLC, SLC, SLC, EPF)
    o 4 bytes
    2 bytes, same 2 bytes
    2 bytes
    Link command payload(11 bits), 5 bit crc
    o Link commands don’t have provision of retransmission, those packets are checked properly.
    o Ordered sets
  4. Framing helps the receiving device, know the a packet is coming, what type of packet is coming, it keeps its circuit ready for reevinig the packet.
    o Framing repalces the role of SYNC packet and EOP in USB2.0
  5. Packet fields, the significance
    o Type
    o LC Word
    o 16 bits
    o HubDepth#1 => Hub is telling that, the device you are targeting is in low power state now, It can’t respond now. I am sending you Same(Packet header) packet that you have sent me(with my depth, hubdepth with DF=1) => Asking Host to defer this TP to further time, when Device will indicate that it is ready(ERDY)
    o Hub will attempt to power up the link from U1/U2 -> U0
    o once link in U0, now host can send same TP(earlier) to the saem device
    o For this to happen
    o Hub sends the Same defered Header Packet to the device also(once it is in U0)
    o device sees that I am getting a NRDY with DF=1 from Hub
    o Device understands that there was a transaction attempt to me.
    o Now I am ready
    o It will send ERDY to the host
    o Host resends the earlier defered TP to teh device. o If LC word is not there, this concept of defered will not be possible.
  6. Hub tries to save the power by keeping the links in to power managed states(U1, U2, or U3)
    o
  7. What will happen if DF concept is not there
    o Host has IN transaction(ACK packet to the device)
    o device is in low power state
    o Device has to go from U1/U2 -> Recovery -> U0
    o till this time, it won’t be able to send Data packet to Host
    o Now host can’t do any other transaction, due to the limitation of IN transactions(unless Data/stall/Nrdy comes), we can’t intiiate new IN transaction
    o THIS will become a bottelneck. o to address this problem, USB3.x introduces the concept of Defered bit, where hub tell Host to defer this TP to later time when device is ready(ERDY) o Host will defer packet to later time.

SESSION#5

revision:

  1. USB3.x protocol layer
  2. Singifniance of each layer in the USB3.x data flow model
  3. Different types of packets
  4. In transfers
  5. OUT transfers
  6. Packet fields
    o Link control word, Type

Agenda:

  1. Different types of packets
  2. Packet fields, their significance
    o some packet fields are common for all the packets
    o some fields are specific to the packets only

Notes:

  1. USB3.x implmenet following features on top of USB2.0 protocol layer features
    o Support for streams for the bulk transfer type
    o asynchronous device notifications
  2. USB2.0 is based on frame or uframe, where we have dedicated token packets, SOF
    TP, DP, HP USB3.x has Transaction packet which replaces the most of the HP and special packet functionality of USB2.0
  3. USB3.x :
    transfer-types Transaction-type Host Hub Device Different conditions of device(Stall, NRDY, DATA)
    Isochronous IN Host sends IN TP
    Isochronous OUT Host sends OUT DP
    Bulk IN Host sends OUT DP 4 * 2 * 3 = 24 possibilities
  4. Hub should not process ITP, DP and TP.
    LMP is only for port-port.
  5. USB3.x packets does not have destination address of the current transaction.
    If packets don’t have destination address, how USB3.x hub routes the packet to the currect end point?
    o Both TP adn DP comes with 2 fields
    o Route string
    o Device address
  6. Route string has no signifiance for ITP adn LMP
    Route string is only used in DP and TP.
    o
  7. Hub doesn’t know the USB topoloyg
    Only Host knows the USB topology.
    o HUb won’t be able to use device address to route the packet, this is where route string gets used for routing the packet.
  8. Protocol layer
    o TP
    o DP
    o LMP
    o ITP
  9. LMP
    o 4 DW
    o what are the fields inside LMP, field sinfiaince
    o
  10. There are multiple reasons why Link can go in to low power state. (U1, U2, U3)
    o To put link in U1 or U2
    o If not of teh device initiated low power state transition is happening
    o Initiaitng device(Hub dowbstream port) can send a Set-link-function LMP with Force_LinkPM_Accept = 1 => device must accept all LGO_U1 or LGO_U2 commands from that point onwards, till it receives LMP with Force_LinkPM_Accept=0
  11. There are 3 types of packets
    o Protocol layer generated packets => can only be sent while link is in U0 state, no other state
    o Link commands => can only be sent while link is in U0 state, no other state
    o Ordered sets => There are the only packets that cna be sent in non-U0 state. Link goes through training
    SS_Detect -> Polling -> U0 (till this point link training negotiation was happening), now in U0 state, both devices starts transfering Protocol laer packet and Link commands between each otehr (before they do that, they need to transmit LMP, Port capability LMP, using which they exchange their capability information).
  12. USB3.x OTG
    o OTG : not something specific to USB3.x, it was there in USB2.0
    o Same entity can behave like both device and Host.
    o ex: Pendrive connected to mobile phone => mobile phone acts like a Host, penddrive is device
    o ex: Laptop connected to mobile phone => Laptop acts like a Host, Phone is device(peripheral)
    o Mobile phone capability of behaving like both host and device is called as USB OTG.
  13. port capability LMP
    o speed
    o Num HP buffers
    o Direction
    o OTG capabaility
    o tie breaker incase of both ports support both US and DS
  14. We are discussing baout different packets generated by Protoocl layer
    o LMP
  15. Transaction packet
  16. ACK TP
    o USB3.x does not have token packet as in USB2.0
    o ACK TP itself is used as token packet
    o Host -> Device
    o Host by sending ACK TP to the Endpoint, it is telling I want data from you.
    o when DP comes from teh endpoint, the host will again send ACK TP(this is the real acknowledgement
    o first ACK TP is only for intiiating the trnasaction
    o OUT EP
    o ACK TP has two purposes
    o Device ACKs the incoming DP from Host
    o Device also uses ACK TP to indicate how much buffer space is it left with.
    o device buffer space has a limit, beyond which it can’t accept the DP, unless the my function controller consumes those in the device.
    o as function controller consumes the data packets, its buffer space gets freed up. ACK TP is used by the device to indicate this buffer space availability.
  17. U1/U2 does not apply to all the links.
    o Host can idendity individual ports(port numbering), through that it sets port capability, which in trun puts link in speicicif low power state.
  18. Host sending ACK TP, HE=1, RTY=1 => indication that DP reached Host properly, but host is not able to process it for Host speciifc issues, Hence DP needs to be re-transmtited.
  19. PacketsPending field is used by devices to do agressive power saving.
    o If Host says packetsPending=0 => there are no packets to be transmtied, the target device can enter in to U0
  20. Transaction packet
    o generated by either Host or device
    o ACK
    o NRDY, ERDY
    o can only be sent by device to the host. That also for non-isochronous EPs
    o for isochronous EPs, they are periodically serviced by the host. Host sends ITP and sends packets targeting isochronous EP. Whereas for otehr types, device can asycnhronously notify its readyness.
    o STALL
    o PING
    o PING_RESPONSE
  21. ERDY:NumP
    o Endpoint is telling how many DPs it can receive : OUT EP
    o Endpoint is telling how many DPs it can transmit : IN EP
  22. Status TP is used by Host to indicate the device that it wants to starts control transfer(~enumeration)
    o
  23. Transaction packet summary
    ACK : H/D(EP)
    NRDY : D(EP)
    ERDY : D(EP)
    Status : H
    Stall : D(EP)
    DEV_NOTIFICAITON: D (not EP)
    PING : H
    PING_RESPONSE : D(EP)
  24. Data packets
    o data length is in bytes: how many bytes maximum possible = 2**16 = 64KB

25.
LC_Credit_A/B/C/D are used for Port-port credit management(buffer space management)
o

  1. Flow control and ACKs
    o End 2 end flow control => protocol layer
    o Port 2 port flow control => Link layer

what packets or link commands do they use for this?

  1. Protoocl layer generates 4 types of packets
    o ITP, LMP, TP, DP
    o DP : DPH + DPP
    o ITP, LMP, TP, DPH Acknowlegement(integrity checks) and flow control happens at the link to lnik level only by means of Link commands.
    o DPP Acknowlegement(integrity checks) and flow control happens at the End to End level only by means of ACK/NRDY/ERDY TPs(Link commands are not used for this)
  2. For every incoming ITP, LMP, TP, DPH, the receiving device has to acknowledge by sneding LGOOD_n. This is indication to the transmitting device that above packets have been succesfully receiving by the reciever(it can remove those packets from buffer space).
  3. if there is any corruption in DPP, there is not way to detect until it is checked at device or host level.
  4. At port 2 port level, DPP is just a data pattern with no singifiance, no checks.
    o DPP only gets checked at the destination device/Host.

SESSION#6

revision:

  1. Different types of packets
    o Packet clasification based on layer where they are generated at
    o Packet clasification based on P2P and E2E
  2. Packet fields, their significance
    o packet fields are common for all the packets
    o type, subtype
    o CRC16, Link control word
    o fields are specific to the packets only
    o ACK TP, ERDY TP : NumP (no other packet will have NumP)
  3. How packet routing works?
    o routestring used at Hub
  4. USB has 5 types of handshakes. (Spec does not mention this line anywhere)
    3 that happens at link layer level
    LGOOD, LBAD, LRTY for checking link level packet communication
    Credit exchange that happens between P2P to indicate the buffer state.
    Power management handshake
    One end of the link tries to put other end in to U1 or U2 (LGO_U1/U2)
    2 that happens at protocol layer level
    DPP gets checked at the destination.
    In response this destination issues ACK/NRDY/ERDY packets.
    Host issues Port configuration request to the device, in response device issues Port configuration response handshake.
  5. Sinigifnace of LGOOD_n, LBAD and LTRY in the Header packet acknowledgement
    o Before HP transmitter sends HP(various packets generated by protocol layer) 3,4,5,6 it sends LTRY packet as an inidcation that I will sending the packets again.
    o HP receier will process the packets, only after it receives the LTRY

Notes:

  1. LCRD : LCredit
    x : A, B, C, D LCRD : Link command, 8 symbols : 4 of them are framing, 4 are the actual data
    4 actual data symbols: 2 * 2 actual symbols = 2*16 bits
    16 bits = 11 bit data + 5 bit crc
    Link command(LCRD) only has 11 bits of effective data.
  2. Link commands cna be of various types
    o Link command 11 bit tells what type of link command being transmitted. It does not carry any other infirmation.
    o Link command only tells that it is
    o LCRC_A/B/C/D
    o receiver has 1 buffer space available, it sends LCRD_A to the transmitter => indicating that I have one buffer space to hold one packet(LMP, ITP, DPH, TP)
    o if some packets in the receiver buffer gets forwarded to the next device in the link, its buffer is getting freed up
    o receiver needs to convey this to transmitter
    o receiver will now send LCRD_B, so on C, D, E, F, G, A…
    o LGOOD_n
    o LBAD
    o LTRY
  3. Header packet flow control
  4. As soon as link enters U0 state, transmitter is not supposed to send the protocol layer packets immediately, it needs to get a confimraiton that receiver has buffer space available.
    o how does transmitter comes to know this?
    o receiver will send LCRD_A, …
    o Every LCRD_x that comes from recevier, is a induciation, receiver has that many buffer spaces availbale.
  5. On the receiver side, there is space to hold 4 header packets only
    o it can’t give more than 4 credits in that case.
  6. only the packets which receiver is actually processing(treats as valid header packets), only for those packets, LCRD_x is sent.
  7. ANy loss of LCRD_x packet, will result in lnik going to Recovery state.
  8. CREDIT_HP_TIMER
    o once HP are transmitted, within specific the LCRD_x packet should come.
  9. In summary, how various types of packet integrity checks and flow control mechansim gets implemented in Protocokl layer and Link layer.
  10. protocl layer
    o
  11. Gen1x2
    o USB 3.2 compliant system working with 2 lanes at Gen1 (5Gbps) data rate.
    o USB3.2 can work at both Gen1 and Gen2 speed
    o USB3.2 can have 1 or 2 lanes.
  12. Burst transaction impelemntatoon
    o bursting: sending DP without waitign for ACK to come for earlier DPs
  13. USB3.1 onwards
    o it supports
    o multuple simultenous IN transactions
    o hubs with additional buffering(they don’t forward the traffic that comes to it as it is), it internally does reordering through local arbitraiton decisions
  14. Burst transactions
    o Back 2 back DP transfers
    o for transmtiter(Host) to send these DP, the end receiver(device) should have space to accept these packets
    o How does end receiver convey how many packets it can hold? NumP
    o 10ns => ACK TP, NumP = 6
    o receiver is telling it has space to hold 6 DPs
    o 20ns => till 20ns, lets say, transmitter has sent 4 DP’s.
    o between 10 to 20nd, 4 DPs are already tranmsitter
    o Maximum number of packets that can be tranmsitted now = 2
    o Endpoint also has attribute called, MaximumBurstSize
    o even it has got the buffer space, it can’t accept burst data bigger than MaximumBurstSize. o Hence we choose the (minimum of MaxBurstSize and Nump) - number of packets that are already transmitter
  15. terms we have used so far with respect to burst trnasactions
    o NumP
    o Buffer space corresponding to Number of packets that receiver can still receive
    o MaxBurstSize
    o This is the total number of bytes that receiver can receive in single burst
    o MaxPacketSize
    o Every EP has a maximum packet size it supports, it can’t handle a packet bigger than this
    o ShortPacket
    o Once all data is transmtited, except for remianing data which is not as big as maxPacketSize, this data will be sent as ShortPacket
    o Packets that are already transmitted since ACK/ERDY has come
    o Burst allow DP to be transmtited without waitnig ACK/ERDY for each DP

Bulk OUT(H->D) of 1770.5KB of data
o Bufferspace in the receiver can only hold 512KB
o MaxPacketSize lets say is 1024B (1KB)
o MaxBurstSize is 256KB
o SHortPacket => it is not fixed
o Data size to transfer =

Host initiates a burst transfer of size?
o min(maxBurstSize, numP) = min(256KB, 512KB) = min(256, 512) = 256
o Host can send 256 DP at a stretch corresponding to one burst transaction
o 1st step
o Host sends DP(1KB) to the device, Seq_num=5’b00000
o HOst must send DP of 1KB, lets say it finally left with 512Bytes, now it can send DP with 512Bytes, it is called as short packet, it indicates the end of Burst transactions
o Device sends ACK TP with seqence_number=5’b00000 => this is the ack for DP of Seq_num=5’b00000
o we are still in burst transaction
o Host send DP(next 1KB) to the device, Seq_num=5’b00001
o Device sends ACK TP with seqence_number=5’b00001
o this continues for 256 iterations, by then we have acehived the NumP
o if the receiving device starts consuming these DP, the numP values increments(space is getting freed up in the reciver, it can hold more packets)
o if it can hold more packets, its numP also should be incemented.

o NumP is not a fixed number, it can vary based on receiver buffer space consumption, and free up
o MaxBurstSize and MaxPacketSize is fixed for a given end point

SESSION#7

revision:

  1. Different features of protocol layer
  2. Flow control conditions => it is more of link layer concept
    o how flow control is implemented
  3. Burst transactions

questions:

  1. Agenda:
  2. How USB protocol layer handles various transfer types
    o bulk transfers
    o control transfers
    o Isochrnous transfers
    o Interrupt transfers
  3. We will write combinations, understand all possible combinations
    o IN, OUT
    o bulk, control, Isochrnous, Interrupt
    o Role of Host, Hub, Device
    o Different states of Host, Hub and Device
    o Ex: Device is stalled, Device(EP) is not ready
    • Overall it may come to lot of combinations. Underlying concepts remain same.

Notes:

  1. Burst transactions
    o transactions targeted for continous address locations
    o most of the protocol, initial request phase indicates the number of transfers required
    o bursting of DPs
    o doing DP transfers without waiting for ACK TP to come for earlier transmitted DPs
    o SuperSpeedPlus architecture allows for multiple simultenous IN transactions.
    o Hubs has local buffering which allows them reorder the TP and DPs as per the arbitration requiremnets.
    o Hubs with different speed downstream facing port links
  2. minimum of {maximum burst size , numP}
  3. Burst transactions complete with Short Data packets.
  4. Hubs in SuperSpeed protocol does not support transaction reordering.
    o hubs in SuperSpeedPlus support transaction reordering by means of buffer space implmeneted in Hubs.
    o what are the transaction reordering guidelines?
    o TPs always get preference over DPs
    o periodic data packets(isochronous) get preference over asychrnous data packets(interrupt, control and bulk)
    o DPs from different end points can come in different order compared to the IN packet order.
    o DPs from same end point must come in smae order w.r.t the IN packet order.
  5. Burst transactions and transaction reodering in SuperSpeedPlus
    o Concurrent Bulk IN transactions
  6. Always IN transactions start by issuing ACK TP (Host to device)
    o always OUT transactions start by Host issuing Data packet to Device
  7. At some point of Host has issued ACK TP to a device
    o Device – Hub link was in U1 or U2 state.
    o Device will not be able to respond to ACK TP since link is in power managed state
    o Hub downstream port will respond with same TP, with Link control word(16 bits).Deferred_bit set to ‘1’
    o THis will be sent to Host.
    o Host understands that Link is in power managed state, hence I got TP with DF=1
    o Host will wait till Device says I am ready, by using “ERDY”
    o Hub will try to bring up the Link to U0 state
    o once the link is up, Hub indicates to Device that there was a transaction attempted to you by sending ACK TP with DF=1
    o device understands that a transaction was attempted to me.
    o It indicates its readyness by sending ERDY to the Host
    o Now host will send ACK TP to the device(since it in U0 state now)
  8. We have seen how devices and host responds to various types of packets coming in.
  9. Individual transfer type understanding
  10. Bulk transactions
  1. Host is doing Bulk IN TP with specific number NumP
    o Device does not have enough data to respond with.
    o Device will send DP wtih EOB=1 => indication to Host that Device does not have sufficeint data, it is indicating for end of Burst.
  2. Two ways in which burst transactions can be ended
    o Sending DP with EOB=1
    o Sending Short Packet whose size is less than MaxPacketSIze configured for the Endpoint
  3. Bulk Out
    o 1st DP is always sent with Seq_num=0
    o
  4. How does host or device indicate DPP error and request for DP re-transmission?
    o ACK TP sent with RTRY=1 and seqeunce_number from where we want to retransmit.
  5. Host or Device have ability to inform teh other elements about its buffer space avaialbility
    o Host can tell to Device how many DPs it can recieve and viceversa
    o how this concept gets implemented?
    o NumP => field in teh Transaction packet(ACK TP or ERDY TP).
    o Host sends ACK TP with NumP=4
    o Host has enough space to accept 4 DP(of MaxPacketSIze) from the device without it sending ACK TP in between those DP.
    o Device can send 4 DPs back to back withpout waiting for ACK TP.
  6. Difference between ERDY and ACK TP?
    o ACK TP is acknowledging the just received DP
    o ERDY TP is not acknowledging, it is just indicating device readyness to complete the transactons with the host.
  7. When device does not have enough data, it sends DP with EOB=1
    o But once it has data, it indicates to the Host by sending ERDY from this EP => Host understands that correspoding EP has data now. I can request for more DP now.
    o We are avoiding polling, by introducing asynchronous device notification.
  8. Bulk Streaming protocol
    o Not there in USB2.0, but added in USB3.0 (SS onwards)
    o What is Bulk streaming?
    o Host to device
    o Device has multiple audio files, Host wants to read these audio files.
    o Host can place these audio files(different streams of data) in to different StreamIDs
    o Audio#0 => one StreamID
    o Audio#1 => 2nd StreamID
    o Audio#2 => 3rd StreamID
    so on
    o Host and Device can agree for StreamID on which they will do the current transfer.
    o ALl the streamID transfers are possible between Host and Device.
    o But Host and Device does some type of handshaking, where they agree for one streamID, they start doing that streamID transfers.
    o Once this streamID transfer is done, Host and device can again agree for new StreamID, then till continues till all active StreamID are completed.
    o What is the benefit out it?
    o Host and device has flexibility to give priority one sepcific streamID, complete its transfers before other streamID.
    o StreamID protocol does change protocol effieciticy, it is just one type of Bulk burst transaction only, with one specific stream of transfers being selected.

WHole idea of the compelx FSM is for Host and device to agree for a specific StreamID on which they are going to a Bulk Burst transactions.

  1. Stream protocol is concept that Endpoint needs to implement.
    o It is not compulsory for endpoint to implemnet streaming protocol.
    o StreamID=0 for an EP indicates taht streaming protocol is not implemneted for this EP
  2. Different StreamIDs
    o NoStream
    o FFFFh
    o EP is capable of Streaming protocol, but current transfer is not asscoaited with any streamID.
    o Prime
    o How to add StreamIDs in to the Queue of Streams
    o Prime ID is used to queue the stream IDs in to Queue of Streams.
  3. 3 streamIDs which should not be used as part of Stream protocol transfers
    0, FFFFh, FFFEh
  4. Concept of Stream starts Host setting up is Stream Pipe with some data transfers associated
    o This newly added StreamID will be indicated to the device.
    o Device(Endpoint) keeps note of all these added StreamID(these are list of StreamID on which Host-device transfers can happen)
    o Host and Device does handshaking to agree for specific StreamID., and start doing transfers on that StreamID.
  5. StreamID provide the device with flexibility to decide which order it wants to get teh data from the Host.
    o rather than getting one fixed order(same EP it is not posisble to send in DP in different order)
    o StreamID gives the concept of out of order(not exaclty)
    o Stream n
  6. Device(EP) only has option to suggest which StreamID it want to start transfer
    o final say is with Host.
    o Stream 0
  7. Stream Protocol State Machine(SPSM)
    o Device is connected
    o Host has to Queue few stream IDs to the streaming list
    o Host and device have to negotiate for specific Stream ID on which transfer should happen
    o Data transfers will happen on this stream ID o DeviceIn Stream protocol state machine
    o DeviceOut Stream protocol state machine
    o HostIn SPSM
    o HostOut SPSM
  8. Device In SPSM (DISPSM)
    o Disabled
    o EP will be in Disabled state when EP_HALT feature is set.
    o Host has initiated for EP to come out of halt.
    o ACK (Prime=FFFEh, numP > 0, PP=0) => PrimePipe state
    o ACK Deferred => Deferred PrimePipe state
    o PrimePipe
    o Deferred PrimePipe
    o Idle
    o Start Stream
    o Move Data
  9. Whenever Host wants to add new Stream ID in to the StreamID list
    o it does by sending ACK with Prime=FFFEh, numP > 0 and PP=0 => whenever Host sends this kind of ACK TP => SDSM automatically moves PrimePipe state => it is queing a StreamID in to the list.

SESSION#8

revision:

  1. USB data communication model
    o generic overview of how Host and device respond to TP and DP
  2. Burst transactin behavior
    o IN transfers
    o OUT transfers
  3. Bulk transfers
    o Bulk IN transfers
    o Bulk OUT transfers
    o Our focus: what is the role of Host and role of teh device
  4. Across transfer types, lot of things are common
    o what if end point is halted or stopped
    o STALL : applicable to every transfer type
    o what if device does not have data(buffer is empty)
    o NRDY
    o what if device gets ready
    o ERDY
    o Host also has specific behavior which is common across all transfer types
    o Host never issues NRDY, ERDY
    o Host issues only ACK TP
    o what if DP is corrupted
    o ACK TP is issued with RTRY=1, Sequence number speicifid
    o not applicable to Isochornous transfers
  5. Bulk streaming protocol
    o 4 aspects
    o IN/OUT X HOST/DEVICE
    o 4 combinations
    o DISPSM
    o DOSPSM
    o HISPSM
    o HOSPSM
    o Cstream
    o Primepipe
    o Stream n (Device suggested)
    o Stream x (Host suggested)
    o FFFFh, FFFEh, 0000h

Notes:

  1. State machine
    one above line is the condition for transition
    one below line is the action resulting out of transition
  2. DISPSM
    o all states are discussed w.r.t Device
    o Disabled
    o Prime Pipe
    o PrimePipe
    o next state by default Idle
    o there is no condition for moving, it is compolsory transition
    o While moving from PrimePipe->IDLE state, Device issues NRDY TP to the Host
    o as of now Stream is not yet selected, so don’t initiate any transactions to me(Endpoint)
    o Deferred PrimePipe
    o Device entered in to U1 or U2 while waiting for EP buffer assingment to one or more streams
    o next state is Idle (compolsory)
    o IDLE
    o Prime Pipe
    o Device is in Idle state, at same time host sends on ACK TP(Prime, numP>0, PP=0) => Host wants to do streamID update, map one of EP buffers to a new stream ID. Hence device will stop the streamID transfer selection process. It goes to primePipe state where it will work with host to map one of the EP buffer to a streamID.
    o Device goes to StartStream by proposing Stream-n to the Host
    o Device knows what are all the active StreamIDs mapped to its buffer
    o it selects one of those (Stream n), informs to the Host that lets do transfer on Stream n
    o Device is getting option to select(before this Stream concept, this was not possible in USB2.0, it was always Host making decision always)
    o in response to ERDY from device with Stream-n, Host can either agree for Stream n or disgree.
    o Device is in StartStream state
    o Host sends ACK with Stream n and numP > 0
    o Host is acknowleding the device request for transfer on Stream n => Device will move to MoveData state.
    o Host does not have data avaialble for this streamID related transfer, it has other stream data available, which it can initiate now.
    o Host will send ACK TP with Stream x(Host selected)
    o Host does not have data avaialble for this streamID(stream n) related transfer, it does not want to do other Stream transfers(data is not available for those streams also)
    o IDLE
    o Host might also figure out that I want to map a new stream ID to End point buffer. It does so by moving PrimePipe state.
    o Device suggested to Host for Stream-n selection, it moved to Start Stream, but eventually the link moved to U1 or U2 state, Hub will not be able to do transfers to the Device. Now Host is sending ACK to the device(not possible since link in U1), Hub sends ACK_DF=1
    o device transitions to DeferredPrimePipe state
    o Deferred PrimePipe
    o MoveData
    o It is the state where the actual data transfer happens
    o the data transfer is associated with CStream(Stream n, or Stream x)
    o Both Host and device has agreed to do teh transfer on Cstream
    o DIMDSM terminates when the data buffer exhausts at either device
    o IN Protocol: Data is moving from Device -> Host
    o DIMDSM exits to IDLe state, where Device does not have any more data asscoited with CStreamID
    o DIMDSM exits to IDLe state, where Host buffer is full asscoited with CStreamID
    o Start Stream
  3. USB Topology
    o Only Hub can generate a Defered ACK packet.
  4. in SPSM, whichver state we are in does not matter, if ACK_DEF comes, FSM moves to Defered_PrimePipe state
  5. From memory perspective, Host has lot of data buffers which can be mapped to device Endpoints
    o without stream concept, all this data buffers need to be groups in linked list kind of data transfers.
    o with stream concepts, these data buffers are mapped to different stream ID.
    o Device has option to choose, from which data buffer it wants to the transfer.
    o There are 2 possibilities
    o Data buffer asccoidated with Host has data avalable
    o Host agrees for doing transfer on device suggested stream ID
    o Data buffer asccoidated with Host has no data avalable
    o Host disagrees for doing transfer on device suggested stream ID, since it does not have the data. o Device has flexibility to create a out of order kind of trasnactions where it can read the data streams in its own requirmnet, with minimal intervention of the Host.
  6. DIMDSM
    o possible transitions
    o InMvDataDevice
    o 3 possible transitions
    o InMvDataDevice -> InMvDataHost (no condition for this, it happens automatically)
    o Device will send DP with CStream, EOB=0(burst is still in progress)
    o In response to this, Host sends ACK with Cstream, PP=1, NumP>0
    o InMvDataDevice -> InMvDataDeviceTerminate (no condition for this, it happens automatically)
    o it happens when all the device buffer associated with CStream is exhausted
    o DP(CStream, EOB=1) => End of the burst.
    o InMvDataDevice -> Idle
    o Host is requesting for more data, Device buffer does not have data
    o NRDY
    o InMvDataHost
    o 3 possible transitions
    o InMvDataBurstEnd
    o CUrrent burst transfer is complete, but Host wants to intiate a new Burst with current stream.
    o InMvDataDevice
    o Host is indicating to device that curretn burst transfer is still in progress(numP > 0)
    o Idle
    o Host has exhuastred its buffer space(it does not space to hold more data)
    o ACK, numP=0, PP=0(move out of MoveData state machine)
    o InMvDataBurstEnd
    o 2 possible transitions
    o InMvDataDevice
    o When host wants to new burst transfer(current Burst is ended, host still has space to accommodate more data associated with current Stream)
    o Idle
    o InMVDataDeviceTerminate
    o Device will move from this state to 3 possible states
    o InMvDataBurstEnd
    o when Host issues ACK
    o InMvDataDevice
    o Idle
  7. Stream Selection is primarily to establish a connection between Host and Device where they both are agreeing for data transfer on specific CStreamID
    o There is a possibility where Host buffer is full, it does not data buffer associated with CStream available
    o There is a possibility where EP buffer is not availbale which is mapped to CStream
    o During Stream ID negotiaiton, device can’t reject this.
    o Device can indicate unavailability of Data in its buffer, by sending NRDY once both Host and Device have entered in to MoveData state.
    o Essentially this is how Device can reject Host forced suggestion on Stream x(device wanted to Stream n, Host said we will Stream x, Host has higher say, both agreed for Stream x, but device don’t have any data from Stream x, once both move to MoveData, there it sents NRDY)
  8. PP=1, indication that
    PP is a field controlled by Host => indicates whether furhter MoveData transdfers should happen, or should exit the MoveData state.
  9. There are 3 reaons to come out of MoveData state
    o To strat with Device does not have any data for current Stream Id
    o it will not send any DP, it directly issues NRDY with CStream
    o Device has exhuastred its data, it want to end the Burst
    o DP, EOB=1 => This is a device initiated terminate process (InMvDataDeviceTerminate)
  10. Device Out SPSM
    o ACK (Prime, numP > 0, PP=0) is being changed to DP(Prime, PP=0)
    o ACK_DEFERRED is being changed to DPH_DEFERRED
  11. Bulk IN happens
    o Host sends IN ACK TP
    o Device sends DP
  12. Bulk OUT happens
    o Host sends DP(this is the 1st step in the flow)
    o Device sends ACK TP
  13. DOSPSM
    o MoveData
    o OUTMvDataDevice
    o When PP = 1(more pacekts are pending to be transferred)
    o what are all possible transitions from OUTMvDataDevice?
    o NRDY(Cstream) => Device is telling to that, OK you suggested Stream x for CStream, but I don’t have buffer space to hold the data you are sending(Since it is OUT transfer), Device is telling to Host that I am rejecting curretn stream Selection. => IDLE
    o ACK(CStream, NumP=0)
    o Device was doing Burst transfers, it was getting DP from Host
    o at one point its buffer got full, it indicates this condition by sending ACK(NumP=0)
    o ACK(CStream, NumP > 0)
    o Part of regualr burst transfer, where device is issuing ACK for the DP that came from Host.
    o OUTMvDataHost
    o DP(CStream, PP=1) => Host still has more data packets to be sent to the device.
    o Hence Device state changes to OUTMvDataDevice
    o DP(CStream, PP=0) => Host does not have any more data packets to be sent to the device.
    o Hence Device state changes to OUTMvDataHostTerminate
    o DPH_Defered
  14. Host IN SPSM
    o Whenever EP Stall or Error happens, Host SPSM enters to Disabled state
    o Disabled
    o nextstate = PrimePipe
    o Host sends ACK TP(Prime, NumP > 0, PP=0)
    o PrimePipe
    o Device sending NRDY(Prime), move to Idle state
    o Device link is in U1/U2 state, Hub issues ACK_DF to inidcate deferal, move to Idle state
    o ERDY
    o PrimePipe
    o Setting up the Buffer space in EP for the sepcfici stream ID
    o Idle
    o Host-device haven’t agreed for any specific stream ID transfer
    o state transitions
    o StartStream
    o Condition: Device sends ERDY(Stream n)
    o InMvDataDevice (All are initiated by Device)
    o State which indicates starring of the data transfers between Host and Device
    o State transitions
    o Idle => C = ACK(DF)
    o Host has attempted ACK TP to U1/U2 Link, Hub did ACK_DF => Hence Host goes to Idle state(since it can’t do transfers)
    o Idle => Action = Device sends NRDY
    o INMvDataDeviceTerminate
    o DP(EOB=1), LCStream=Cstream
    o INMvDataHost
    o DP(EOB=0), LCStream=Cstream
    o ERDY from Device
    o stay in same state
    o INMvDataHost
  15. Host Out
    DP (H->D)
    o ACK (D->H)
    Disabled
    o Host sends DP to the device => to setup PrimePipe (setting up buffers for active stream ID for the transfer)
  16. How SPSM gets implemneted for IN and OUT BULK transfers from Host and Device perspective
  17. IN Endpoints
    o Host is the one which decides in which order it wants to fetch the data.
    o By using streams, Host will swtich to different streamID to fetch teh data using Transaction descriptions in the required order
    o Rather than setting different streams to get TDs in required order, Let Host setup TDs in single queue in the required order(without involving any stream)
    o Still Host has complete control over what order it wants to get data from Device.
    o Hence Streams are not much useful in case of IN Endpoints
  18. OUT Endpoints
    o plain EPs without streams, Device don’t have any say in what order it wants to get the data from Host. it is complete Host scheduled order that takes effect.
    o By using Streams, Device gets to suggest what stream it wants to transfer now, hence it gets option to choose the order in whcih to get the data.

SESSION#9

questions:

  1. revision:
  2. Bulk Streaming protocol

Notes:

  1. Control transfers
    o Used to establish the connection between Host and device for accessing descripotr information.
    o Control transfers are done using Control EP (EP#0)
    o 2 or 3 stages
    o Setup stage
    o Data stage
    o Status stage
  2. Setup stage
    o Setup Data is being sent from H->D, this will be similar to Bulk OUT transaction.
    o SuperSpeed mode
    o there is no TT(Transfer Type)
    o SuperSpeedPlus mode
    o there is TT(Transfer Type)
    o Host is telling what TT is being done taregting specific EP, DEvice can check if the taregted EP does indeed meant of TT.
    o Host is giving 8 bytes information to the device, indicating following
    o Whether it wants to read or write? (bmTransferType)
    o whcih specific location(descriptor) it wants to access?
    o what is the amount of data it wants to access?
  3. Data stage
    o H->D
    o D->H
    o COntrol EPs support burst of size one.
    o We want to read a descriptor, where we need to get 200 Bytes of data.
    o Maximum packet size supported by EP0 is 64 bytes
    o This information will be in 1 control transfers
    SETUP STAGE
    o 1st transfer: 64
    o 2nd transfer: 64
    o 3rd transfer: 64
    o 4th transfer: 8
    STATUS STAGE
  4. Irrespective of Data stage direction, STATUS TP is always sent by Host to Device.
    o When Host issues STATUS TP to the Device, Device can respond in 3 ways
    o NRDY TP
    o STALL TP
    o Device is indicating that I am in STALL(Error or Halt) condition. I can’t respond to current control transfer.
    o ACK TP
    o THis is a special case where TP and acknowledged using TP itself.
    o In other transfers(Bulk, Interrupt), It is DP for which ACK/STALL/NRDY was sent.
  5. Control Read
    o
  6. Control Write
  7. Device can return STALL TP, either in Data stage or Status stage.
    o This control transfer can’t happen anymore since EP is in error condition.
  8. 2 kinds of STALL TP
    o Functional STALL
    o Related to device funcitonality correspodning current EP access
    o protocol STALL
    o Rleated to control transfer(not specific to device functionality)
  9. How do we indiicate that we want to access to specific descriptor only?
    o Setup stage
  10. how descriptors are organized?
    o Device descriptor
    o EP descriptor
    o Interface descriptor
  11. Host – Device communication time is divided in to 2 asepcts
    o division in to Bus intervals of each 125us
    o division in to Service intervals, these are multiples of Bus Intervals

Bus Interval:
o Is how Host sees the communicaiton with devices
o It frames all the transfers in to Bus interval basis
o giving highest priority to Periodic transfers, following non-periodic transfers

Analogy:
month
30 days : 30 Bus intervals
o some of these bus intervals, we dpn’t do much activity
every Sunday we need to go out:
o Going out becomes service interval, that needs to be addressed every week.
o It is the host which schedule this once a week activity

ISOC and Interrupt transfers are scheduled on Service interval basis.
    o Interrupt transfers need not be schedule every bus interval.
  1. Interrupt transactions
    o If Device has given NRDY TP to the Host in any Service Interval
    o Host shall not do any further interrupt transfers to this EP, till EP responds with ERDY TP
    o If the device doesn’t have data, it responds with NRDY
    o If device EP has data avalable, it will respond with ERDY
    o Now Host knows that device EP has data, it services this Device in next service interval.
  2. ISOC transfers
    o ISOC Timestamp packet month
    30 days : 30 Bus intervals
    How do I(Device) come to know that a bus interval is starting and I can keep my self ready?
    o I will use an Alarm which will start my day
    o Isochronous timestamp packet will be sent by the Host to the device to indicate this alarm
    o device will keep ready to access periodic transfers once ITP comes to them.
    o Link should be in U0 and device port configuraiton should be completed, only then it is in position to respond to request from Host
    o Only then ITP will be sent to it by the Hub.
  3. WHy SuperSpeedPlus has added TT field in DP?
    o When different DP comes to Hub, Hub has mechanism for reordering these packets.
    o Hub uses TT field to figure out what transfer type is coming, based on that reorder.
  4. Device response to ISOC IN transactions

SESSION#10

Agenda:

  1. Assignment#1 discussion
  2. Link layer

Notes

  1. Protocol layer generates protocol packets
    o except of LMP, all other packets are meant for E2E transfers
    o We need a mechanism which takes care of 2 things
    o ensure that these packets are going properly(without corrupted) from one port to other
    o available BW is utilized efficiely(transmitter should transmit the packets only if the receiver has the buffer space to accept the packet)
    o Link layer is also responsbile for setting up the physical link in operational state(U0)
  2. Link layer generates Link commands(similar to Protocol layer gnerting protocl packets) for link frature impelentaton
  3. LTSSM
    o Link training
    o Link debugging
    o Link power management
  4. Byte ordering
    o we are getting large chunk of data from Porotocl layer(DP)
    o DP – DPH + DPP
    o in what are order these bytes are transmtited?
  5. Gen2
    o block types
    o Control block
    o Used to tranmsit Ordered sets(used for link traniing)
    o Data block
    o used to transmit packets, link commands, and Idle symbols
  6. 8b/10b encoding is done
    o to maintain the DC balance
    o what is DC balance?
    o over long period of communication, we want number of 1’s and 0’s to be matching(more or less)
    o we can have 8b->10b encoding pattern, where this results in very neat matching 1s and 0s
  7. 128b/132b encoding
    whatever data we want to tranmsit is divided in to 2 categories:
    o normal data packets, link commands
    o Ordered sets that are meant for Link training
    WHY THIS classificaiton is required?
    o Based on this receiving device Physical layer will decide whether it should itself process(consume) the packet or should it forward the packet to the upper layer(Link layer)
    o 4 bit symbol + 128 bits of actual data = 132bits (128b/132b encoding)
    4 bits: 1100 (Data block)
    4 bits: 0011 (Control block)
    o when receiving device
    o knows in what encoding manner it is working: 8b/10b or 128b/132b
    o 128b/132b
    o first 4 bits => will indciate is it data block or control block?
    data block: it is for link or protocol layer
    control block: it is from physcal layer
    o we are not using 8b/10b, how DC balance is taken care of => Scrambling which will be used for that prupsoe
    scrambling: takes 8 bits inputs and returns 8 bit output in scrambled manner.
    o effectiyl to transmit: 128 bits, we are using 132 bits => overhead=4/132 = 3%
    Gen1 (8b/10b encoding) => overhead = 2/10 = 20%
  8. Gen1
    o how receiving Physical layer know whether data or control symbols are coming?
    o in Gen1, control symbols are created using special K symbols
    o When a 10b symbols comes in to Physical layer
    o 10b
    o Physical layer will check is it a special symbol => if it is a special symbol? what type of special symbol is it?
    o 10b/8b decnoding happens
    o where does K symbols comes from?
    8b -> 10b mapping
    256 1024 patterns
    o even after mapping, there are few 10b symbols that are not mapped to 8b patterns.
    o these unused 10b symbols will be used as K symbols.
  9. When the packet framing is required?
    o PL comes to know what is coming in
    o DP, HP, Link command
  10. LGOOD, LBAD, LRTY, LCRD
    o LGOOD_0 to LGOOD_15
    o LBAD
    o LRTY
    o LCRD
    o Gen1x1, Gen1x2, Gen2x1
    o LCRD_A, LCRD_B, LCRD_C, LCRD_D
    o LCRD1_A, LCRD1_B, LCRD1_C, LCRD1_D
    o LCRD2_A, LCRD2_B, LCRD2_C, LCRD2_D
    o Gen2x2
    o LCRD_A to LCRD_G
    o IN total Link layer can generate 40 types of Link commands.
  11. why superspeed uses LGOOD_0 to LGOOD_7?
    o Superspeed the Header packet sequence number will be 3 bits only
    o Protocol layer generated LMP, ITP, TP, or DP
    o all these packets have Link Control Word
    o LCW has 3 bit sequence number in case of SS
    o IF LCW.SEQ_NUMBER = 5 => Receiver of this packet will check if the packet CRC is good, then it will send LGOOD_5 to the transmitter
    o transmitter knows that HP with LCW.SEQ_NUMBER=5 has been received properly.
    o next Header pacekt will be sent with LCW.SEQ_NUMBER=6 => when receiver receives this properly(CRC is matching), then it sends LGOOD_6 to the transmitter(ACK does not come in to picutre, ACK is for E2E only, here we are talking about P2P communicaiton)
    o next Header pacekt will be sent with LCW.SEQ_NUMBER=7 => when receiver receives this properly(CRC is matching), then it sends LGOOD_7 to the transmitter(ACK does not come in to picutre, ACK is for E2E only, here we are talking about P2P communicaiton)
    o If CRC is corrupted, receiver will send LBAD
    o LBAD will come to transmitter, so it knows that HP got corrutped, how does it know which one?
    o it will check which is the last GOOD I received(LGOOD_6)
    o till HP.LCW.SEQ_NUMBER=6 is fine
    o it will now start retransmitting HP.LCW.SEQ_NUMBER=7 onwards again
    Before sending this, it will LTRY packet, it is inidcation to receiver that now packet retransmission is happening.
    Unless LTRY comes, the receiver continues to ignore all incoming packets(even if they come properly) Receiver has send LBAD to transmitter transmitter has send 4 more packets ==> All these will be ignored by receiver transmitter sends LTRY, now onwards whaterver transmitter is going to send will be treated as valid by the receiver. why superspeedPlus uses LGOOD_0 to LGOOD_15?
    o LCW has 4 bit sequence numebr
    o HP numbering will be form 0 to 15, hence LGOOD_0 to 15 are required.
  12. header packets are moving from one port to otehr port
    o each port has limited space of 4 credits only
    o how does that receiving port indicate how many credits does it have now?
    – it uses LCRD_A, LCRD_B, LCRD_C, LCRD_D

13.
LCRD1_x – -> can be LCRD1_A/LCRD1_B…like wise, correct??

SESSION#11

agenda:

  1. Link layer

Notes:

  1. Link commands
    o 11 bits of infomration : 11 bits + 5 bit crc = 2 Bytes * 2
    o generated by link layer, consumed by the other port link layer
  2. USB3.0, USB3.1
    o Traffic classes is a change in USB3.1
    o USB3.1
    o Type1
    o Type2
    o Type1, Type2
    o ensures that Hubs can higher priority to Type1 based packets while packet reordering
    o AMong Type1, Type2 => Type2 gets higher priororut
    o AMong Type1 packets => Transaction packets gets higher priororut
  3. USB3.0
    o BUffer credits was refering only to Packet header(not including DPP)
    o USB3.1 => Buffer credit refers to DPH + DPP also
  4. Flow control starts with link initialization
    o Polling/receovery/Hotreset -> U0
    o link initialization happens => as part of that flow control credits gets exchanged
    o Header Sequence number advertizement
    o Header Buffer credit advertizement
  5. Why this concept of flow control is important?
    o Basic Idea: Do not transmit a packet if the receiver don’t have space to hold the packet.
    o how do we know whether receiver has the space or does not have the space?
    o LCRD_A/B/C/D => Gen1x2, Gen2x1, Gen1x1
    o LCRD_A/B/C/D/E/F/G => Gen2x2
    o why there should be buffer space in transmitter?
    o It is to make sure that we can retransmit packets if any packets got lost.
    o if we dont maitain that local copy, it will require some higher layer internvetion to get that packet again => increases the latency.
    o HOW MUCH buffer space?
    o 4 => otehr gnerations
    o 7 => Gen2x2
  6. What is the need for sequence number advertisement?
    o What is sequence number advertisement?
    o Receiver indicates to the transmitter,
    o If we are entering in to U0 directly from traniing states, sequence number advertized will be ‘0’
    o what is the last good packet sequence number that I received before we moved out of U0 state
    o We were in U0, we were transmitting sequence numbers 0…7, 0…7….3 (PNum sequece number=3), we mvoed to receovery state
    o we again came back to U0 => should we transmit form Seqeucne number 0 to 4?
    o receier will tell that I received upto SEQ_NUM=3, good packets, now you can send SEQ_NUM 4 onwards
    o
  7. Local Rx Header Buffer credit count = 2 => What does it mean?
    o recevier has 4 packet credit size
    o among them 2 packets are already there, which are yet to be processed
    o it has got 2 packet space available.
    o transmitted can send up to 2 packets now without worrying aboyt them getting dropped
    o Why we need it?

8.
Tx buffer
Rx buffer
rx header buffer count

  1. LGOOD_n will be recevied by header packet transmitting device
    o it checks whether LGOOD_n is coming in order or not(or some LGOOD_n got dropped)
    o it will remove the header pacejt from its tx buffer space ‘ACK Tx Header Sequence Number’ => It indicates what is the expected LGOOD_n from the receiver
    o last time we received LGOOD_5
    o next we should receive LGOOD_6
  2. PENDING_HP_TIMER
    o Transmitter has sent Header packet
    o It needs to receive LGOOD_n for above packet => This delay is tracked, it should not exceed PENDING_HP_TIMER
    o Transmitter has sent Header packet
    o It needs to receive LCRD_x indicating that it has been consumed by the receiving port , that delay should not exceed CREDIT_HP_TIMER
  3. Link power management
    o It gives 3 power managed states, giving different levels of power saving.
    o U1, U2, U3
    o how do we enter to these states?
    o how do we come of these states?
    o Power management is between 2 ports
    o one acts as a initiaitng port
    o initiaitng port gets instructions from Hub or Host
    o based on that it sends indication to target port that lets enter in to low power state(U1/U2/U3)
    o In response to LAU, initiaitng device again sends LPMA => this complete whole processing moving to a low power state
    o other acts as a target port
    o in response to above request(low power entry request), target device either agrees or disagrees.
    o LAU : Agrees
    o LXU : DisAgrees
  4. Once a port has issued LGO_U1 or LGO_U2, LAU/LXU should come within PM_LC_TIMER
  5. once taregt port issues, LAU, It starts PM_ENTRY_TIMER
    o LPMA should come within PM_ENTRY_TIMER value
  6. Errors are possible for various reasons
    o framing errors
    o CRC errors
  1. Superspeed
    o protocol requirement is to have less than 1 error for every 10**12 bits transmtited

SESSION#12

revision:

  1. Flow control
  2. credit and seqeunce number advertizement
  3. timer
  4. power management implementation using Link commands
  5. error types
    o one which results in moving to recovery state
    o one which has ability to fix without moving to recovery state

Agenda:

  1. Error types
  2. reset
  3. LTSSM

Notes:

  1. Port to port connection is established using a link.
    o link is set of parameters
    o what speed?
    o analog parameters?
    o to establish a link, USB Link layer impelments LTSSM
    o Link Training Status and State machine
    o 12 states
    o Link training states
    o SS.Inactive, Rx.Detect, Polling, U0
    o Low power states
    o U1, U2, U3
    o Recovery state
    o Recovery
    o compliance checking states
    o Compliance check
    o Misc states (Hot reset, Loopback)
    o Hotreset, Loopback, SS.Disabled
    o State transitions happens using ordered sets
    o TS1, TS2
    o 16 bytes
    o TS1, TS2 are used for handshaking purpose
  2. when 8b is converted to 10bits
    8b/10b encoding
    resultant pattern should
    – either has same number of 1’s and 0’s (1010001101 => 8bit input could be 1011_0000)
    – either has 2 number of 1’s more than number 0’s (1110010101) => 6 1’s and 4 0’s
    – either has 2 number of 1’s less than number 0’s (0001101010) => 4 1’s and 6 0’s
  3. What is the impact of reset?
    o Poweronreset => everything gets reset
  4. HOT reset
    o LTSSM has a state called Hot Reset
    o When initiating port decides to move to Hot Reset state
    o it sends TS2 OS(16 bytes), with reset bit=1, it is requesting target port also to move to Hot reset state
    o target port also sends TS2 OS with reset=1 => Indication that it is agreeing to move to Hot Reset.
    o WHen both ports enter to Hot Reset => link has entered to Hot Reset state.
  5. In-band reset
    o acheving reset by sending signalling on D+, D- lines itself
  6. Power on reset
    o out of band reset
    o it is acheived using VBUS => turning off and turning on
  7. 2 kinds of reset
    o hot reset
    o warm reset o How to decide what type of reset to do?
    o PORT_RESET => either hot reset or warm reset
    o BH_PORT_RESET => Compolsory Warm reset
  8. LTSSM
    o defines the state of the link
    o essentially defines the state of each port
  9. Different inputs for which LTSSM transitions happen
    o Warm reset, Far end Rrx-dc absent
    o rx termination detected
    o timeout
    o training (TS1, TS2)
    o LGO_U1/U2/U3
    o Error detected
    o LFPS handshaking
    o Directed
    o Rx Detect overlimit
    o Idle symbol handshake
    o cPolling timeout
    o poweron reset, USB2 bus reset
    o Error detected
  10. LTSSM state
    o SS.Inactive
  11. Polling
    o Rx.Detect : Both ports have detected other side receivers.
    o Polling: they poll each other
    o Receivers acheiving the bit lock and symbol lock
    o 10Gbps => 10*230 bits/second (1G = 1K * 1M = 1K1K1K) 1 bit duration = 1/(10*230) sec = 0.1ns (ex)
    receiver needs to clearly lock when this 0.1ns second starts, when it ends.
    o Each port sends TS1 OS to the other device
    o receiving device uses TS1 OS to acheive the bit lock and symbol lock
    o once it acehvies, it understands TS1 properly
    o in response it also sends TS1 OS, so that original tramistting devices receiver can also acheve the bit and symbol lock.
  12. Loopback state
    o End to end connection = set of port-to-port connections
    o when one packet is transmitted, there is chance it getting correupted at same stage(Port-to-port level)
    o how to detect which state is it getting correupted?
    o Keeping that specifc link in Loopback state
    o one port acts like Loopback master
    o other port acts like Loopback slave
    o Loopback master transmits predefined pattern of data, loopback slave also retransmits the same data. If data is matching, there is no issue with this specific link.
  13. Compliance testing
    o USB is about bit transfers
    o 10Gbps => 102*30 bits per second
    o This transmission is not digital, it happens at analog
  14. LTSSM is a one major aspect of USB
    o what makes it complex
    o each state internally has some more sub states.
  15. USB3 : Receiver equalization is happening in Polling state.
    PCIe : Receiver equalization happens in Recovery state. why does link come to receovery?
    o link was in low power state, it needs to back to U0
    o it can’t direcely go back, we need to Link initialization parameters(bit lock, symbol lock) => It can be acehvied by going to Recovery state
    o link is in U0 state, some errors happened
    o hence go to recovery, again set the link parameters, come back to U0 state
    o link is in U0 state, it was to go to hot reset or loopback
    o reocery is the intermiadatery state for this.
    o hence go to recovery, again set the link parameters, come back to U0 state
  16. Hot reset is one way of using inband reset mechansim to apply reset to speicifc USB device.
    o it uses TS2 OS with reset bit = 1 to acheive the reset.
    o it can’t direcely go back, we need to Link initialization parameters(bit lock, symbol lock) => It can be acehvied by going to Recovery state
  17. each negoatiated lane
    Gen1x1, gen2x1 => 1 lane connecting port to port
    Gen1x2, gen2x2 => 2 lane connecting port to port
    o 2 SSTX+, 2SS RX+
    o 2 SSTX-, 2SS RX-
  18. SS.Inactive
    o RRx_DC is off => Rx.detect -> Pollign(various parameters of teh link are configured) => U0

SESSION#13

Physical layer:

-Q: when we tx, the LSB sent serially first? TX[0]?
– yes

TS1, TS2:
o as a verification engineer, we should create a sequence_item which captures all the symbols of TS1 and TS2 definition.
o we should be able create a sequence which will generates series of TS1/TS2 OSs

We may develop tests for compliance checking:
o we should be able to compliance pattern sequence item, develop tests using these

We should be verifying everything except things which are completely analog
o we may not be able to check va, vb, vc, vd during de-emaphiss(this is something gets implementing at transmission level)

Device framework:

o once device is connected in to topology, it goes through various states
o Vbus on
o far end receiver termination detection
o Link training
o Address setting
o configuration compeltion

o once device is connected
o Link training happens
o Device is in default state
o it has default address(7’h00)
o Host does all the communicaiton while in this state to 7’h00 address
o once it has set the device address, device goes to ‘address’ state

o once device adderss is assigned, it needs to be configured.
    o port configuraiton needs to be done

o Bus enumeration
o process of host reading all the device descriptor.

Teacher is an important part of anybody's education.

I completed my post graduation in 2005. During my school and College, I always had difficulty coping up with things in classroom. But my Telugu teacher Mr. Hussain Budde during my 7th class , I used to enjoy his way of teaching, way he used to engage students by teaching lessons as stories. After that, I never found any teacher who kept sessions so much engaging. I don't want to blame my teachers, I always felt they could make sessions more engaging. I always had to spend time outside class hours to cope up with every minute of classroom session.

I as a teacher, I adopt a style of teaching which keeps session engaging and ensures that students give 100% focus on the session. I always wanted to be that one teacher, whom my students will remember for lifetime. I am making sure that, rest of trainer's also follow same.

I want your 6 months of education at VLSIGuru to be among your best learning experiences. We at VLSIGuru will do our best to make this a memorable time.

Course Registration