USB Transactions
13-57
USB Function Module
13.3.2 Non-Isochronous IN (LH–>USB HOST) Transactions
Non-isochronous IN transactions refer to USB transactions where data is
moved from the local host to the USB host where the USB handshaking proto-
cols are in effect and data transmission is guaranteed. These transactions are
the IN transactions that occur on control, bulk, and interrupt endpoints. These
transactions do not guarantee USB bandwidth.
To provide data for an endpoint IN transaction, the local host code writes the
transmit data into the endpoint transmit FIFO. Local host code must first wait
until the USB is done with any previous TX data for the endpoint (if data had
previously been written to the TX FIFO). This must be done by proper
response to endpoint-specific transmit interrupts. When an IN transaction to
the endpoint occurs, if the endpoint’s FIFO_En bit is set, the USB module
sends any data that is in the endpoint TX FIFO during the data phase. If the
TX FIFO is empty and the FIFO_En bit is set when an IN transaction to the end-
point occurs, a 0-byte data packet is sent.
Once the endpoint’s previous transmit activity is taken care of, the local host
code gains access to endpoint’s FIFO and status by setting EP_Sel bit. Then
the local host can write the new transmit data to the endpoint TX FIFO via the
DATA register (being careful not to overflow the FIFO). Once all of the transmit
data has been written to the endpoint FIFO, local host code sets the
Set_FIFO_En bit to allow the USB to use the endpoint’s TX FIFO and then
clears the EP_Sel bit. The data in the endpoint TX FIFO is sent to the USB host
the next time an IN transaction to the endpoint occurs.
Figure 13–4 shows the various USB protocol conditions that can occur during
non-isochronous IN transactions. It diagrams the three phases of the IN trans-
action, the direction of information flow for each phase, when endpoint-specific
interrupts are generated, and the resulting STAT_FLG bits for the endpoint.
The top three cases show the normal USB handshaking: ACK (data sent by
USB module and received properly by the USB host), NAK (device not ready
to send data to USB host), and STALL (device in a condition where the end-
point cannot handle IN transactions). The last case shows an abnormal case
where there is an error either in the token packet received by the core, or in
the data packet received by the USB host.