Workshopband als PDF - Mpc.belwue.de
Workshopband als PDF - Mpc.belwue.de
Workshopband als PDF - Mpc.belwue.de
Erfolgreiche ePaper selbst erstellen
Machen Sie aus Ihren PDF Publikationen ein blätterbares Flipbook mit unserer einzigartigen Google optimierten e-Paper Software.
Table 1: PID Types<br />
1) SYNC Pattern<br />
The synchronization pattern is a 0x80 byte sent before<br />
each packet. The Start-of-Packet SOP <strong>de</strong>limiter is<br />
part of the SYNC field.<br />
2) Packet I<strong>de</strong>ntifier Field<br />
The PID indicates the type of packet, its format and<br />
type of error <strong>de</strong>tection. It is always the second byte<br />
sent and has its own error <strong>de</strong>tection field. After the 4bit<br />
packet type field follows the one’s complement of<br />
it to ensure the correct <strong>de</strong>coding of the entire packet.<br />
3) Address and Endpoint Fields<br />
The address field or ADDR, it has 7 bits to specify<br />
the address of the function that can be either the<br />
source or <strong>de</strong>stination of the packet.<br />
The endpoint field or ENDP has four bits that, except<br />
for the control endpoint zero, are functionspecific.<br />
4) Frame Number Field<br />
The frame interval used for full-speed <strong>de</strong>vices is<br />
1.00 ± 0.0005 ms and the host needs to send a packet<br />
every time a new frame begins. The frame number<br />
field is an 11-bit field that is incremented by the host<br />
each start of frame.<br />
5) Data Field<br />
The data field may range from zero to 1,024 bytes<br />
and must always be an integral number of bytes.<br />
6) Cyclic Redundancy Check Fields<br />
The CRCs provi<strong>de</strong> protection for all single- and<br />
double-bit errors on all non-PID fields. They are generated<br />
with a specific polynomial before bit stuffing.<br />
There are 2 different CRCs used in USB: the CRC-5<br />
52<br />
PID Type<br />
Token<br />
Data<br />
Handshake<br />
PID<br />
Name<br />
PID<br />
bits<br />
Fields<br />
OUT 0001 ADDR+ENDP<br />
IN 1001 ADDR+ENDP<br />
SOF 0101 Frame Number<br />
DATA0 0011 Data<br />
DATA1 1011 Data<br />
ACK 0010 ---<br />
NACK 1010 ---<br />
VHDL BASED CIRCUIT DESCRIPTION TO TRANSMIT,<br />
RECEIVE AND ANALYSE USB DATA PACKETS<br />
Table 2: CRC‘s<br />
Generator<br />
Polynomial<br />
Token Packets<br />
G(X) = X 5 + X 2 + 1<br />
Binary Bit<br />
Representation<br />
00101B<br />
Binary Bit Residual 01100B<br />
Generator<br />
Polynomial<br />
Data Packets<br />
G(X) = X 16 + X 15 + X 2 + 1<br />
Binary Bit<br />
Representation<br />
1000000000000101B<br />
Binary Bit Residual 1000000000001101B<br />
Figure 2: General Solution<br />
used for the token packets and the CRC-16 used only<br />
for data packets; both are <strong>de</strong>scribed in Table 2.<br />
A. General Solution<br />
III. DESIGN AND SIMULATION<br />
The USB transceiver is divi<strong>de</strong>d into two main<br />
blocks, one for receiving data and another one to<br />
transmit it. Each of these blocks work in<strong>de</strong>pen<strong>de</strong>ntly<br />
from one another, both connected to the microcontroller<br />
by several control lines. A special block was created<br />
to generate different frequency clocks to use as<br />
reference and to keep track of the SOFs (see figure 2).<br />
Every block in the structure was simulated before the<br />
implementation.<br />
B. Transmitter<br />
The transmitter is in itself divi<strong>de</strong>d into 4 different<br />
structures: the interface with the microcontroller µC,<br />
the block for data packets, the block for token and<br />
handshake packets, and finally the block in charge of<br />
giving the proper format to the transmitted string.<br />
Each of these blocks are shown in Figure 3; the dotted