use endpoint 2-IN as a double-buffered endpoint. This pairs the IN2BUF and IN3BUF
buffers, although the 8051 accesses the IN2BUF buffer only. The 8051 sets PR2IN=1 (in
the USBPAIR register) to enable pairing, sets IN2VAL=1 (in the IN07VAL register) to
make the endpoint valid, and then uses the IN2BUF buffer for all data transfers. The 8051
should not write the IN3VAL bit, enable IN3 interrupts, access the EP3IN buffer, or load
the IN3BC byte count register.
Note
Bits 2 and 5 must be set to “0” in the AN2122 and AN2126 devices.
6.7
Paired IN Endpoint Status
INnBSY=1 indicates that both endpoint buffers are in use, and the 8051 should not load
new IN data into the endpoint buffer. When INnBSY=0, either one or both of the buffers
is available for loading by the 8051. The 8051 can keep an internal count that increments
on EPnIN interrupts and decrements on byte count loads to determine whether one or two
buffers are free. Or, the 8051 can simply check for INnBSY=0 after loading a buffer (and
loading its byte count register to re-arm the endpoint) to determine if the other buffer is
free.
Important Note
If an IN endpoint is paired and it is desired to clear the busy bit for that endpoint, do the
following: (a) write any value to the even endpoint’s byte count register twice, and (b)
clear the busy bit for both endpoints in the pair. This is the only code difference between
paired and unpaired use of an IN endpoint.
A bulk IN endpoint interrupt request is generated whenever a packet is successfully trans-
mitted over USB. The interrupt request is independent of the busy bit. If both buffers are
filled and one is sent, the busy bit transitions from 1-0; if one buffer is filled and then sent,
the busy bit starts and remains at 0. In either case an interrupt request is generated to tell
the 8051 that a buffer is free.
EZ-USB TRM v1.9
Chapter 6. EZ-USB CPU
Page 6-9