Jump to content

USB - the principle of operation

USB is a bus with only one master device, i.e. all actions are performed from a PC. Data is transmitted in short packets of 8 bytes and longer packets of up to 256 bytes. A PC can request data from a device, while no device can transmit data on its own.

All data transmission takes place in so - called frames , which last exactly 1 millisecond . Within a single frame, packets for multiple devices can be processed sequentially. Slow (low-speed) and fast (full-speed) packets can occur together. If the PC is connected to several devices, this ensures their separation as a bus splitter (hub). This also prevents routing of full-speed signals to slow devices. The timing of the transfer of information is set exclusively by the master. The slave device must synchronize with the data stream.

The individual bits are encoded using the non-zero inverted (NRZI) method. Zeros in the data lead to a change in the level, ones leave the level unchanged. Encoding and decoding of signals is purely a hardware matter. The receiver must be able to receive the signal, receive and decode the data. Special tools ensure that synchronization will not be lost.

If the original data stream contains six consecutive units, the transmitter automatically adds one zero (insertion of bits) to cause a level change. The receiver removes this zero from the data stream again. Each data packet has a special boot byte (00000001b) for synchronization. Thanks to NRZI encoding and bit insertion, the receiver sees eight alternating bit states with which it can synchronize. Synchronization must be maintained during the next transmission. All these processes occur only in the corresponding hardware components. The receiver and transmitter are always executed together in the same component.

A USB device contains a storage device called a serial interface mechanism (SIE) that takes over its operation. FIFO buffers are used to exchange data between SIE and the rest of the device . FIFOs are memory blocks that can sequentially receive and output data similar to shift registers. Therefore, the connected microcontroller only needs to read data from the FIFO and write other data to the FIFO. In most cases, the SIE is part of the USB microcontroller. USB devices usually have multiple FIFO memory blocks through which data can be transferred.

For example, a mouse connected via USB always has endpoint 0 and endpoint 1. Endpoint 0 is used during initialization. The actual service data is recorded from the microcontroller at certain time intervals to endpoint 1 and selected by the PC from there. USB software consists of so-called channels to individual endpoints (end addresses). One channel is a logical channel to one endpoint in one device. We can think of a pipe as a data channel formed by a single conductor. In reality, however, the data in the pipeline is transmitted as data packets in millisecond frames and distributed by the hardware to real memory according to their endpoint address. One device can use multiple channels at the same time, so the overall transfer rate will increase. Rhino Gold Gel link: http://rhino-gold-gel.com

 Share


Recommended Comments

There are no comments to display.

Join the conversation

You can post now and register later. If you have an account, sign in nowto post with your account.

Guest
Add a comment...

×   Pasted as rich text.    Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.    Display as a link instead

×   Your previous content has been restored.    Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...
0f4354a798bfa2f38cebbfaa235dc2ba