...the world's most energy friendly microcontrollers
2016-04-28 - Giant Gecko Family - d0053_Rev1.20
307
www.silabs.com
15.4.4.2.3.1 Packet Write in Slave Mode
This section describes how the application writes data packets to the endpoint FIFO in Slave mode.
1. The application can either choose polling or interrupt mode.
• In polling mode, application monitors the status of the endpoint transmit data FIFO, by reading the
USB_DIEPx_TXFSTS register, to determine, if there is enough space in the data FIFO.
• In interrupt mode, application waits for the USB_DIEPx_INT.TXFEMP interrupt and then reads the
USB_DIEPx_TXFSTS register, to determine, if there is enough space in the data FIFO.
• To write a single non-zero length data packet, there must be space to write the entire packet is
the data FIFO.
• For writing zero length packet, application must not look for FIFO space.
2. Using one of the above mentioned methods, when the application determines that there is enough
space to write a transmit packet, the application must first write into the endpoint control register,
before writing the data into the data FIFO. The application, typically must do a read modify write on
the USB_DIEPx_CTL, to avoid modifying the contents of the register, except for setting the Endpoint
Enable bit.
The application can write multiple packets for the same endpoint, into the transmit FIFO, if space is
available. For periodic IN endpoints, application must write packets only for one frame. It can write
packets for the next periodic transaction, only after getting transfer complete for the previous transaction.
15.4.4.2.3.2 Setting Global Non-Periodic IN Endpoint NAK
Internal Data Flow
1. When the application sets the Global Non-periodic IN NAK bit (USB_DCTL.SGNPINNAK), the core
stops transmitting data on the non-periodic endpoint, irrespective of data availability in the Non-
periodic Transmit FIFO.
2. Non-isochronous IN tokens receive a NAK handshake reply
3. The
core
asserts
the
USB_GINTSTS.GINNAKEFF
interrupt
in
response
to
the
USB_DCTL.SGNPINNAK bit.
4. Once the application detects this interrupt, it can assume that the core is in the Global Non-periodic
IN NAK mode. The application can clear this interrupt by clearing the USB_DCTL.SGNPINNAK bit.
Application Programming Sequence
1. To stop transmitting any data on non-periodic IN endpoints, the application must set the
USB_DCTL.SGNPINNAK bit. To set this bit, the following field must be programmed
• USB_DCTL.SGNPINNAK = 1
2. Wait for the assertion of the USB_GINTSTS.GINNAKEFF interrupt. This interrupt indicates the core
has stopped transmitting data on the non-periodic endpoints.
3. The core can transmit valid non-periodic IN data after the application has set the
USB_DCTL.SGNPINNAK bit, but before the assertion of the USB_GINTSTS.GINNAKEFF interrupt.
4. The application can optionally mask this interrupt temporarily by writing to the
USB_GINTMSK.GINNAKEFFMSK bit.
• USB_GINTMSK.GINNAKEFFMSK = 0
5. To exit Global Non-periodic IN NAK mode, the application must clear the USB_DCTL.SGNPINNAK.
This also clears the USB_GINTSTS.GINNAKEFF interrupt.
• USB_DCTL.SGNPINNAK = 1
6. If the application has masked this interrupt earlier, it must be unmasked as follows:
• USB_GINTMSK.GINNAKEFFMSK = 1
15.4.4.2.3.3 Setting IN Endpoint NAK
Internal Data Flow
Summary of Contents for Giant Gecko EFM32GG
Page 842: ......