Datasheet
SAM9G45 [DATASHEET]
Atmel-6438O-ATARM-SAM9G45-Datasheet_08-Dec-15
836
37.5.8 Handling Transactions with USB V2.0 Device Peripheral
37.5.8.1 Setup Transaction
The setup packet is valid in the DPR while RX_SETUP is set. Once RX_SETUP is cleared by the application, the
UDPHS accepts the next packets sent over the device endpoint.
When a valid setup packet is accepted by the UDPHS:
the UDPHS device automatically acknowledges the setup packet (sends an ACK response)
payload data is written in the endpoint
sets the RX_SETUP interrupt
the BYTE_COUNT field in the UDPHS_EPTSTAx register is updated
An endpoint interrupt is generated while RX_SETUP in the UDPHS_EPTSTAx register is not cleared. This
interrupt is carried out to the microcontroller if interrupts are enabled for this endpoint.
Thus, firmware must detect RX_SETUP polling UDPHS_EPTSTAx or catching an interrupt, read the setup packet
in the FIFO, then clear the RX_SETUP bit in the UDPHS_EPTCLRSTA register to acknowledge the setup stage.
If STALL_SNT was set to 1, then this bit is automatically reset when a setup token is detected by the device. Then,
the device still accepts the setup stage. (See Section 37.5.8.5 “STALL” on page 846).
37.5.8.2 NYET
NYET is a High Speed only handshake. It is returned by a High Speed endpoint as part of the PING protocol.
High Speed devices must support an improved NAK mechanism for Bulk OUT and control endpoints (except setup
stage). This mechanism allows the device to tell the host whether it has sufficient endpoint space for the next OUT
transfer (see USB 2.0 spec 8.5.1 NAK Limiting via Ping Flow Control).
The NYET/ACK response to a High Speed Bulk OUT transfer and the PING response are automatically handled
by hardware in the UDPHS_EPTCTLx register (except when the user wants to force a NAK response by using the
NYET_DIS bit).
If the endpoint responds instead to the OUT/DATA transaction with an NYET handshake, this means that the
endpoint accepted the data but does not have room for another data payload. The host controller must return to
using a PING token until the endpoint indicates it has space available.
Figure 37-7. NYET Example with Two Endpoint Banks
t = 0 t = 125 µs t = 250 µs t = 375 µs t = 500 µs t = 625 µs
data 0 ACK data 1 NYET PING ACK data 0 NYET PING NACK PING ACK
Bank 1
Bank 0 Bank 0
Bank 1
Bank 0
Bank 1
Bank 0
Bank 1
Bank 0
Bank 1
Bank 0
Bank 1
Bank 0
Bank 1E
F
F
E
F
E'
F
E
F
F
E'
F
E
F
E: empty
E': begin to empty
F: full