English
Language : 

PIC32MX440F256H-80I Datasheet, PDF (294/646 Pages) Microchip Technology – 64/100-Pin General Purpose and USB 32-Bit Flash Microcontrollers
PIC32MX3XX/4XX
11.10 Configuring the SOF Threshold
The module counts down the number of bits that could
be transmitted within the current USB full-speed frame.
Since 12,000 bits can be transmitted during the 1 ms
frame time, a counter, not visible to software, is loaded
with the value ‘12,000’ at the start of each frame. The
counter decrements once for each bit time in the frame.
When the counter reaches zero the next frame’s SOF
packet is transmitted, see Figure 11-9.
The SOF threshold register (U1SOF) is used to ensure
that no new tokens are started too close to the end of a
frame. This prevents a conflict with the next frame’s
SOF packet. When the counter reaches the threshold
value of the U1SOF register (the value in the U1SOF
register is in terms of bytes), no new tokens are started
until after the SOF has been transmitted. Thus, the
USB module attempts to ensure that the USB link is idle
when the SOF token needs to be transmitted.
This implies that the value programmed into the
U1SOF register must reserve enough time to insure the
completion of the worst-case transaction. Typically, the
worst-case transaction is an IN token followed by a
maximum-sized data packet from the target, followed
by the response from the host. If the host is targeting a
low-speed device that is bridging through a full-speed
hub, the transaction will also include the special PRE
token packets.
FIGURE 11-9:
ALLOCATION OF BITS FOR A FULL-SPEED FRAME
1 Full-Speed Frame
SOF
0 ms
Note: Drawing is not to scale.
SOF Threshold
U1SOF * 8
bit times
SOF
1 ms (12,000 bit times)
Table 11-4 and Table 11-5 show examples of calculat-
ing worst-case bit times.
Note 1: While the U1SOF register value is described in terms of bytes, these examples show the result in terms
of bits.
2: In the second table, the IN, DATA, and HANDSHAKE packets are transmitted at low speed (8 times slower
than full speed).
3: These calculations do not take the possibility that the packet data needs to be bit-stuffed for NRZI encoding
into account.
TABLE 11-4: EXAMPLE OF SOF THRESHOLD CALCULATION: FULL SPEED
Packet
Fields
Bits
IN
Turnaround(1)
DATA
SYNC, PID, ADDR, ENDP, CRC5, EOP
35
8
SYNC, PID, DATA(2), CRC16, EOP
547
Turnaround
2
HANDSHAKE
SYNC, PID, EOP
19
Inter-packet
2
Total
613
Note 1: Inter-packet delay of 2. An additional 5.5 bit times of latency is added to represent a worst-case propaga-
tion delay through 5 hubs.
2: Using 64-bytes maximum packet size for this example calculation.
DS61143E-page 292
Preliminary
© 2008 Microchip Technology Inc.