29.01.2015 Views

STM32F101xx, STM32F102xx, STM32F103xx, STM32F105xx and ...

STM32F101xx, STM32F102xx, STM32F103xx, STM32F105xx and ...

STM32F101xx, STM32F102xx, STM32F103xx, STM32F105xx and ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

RM0008<br />

USB on-the-go full-speed (OTG_FS)<br />

h<strong>and</strong>shake, the packet count for the endpoint is decremented by one, until the packet<br />

count is zero. The packet count is not decremented on a timeout.<br />

5. For zero length packets (indicated by an internal zero length flag), the core sends out a<br />

zero-length packet for the IN token <strong>and</strong> decrements the packet count field.<br />

6. If there are no data in the FIFO for a received IN token <strong>and</strong> the packet count field for<br />

that endpoint is zero, the core generates an “IN token received when TxFIFO is empty”<br />

(ITTXFE) Interrupt for the endpoint, provided that the endpoint NAK bit is not set. The<br />

core responds with a NAK h<strong>and</strong>shake for non-isochronous endpoints on the USB.<br />

7. The core internally rewinds the FIFO pointers <strong>and</strong> no timeout interrupt is generated.<br />

8. When the transfer size is 0 <strong>and</strong> the packet count is 0, the transfer complete (XFRC)<br />

interrupt for the endpoint is generated <strong>and</strong> the endpoint enable is cleared.<br />

Application programming sequence:<br />

1. Program the OTG_FS_DIEPTSIZx register with the transfer size <strong>and</strong> corresponding<br />

packet count.<br />

2. Program the OTG_FS_DIEPCTLx register with the endpoint characteristics <strong>and</strong> set the<br />

CNAK <strong>and</strong> EPENA (Endpoint Enable) bits.<br />

3. When transmitting non-zero length data packet, the application must poll the<br />

OTG_FS_DTXFSTSx register (where x is the FIFO number associated with that<br />

endpoint) to determine whether there is enough space in the data FIFO. The<br />

application can optionally use TXFE (in OTG_FS_DIEPINTx) before writing the data.<br />

● Generic periodic IN data transfers<br />

This section describes a typical periodic IN data transfer.<br />

Application requirements:<br />

1. Application requirements 1, 2, 3, <strong>and</strong> 4 of Generic non-periodic IN data transfers on<br />

page 825 also apply to periodic IN data transfers, except for a slight modification of<br />

requirement 2.<br />

– The application can only transmit multiples of maximum-packet-size data packets<br />

or multiples of maximum-packet-size packets, plus a short packet at the end. To<br />

transmit a few maximum-packet-size packets <strong>and</strong> a short packet at the end of the<br />

transfer, the following conditions must be met:<br />

transfer size[EPNUM] = x × MPSIZ[EPNUM] + sp<br />

(where x is an integer 0, <strong>and</strong> 0 sp < MPSIZ[EPNUM])<br />

If (sp > 0), packet count[EPNUM] = x + 1<br />

Otherwise, packet count[EPNUM] = x;<br />

MCNT[EPNUM] = packet count[EPNUM]<br />

– The application cannot transmit a zero-length data packet at the end of a transfer.<br />

It can transmit a single zero-length data packet by itself. To transmit a single zerolength<br />

data packet:<br />

– transfer size[EPNUM] = 0<br />

packet count[EPNUM] = 1<br />

MCNT[EPNUM] = packet count[EPNUM]<br />

Doc ID 13902 Rev 9 825/995

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!