Nxp Semiconductors UM10237 用户手册

下载
页码 792
UM10237_2
© NXP B.V. 2008. All rights reserved.
User manual
Rev. 02 — 19 December 2008 
386 of 792
NXP Semiconductors
UM10237
Chapter 13: LPC24XX USB device controller
5. Software sends the SIE Select Endpoint command to read the Select Endpoint 
Register and test the FE bit.  Software finds that the active buffer (B_2) has data 
(FE=1).  Software clears the endpoint interrupt and begins reading the contents of 
B_2.
6. The host resends the third packet which device hardware places in B_1.  An endpoint 
interrupt is generated.
7. Software finishes reading the second packet from B_2 and sends a SIE Clear Buffer 
command to free B_2 to receive another packet.  B_1 becomes the active buffer. 
Software waits for the next endpoint interrupt to occur (it already has been generated 
back in step 6).
8. Software responds to the endpoint interrupt by clearing it and begins reading the third 
packet from B_1.
9. Software finishes reading the third packet from B_1 and sends a SIE Clear Buffer 
command to free B_1 to receive another packet.  B_2 becomes the active buffer.
10. Software tests the FE bit and finds that the active buffer (B_2) is empty (FE=0).
11. Both B_1 and B_2 are empty.  Software waits for the next endpoint interrupt to occur.  
The active buffer is now B_2.  The next data packet sent by the host will be placed in 
B_2.
The following example illustrates how double buffering works for a Bulk IN endpoint in 
Slave mode:
Assume that both buffer 1 (B_1) and buffer 2 (B_2) are empty and that the active buffer is 
B_1.  The interrupt on NAK feature is enabled.
1. The host requests a data packet by sending an IN token packet.  The device responds 
with a NAK and generates an endpoint interrupt.
2. Software clears the endpoint interrupt.  The device has three packets to send.  
Software fills B_1 with the first packet and sends a SIE Validate Buffer command.  The 
active buffer is switched to B_2.
3. Software sends the SIE Select Endpoint command to read the Select Endpoint 
Register and test the FE bit.  It finds that B_2 is empty (FE=0) and fills B_2 with the 
second packet.  Software sends a SIE Validate Buffer command, and the active buffer 
is switched to B_1.
4. Software waits for the endpoint interrupt to occur.
5. The device successfully sends the packet in B_1 and clears the buffer.  An endpoint 
interrupt occurs.
6. Software clears the endpoint interrupt.  Software fills B_1 with the third packet and 
validates it using the SIE Validate Buffer command.  The active buffer is switched to 
B_2.
7. The device successfully sends the second packet from B_2 and generates an 
endpoint interrupt.
8. Software has no more packets to send, so it simply clears the interrupt.
9. The device successfully sends the third packet from B_1 and generates an endpoint 
interrupt.
10. Software has no more packets to send, so it simply clears the interrupt.