USB Transactions
13-59
USB Function Module
13.3.2.1
Non-Isochronous IN Endpoint Handshaking
Per the USB spec for IN transactions, the USB host may only provide one of
two handshakes to the USB function during the handshake phase: ACK or no
handshake at all. The first indicates successful transfer (first case shown in
Figure 13–4), and the second indicates that the host received a garbled data
packet (last case shown in Figure 13–4).
Acknowledged Transactions (ACK)
When the endpoint IN transaction completes on the USB bus with an ACK
handshake, the endpoint generates an endpoint-specific interrupt to the local
host (see first case in Figure 13–4). In response to the endpoint interrupt, the
local host must read EPN_STAT register to identify the endpoint causing the
interrupt, then write a 1 to the interrupt bit to clear it. The local host mustset
EP_Num to the endpoint number, EP_Dir to 1 (to signal an IN endpoint), and
EP_Sel to 1, then read the endpoint status. The ACK bit is set to indicate that
the endpoint received an ACK handshake from the USB host and that the TX
FIFO is empty (because any data that was in the TX FIFO was transmitted
during the IN transaction).
If the local host has more data to transmit to the USB host, it must fill the TX
FIFO following the process indicated above. It must then clear the EP_Sel bit.
This clears the ACK bit for this endpoint and allows the next transaction status
to be written to the STAT_FLG register.
Non-must Transactions (NAK)
For the case where the local host is not ready to provide transmit data for trans-
actions to an IN endpoint, the core provides a NAK handshake to the host for
any USB IN transaction to that endpoint (as shown in the second case in
Figure 13–4). Readiness to transmit data is signaled via the endpoint’s
FIFO_En bit; when 1, it indicates that data in the TX FIFO can be sent to the
USB host. When the endpoint’s FIFO_En bit is 0 and an IN transaction to the
endpoint occurs, a NAK handshake is sent, indicating that the local host is not
ready to handle the request.
If the Nak_En bit is cleared when the NAK handshake is sent in the data packet
portion of the transaction to the IN endpoint, STAT_FLG is not updated and no
endpoint-specific interrupt to the local host is generated. If the Nak_En bit is
set when the NAK handshake is sent in the data packet portion of the transac-
tion to the IN endpoint, the NAK bit is set and an endpoint-specific interrupt to
the local host is generated.