UM10462
All information provided in this document is subject to legal disclaimers.
© NXP B.V. 2016. All rights reserved.
User manual
Rev. 5.5 — 21 December 2016
239 of 523
NXP Semiconductors
UM10462
Chapter 11: LPC11U3x/2x/1x USB2.0 device controller
Software must wait until hardware has cleared the Active bit to change some of the
command/status bits. This prevents hardware from overwriting a new value programmed
by software with some old values that were still cached.
If software wants to disable the active bit before the hardware has finished handling the
complete buffer, it can do this by setting the corresponding endpoint skip bit in USB
endpoint skip register.
11.7.4 Generic endpoint: double-buffering
To enable double-buffering, software must set the corresponding "USB EP Buffer Config"
bit to one. The "USB EP Buffer in use" register indicates which buffer will be used by HW
when the next token is received.
When HW clears the active bit of the current buffer in use, it will switch the buffer in use.
Software can also force HW to use a certain buffer by writing to the "USB EP Buffer in
use" bit.
11.7.5 Special cases
11.7.5.1 Use of the Active bit
The use of the Active bit is a bit different between OUT and IN endpoints.
When data must be received for the OUT endpoint, the software will set the Active bit to
one and program the NBytes field to the maximum number of bytes it can receive.
When data must be transmitted for an IN endpoint, the software sets the Active bit to one
and programs the NBytes field to the number of bytes that must be transmitted.
11.7.5.2 Generation of a STALL handshake
Special care must be taken when programming the endpoint to send a STALL handshake.
A STALL handshake is only sent in the following situations:
•
The endpoint is enabled (Disabled bit = 0)
•
The active bit of the endpoint is set to 0. (No packet needs to be received/transmitted
for that endpoint).
•
The stall bit of the endpoint is set to one.
11.7.5.3 Clear Feature (endpoint halt)
When a non-control endpoint has returned a STALL handshake, the host will send a Clear
Feature (Endpoint Halt) for that endpoint. When the device receives this request, the
endpoint must be unstalled and the toggle bit for that endpoint must be reset back to zero.
In order to do that the software must program the following items for the endpoint that is
indicated.
If the endpoint is used in single-buffer mode, program the following:
•
Set STALL bit (S) to 0.
•
Set toggle reset bit (TR) to 1 and set toggle value bit (TV) to 0.
If the endpoint is used in double-buffer mode, program the following: