User manual

...the world's most energy friendly microcontrollers
2012-04-24 - Giant Gecko Family - d0053_Rev0.96 307
www.energymicro.com
The application must poll the USB_GRSTCTL register, until the TXFFLSH bit is cleared by the core,
which indicates the end of flush operation. To transmit new data on this endpoint, the application can
re-enable the endpoint at a later point.
15.4.4.2.3.5 Bulk IN Stall
These notes refer to Figure 15.25 (p. 307)
1. The application has scheduled an IN transfer on receiving the USB_DIEPx_INT.INTKNTXFEMP (IN
Token Received When TxFIFO Empty) interrupt.
2. When the transfer is in progress, the application must force a STALL on the endpoint. This could be
because the application has received a SetFeature.Endpoint Halt command. The application sets the
Stall bit, disables the endpoint and waits for the USB_DIEPx_INT.EPDISBLD (Endpoint Disabled)
interrupt. This generates STALL handshakes for the endpoint on the USB.
3. On receiving the interrupt, the application flushes the Non-periodic Transmit FIFO and clears the
USB_DCTL.SGNPINNAK (Global IN NP NAK) bit.
4. On receiving the ClearFeature.Endpoint Halt command, the application clears the Stall bit.
5. The endpoint behaves normally and the application can re-enable the endpoint for new transfers
Figure 15.25. Bulk IN Stall
Host ApplicationDeviceUSB
I
N
N
A
K
INTKNTXFEMP
INTR
I
N
512 bytes
A
C
K
do_in_xfer
xact_ 1 data rdy
xact_ 2 data rdy
I
N
xact_1 of 2
xact_2 of 2
NPTXFEMP INT
S
T
A
L
L
512 bytes
A
C
K
new xact
EPDisabled intr
I
N
S
T
A
L
L
idle(wait_intr)
setup_ np_in_ pkt
set_stall
ep_ disable;
flush_ nper_tx_ fifo;
Clr Global IN NP Nak
wait_for_host/
app to clr stall
clr_stall
do_in_ xfer
setup_ np_in_ pkt
1
2
3
4
5
XferSize = 1025 bytes
PktCnt = 3
EPEna = 1
I
N
N
A
K
I
N
INTKNTXFEMP
INTR
15.4.4.2.3.6 Incomplete Isochronous IN Data Transfers
This section describes what the application must do on an incomplete isochronous IN data transfer.
Internal Data Flow
1. An isochronous IN transfer is treated as incomplete in one of the following conditions.