Designer Reference Manual
USB08 Evaluation Board
76
Universal Serial Bus (USB) Interface
MOTOROLA
Universal Serial Bus (USB) Interface
4.7.1 Receiving Data
If data for endpoint 2 arrives, the interrupt handler calls handleOUT2().
The number of received bytes is noted in bits RPSIZ3–RPSIZ0 with the
allowed values in the range of 0–8.
The received data bytes are transferred from the USB endpoint data
registers UE2D0–UE2D7 to the buffer RxBuffer. This is a software ring
buffer, which can be filled by the interrupt service routine isrUSB() and
be read out by means of getUSB().
If the ring buffer is full, handleOUT2() waits until RxBuffer is able to store
data again. In this case, the USB module answers further transmission
attempts of the host with a NAK handshake.
NOTE:
In a real application, you should not leave the buffer unserviced over a
longer period of time.
4.7.2 Transmission of Data
The transmit data for EP1 is placed by the user program, via the function
putUSB(), into the send buffer TxBuffer. This is (just like RxBuffer) a ring
buffer, which blocks the application as soon as the buffer is about to
overflow.
The host polls all interrupt end points cyclically, taking into account a
guaranteed maximum latency time. That polling interval can be specified
in the endpoint descriptor. For low-speed USB devices with interrupt
endpoints the shortest specified polling interval is 10 ms. That means,
Bit 7
6
5
4
3
2
1
Bit 0
Read:
R2SEQ
TXACK
TXNAK
TXSTL
RP2SIZ3
RP2SIZ2
RP2SIZ1
RP2SIZ0
Write:
Reset:
0
0
0
0
0U
U
U
U
= Unimplemented
U = Unaffected
Figure 4-10. USB Status Register 1 (USR1)