Back Next
https://www.beyondlogic.org/usbnutshell/usb3.shtml

Frame contains one or more packets of one the following packet types

  Packet 
     8 bit sync - probably 01010101 (low speed)
     32 bit sync - high speed - used to sync clocks.

     8 bit Packet id (PID) 4 bit low-bit first id and its 4 bit complement.
       data appropriate to packet type. Specifies the type of packet (below).

  Types :

  Token - from root (control from hub)
    PID, Address, Endpoint, CRC
    PID type :
      SOF - start of frame.
      IN - poll packet asks device to return certain data.
      OUT - announces that data will be sent to device.
      SETUP - used for configuration.
      PING (USB2) - host asks upstream device if it is willing to participate.
        Used to resume transmission after receiving an NYET.
      SPLIT (USB2) - with faster speeds, this allows faster transactions between
        hubs while still interacting with upstream device at appropriate speed.


  Data - bidirectional. 
    * PID, Data, CRC
    PID type : DATA0, DATA1  
      When sent, flagged as a DATA0 or DATA1 packet. Packets are alternated, to
        help detect when/if a packet has been lost.

    PID type : MDATA, DATA3  
      USB 2 uses supportMDATA when sending multiple packets of isochronous data.
      It then flags the last packet with  DATA0, DATA1, or DATA2 depending on
      the number of packets sent.

    Data being moved - up to 1K for high-speed (8 bytes for low speed).
    CRC cyclic redundancy check 16-byte(bit?).


  Handshaking - response from service device.
    PID type :
      ACK - previous data packet correctly received. Or response to PING 
        indicating data transmission may resume.
      NAK - data not being accepted, retry later.
      STALL - error condition - re-initialize device(?)
      NYET (USB2) - split transaction pause because buffers full - transaction 
        may continue when conditions change.
      ERR (USB2) - split transacting failed.


   ****************
     Host sends one of the address tokens, most often IN or OUT.
    
     Data packet transferred in chosen direction.

     Receiving point sends ACK or other appropriate handshake packet.

    * Host may send ACK when receiving data from upstream. All other handshakes
      generated only by upstream devices.