English
Language : 

EFM32WG Datasheet, PDF (310/834 Pages) List of Unclassifed Manufacturers – The EFM32WG Wonder Gecko is the ideal choice for demanding 8-, 16-, and 32-bit energy sensitive applications.
...the world's most energy friendly microcontrollers
Application Programming Sequence
1. Program the USB_DIEPx_TSIZ register with the transfer size and corresponding packet count. In
DMA mode, also program the USB_DIEPx_DMAADDR register.
2. Program the USB_DIEPx_CTL register with the endpoint characteristics and set the CNAK and
Endpoint Enable bits.
3. In slave mode when transmitting non-zero length data packet, the application must poll the
USB_DIEPx_TXFSTS register (where x is the FIFO number associated with that endpoint) to
determine whether there is enough space in the data FIFO. The application can optionally use
USB_DIEPx_INT.TXFEMP before writing the data.
15.4.4.2.3.12 Examples
Slave Mode Bulk IN Transaction
These notes refer to Figure 15.27 (p. 310) .
1. The host attempts to read data (IN token) from an endpoint.
2. On receiving the IN token on the USB, the core returns a NAK handshake, because no data is available
in the transmit FIFO.
3. To indicate to the application that there was no data to send, the core generates a
USB_DIEPx_INT.INTKNTXFEMP (IN Token Received When TxFIFO Empty) interrupt.
4. When data is ready, the application sets up the USB_DIEPx_TSIZ register with the Transfer Size and
Packet Count fields.
5. The application writes one maximum packet size or less of data to the Non-periodic TxFIFO.
6. The host reattempts the IN token.
7. Because data is now ready in the FIFO, the core now responds with the data and the host ACKs it.
8. Because the XFERSIZE is now zero, the intended transfer is complete. The device core generates
a USB_DIEPx_INT.XFERCOMPL interrupt.
9. The application processes the interrupt and uses the setting of the USB_DIEPx_INT.XFERCOMPL
interrupt bit to determine that the intended transfer is complete.
Figure 15.27. Slave Mode Bulk IN Transaction
H ost
1
USB
IN
NAK
IN
NAK
D e v ice
3
IN
2
5
Applicat ion
INTKNTXFEMP
INTR
idle until intr
wait for
xfer
4
new xfer
r d y?
Yes
xfer_ cnt = 512 byt es
pkt cnt= 1
EP Enable = 1
wr_reg(ep. DIEPTSIZn)
x a c t_1
6
set up_np_ in_pkt()
IN
512 bytes
ACK
7
8
XFERCOMPL
INTR
IN Tkn = 0
9
Tim eout=0
XferCom p= 1
idle until intr
2013-05-08 - Wonder Gecko Family - d0233_Rev0.50
310
www.energymicro.com