User manual

...the world's most energy friendly microcontrollers
2012-04-24 - Giant Gecko Family - d0053_Rev0.96 292
www.energymicro.com
USB_DIEPx_CTL.CNAK = 1
7. When the application clears the IN NAK bit, the core interrupts the application with a
USB_DIEPx_INT.INTKNTXFEMP. On this interrupt, the application enables the control IN endpoint
with a USB_DIEPx_TSIZ.XFERSIZE of 0 and a USB_DIEPx_TSIZ.PKTCNT of 1. This results in a
zero-length data packet for the status IN token on the USB.
8. At the end of the status IN phase, the core interrupts the application with a
USB_DIEPx_INT.XFERCOMPL interrupt.
Figure 15.20. Two-Stage Control Transfer
setup data2
setup data2
Host ApplicationDevice
USB
S
E
T
U
P
.
I
N
(
S
T
A
T
U
S
)
8 bytes
A
C
K
status_xact_2
A
C
K
L
o
s
t
R
X
F
L
V
L
I
N
T
R
setup_xact_1
N
A
K
I
N
setup_xact_2
status_xact_2
setup data1
S
E
T
U
P
A
C
K
R
X
F
L
V
L
I
N
T
R
N
A
K
I
N
setup data1
setup done
S
E
T
U
P
I
n
t
r
Clear IN
NAK
I
N
T
K
N
T
X
F
E
M
P
I
N
T
R
X
F
E
R
C
O
M
P
L
I
N
T
R
idle until intr
setup_in_ np_ pkt
s
t
s
d
a
t
a
r
d
y
proc_setup_pkt
#2
idle until intr
rcv_out_data
idle until intr
rcv_out_data
idle until intr
rcv_out_data
idle until intr
1
3
4
R
X
F
L
V
L
I
N
T
R
5
6
78
Ctl- IN NAK = 1 Ctl- OUT NAK = 1
Control IN NAK = 1
Control OUT NAK = 1
8 bytes
8 bytes
setup data1
XFERSIZE = 0 bytes
PKTCNT = 1
EPENA = 1
15.4.4.2.2.4 Packet Read from FIFO in Slave Mode
This section describes how to read packets (OUT data and SETUP packets) from the receive FIFO in
Slave mode.
1. On catching a USB_GINTSTS.RXFLVL interrupt, the application must read the Receive Status Pop
register (USB_GRXSTSP).
2. The application can mask the USB_GINTSTS.RXFLVL interrupt by writing to
USB_GINTMSK.RXFLVL = 0, until it has read the packet from the receive FIFO.
3. If the received packet’s byte count is not 0, the byte count amount of data is popped from the receive
Data FIFO and stored in memory. If the received packet byte count is 0, no data is popped from the
Receive Data FIFO.
4. The receive FIFO’s packet status readout indicates one of the following.
5. Global OUT NAK Pattern: PKTSTS = Global OUT NAK, BCNT = 0x000, EPNUM = Dont Care (0x0),
DPID = Dont Care (0b00). This data indicates that the global OUT NAK bit has taken effect.