USB byte order, encoding format and bit stuffing

byte order

  • LSB
    • When sending a byte, send the low-order data first, and then send the high-order data
    • When sending a word, send the low byte data first, and then send the high byte data

For example:

  • Send 0x2D, ​​the order of sending is: 10110100 (low bit first, high bit last)
  • Send 0x0110, then send 0x10 first, then send 0x01 (low byte first, high byte last)

Encoding format

  • The encoding format adopts NRZI encoding
    • Level flip when data is 0
    • The level does not flip when the data is 1

bit stuffing

  • Bit stuffing: In order to prevent the level from changing for a long time (which is not conducive to the synchronization of the signal), bit stuffing is introduced
    • Sending end: encounter 6 consecutive 1s and insert a 0
    • Receiver: Encounter six consecutive 1s, decode the 0s inserted later, remove the bit stuffing, and restore the original data

SETUP coding example

insert image description here

ACK encoding example

insert image description here

bit stuffing example

insert image description here

Guess you like

Origin blog.csdn.net/tyustli/article/details/130540636