8.5
Isochronous Transfer Speed
The amount of data USB can transfer during a 1-ms frame is slightly more than 1,000
bytes per frame (1,500 bytes theoretical, without accounting for USB overhead and bus
utilization). A device’s actual isochronous transfer bandwidth is usually determined by
how fast the CPU can move data in and out of its isochronous endpoint FIFOs.
The 8051 code example in Figure 8-6 shows a typical transfer loop for moving external
FIFO data into an IN endpoint FIFO. This code assumes that the 8051 is moving data
from an external FIFO attached to the EZ-USB data bus and strobed by the RD signal, into
an internal isochronous IN FIFO.
mov
inc
mov
inc
mov
dptr,#8000H
dps
dptr,#IN8DATA
dps
; pointer to any outside address
; switch to second data pointer
; pointer to an IN endpoint FIFO (IN8 as example)
; back to first data pointer
; r7 is loop counter—transfer this many bytes
r7,#nBytes
;
loop:
movx
inc
movx
inc
a,@dptr
dps
@dptr,a
dps
; (2) read byte from external bus to acc
; (1) switch to second data pointer
; (2) write to ISO FIFO
; (1) switch back to first data pointer
; (3) loop ‘nBytes’ times
djnz
r7,loop
Figure 8-6. 8051 Code to Transfer Data to an Isochronous FIFO (IN8DATA)
The numbers in parentheses indicate 8051 cycles. One cycle is four clocks, and the EZ-
USB 8051 is clocked at 24 MHz (42 ns). Thus, an 8051 cycle takes 4*42=168 ns, and the
loop takes 9 cycles or 1.5 µs. This loop can transfer about 660 bytes into an IN FIFO
every millisecond (1 ms/1.5 µs).
If more speed is required, the loop can be unrolled by in-line coding the first four instruc-
tions in the loop. Then, a byte is transferred in 6 cycles (24 clocks) which equates to 1 µs
per byte. Using this method, the 8051 could transfer 1,000 bytes into an IN FIFO every
millisecond. In practice, a better solution is to in-line code only a portion of the loop code,
which decreases full in-line performance only slightly and uses far fewer bytes of program
code.
Page 8-8
Chapter 8. EZ-USB CPU
EZ-USB TRM v1.9