English
Language : 

UPSD3422_06 Datasheet, PDF (146/293 Pages) STMicroelectronics – Turbo Plus Series Fast Turbo 8032 MCU with USB and Programmable Logic
USB interface
uPSD34xx
The data packet contains a DATA1 or DATA0 PID. In a USB system, the host or device that is
sending data is responsible for toggling the data PID between DATA0 and DATA1. The
receiving device keeps track of the Toggle Bit and compares it with the data PID that is
received. This provides a means for the receiving host or device to detect a corrupted
handshake packet. The Payload Data is the data that the host is sending to the device and
the CRC16 is used for error checking.
For an OUT transaction, the host sends the token and data packets. The receiving device
sends a handshake packet to notify the host whether it was able to accept the packet or not.
There are three handshake PIDs as follows:
● ACK: this PID indicates that the device received the data successfully.
● NAK: this handshake indicates that the device was not able to receive the data (it is
busy). A NAK does not mean there was an error, since errors are indicated by a “no
handshake” packet. When the host receives a NAK PID or does not receive a
handshake packet at all, the host retries sending the data at a later time.
● STALL: this handshake indicates that something is wrong. For example, the host has
sent a device request that is not understood, the host is trying to access a resource that
is not available, or something is wrong with the device.
Figure 50. USB Packets in a USB Transfer Example
OUT ADDR ENDP CRC5
Token Packet
Data1
Payload
Data
Data Packet
CRC16
ACK
Handshake Packet
1
2
3
OUT ADDR ENDP CRC5
Token Packet
Data0
Payload
Data
Data Packet
CRC16
ACK
Handshake Packet
25.1.4
4
5
6
AI10489
Data transfers with the host
The host issues OUT tokens followed by Data Tokens to send data to a device. The device
responds with an appropriate handshake packet (ACK/NAK), indicating whether it was able
to receive the data. If the device does not receive the data packet OK (because there is
some error), it does not respond with a handshake packet. In the case of a NAK or no
response, the host retries sending the data at a later time.
USB devices are not able to send data to a host whenever they have it ready. When a device
has data ready, it loads data into its endpoint buffer, making it ready for a transfer. The data
will remain in the buffer until the host issues an IN token to that device’s endpoint, at which
time the data will be sent. If the host receives the data OK, it follows with an ACK handshake
(a host never NAKs). If the host did not receive the data OK, there is no handshake packet.
In this case, the device should reload its endpoint buffer as appropriate and the host will
retry again later to retrieve the data.
146/293