User manual

...the world's most energy friendly microcontrollers
2012-04-24 - Giant Gecko Family - d0053_Rev0.96 297
www.energymicro.com
Figure 15.22. Slave Mode Bulk OUT Transaction
init_ out_ep
Host DeviceUSB
O
U
T
A
C
K
RXFLVL
INTR
wr_reg(USB_DOEPx_TSIZ)
wr_reg(USB_DOEPx_CTL)
512 bytes
O
U
T
N
A
K
xact_1
Applicatio
n
X
F
E
R
C
O
M
P
I
N
T
R
_
D
O
E
P
x
_
C
T
N
A
K
=
1
X
F
E
R
S
I
Z
E
=
0
idle until intr
rcv_out_pkt()
idle until intr
On new xfer
or RxFIFO
not em pty
1
2
3
4
5
6
7
8
XFERSIZE= 512 bytes
PKTCNT= 1
EPENA = 1
CNAK = 1
B
S
U
L
PKTCNT = 0
After a SetConfiguration/SetInterface command, the application initializes all OUT endpoints by setting
USB_DOEPx_CTL.CNAK = 1 and USB_DOEPx_CTL.EPENA = 1, and setting a suitable XFERSIZE
and PKTCNT in the USB_DOEPx_TSIZ register.
1. Host attempts to send data (OUT token) to an endpoint.
2. When the core receives the OUT token on the USB, it stores the packet in the RxFIFO because space
is available there.
3. After writing the complete packet in the RxFIFO, the core then asserts the USB_GINTSTS.RXFLVL
interrupt.
4. On receiving the PKTCNT number of USB packets, the core sets the NAK bit for this endpoint
internally to prevent it from receiving any more packets.
5. The application processes the interrupt and reads the data from the RxFIFO.
6. When the application has read all the data (equivalent to XFERSIZE), the core generates a
USB_DOEPx_INT.XFERCOMPL interrupt.
7. The application processes the interrupt and uses the setting of the USB_DOEPx_INT.XFERCOMPL
interrupt bit to determine that the intended transfer is complete.
15.4.4.2.2.9 Generic Isochronous OUT Data Transfer in DMA and Slave Modes
To initialize the core after power-on reset, the application must follow the sequence in Overview:
Programming the Core (p. 248) . Before it can communicate with the host, it must initialize an endpoint
as described in Endpoint Initialization (p. 283) . See Packet Read from FIFO in Slave Mode (p. 292) .
This section describes a regular isochronous OUT data transfer.
Application Requirements:
1. All the application requirements for non-isochronous OUT data transfers also apply to isochronous
OUT data transfers
2. For isochronous OUT data transfers, the Transfer Size and Packet Count fields must always be set
to the number of maximum-packet-size packets that can be received in a single frame and no more.
Isochronous OUT data transfers cannot span more than 1 frame.
1 <= packet count[epnum] <= 3