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.

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

RM0008<br />

5. At the end of every packet write on the AHB to external memory, the transfer size for<br />

the endpoint is decremented by the size of the written packet.<br />

6. The OUT data transfer completed pattern for an OUT endpoint is written to the receive<br />

FIFO on one of the following conditions:<br />

– The transfer size is 0 <strong>and</strong> the packet count is 0<br />

– The last OUT data packet written to the receive FIFO is a short packet<br />

(0 packet size < maximum packet size)<br />

7. When either the application pops this entry (OUT data transfer completed), a transfer<br />

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

Application programming sequence:<br />

1. Program the OTG_FS_DOEPTSIZx register for the transfer size <strong>and</strong> the corresponding<br />

packet count.<br />

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

the EPENA <strong>and</strong> CNAK bits.<br />

– EPENA = 1 in OTG_FS_DOEPCTLx<br />

– CNAK = 1 in OTG_FS_DOEPCTLx<br />

3. Wait for the RXFLVL interrupt (in OTG_FS_GINTSTS) <strong>and</strong> empty the data packets from<br />

the receive FIFO.<br />

– This step can be repeated many times, depending on the transfer size.<br />

4. Asserting the XFRC interrupt (OTG_FS_DOEPINTx) marks a successful completion of<br />

the non-isochronous OUT data transfer.<br />

5. Read the OTG_FS_DOEPTSIZx register to determine the size of the received data<br />

payload.<br />

● Generic isochronous OUT data transfer<br />

This section describes a regular isochronous OUT data transfer.<br />

Application requirements:<br />

1. All the application requirements for non-isochronous OUT data transfers also apply to<br />

isochronous OUT data transfers.<br />

2. For isochronous OUT data transfers, the transfer size <strong>and</strong> packet count fields must<br />

always be set to the number of maximum-packet-size packets that can be received in a<br />

single frame <strong>and</strong> no more. Isochronous OUT data transfers cannot span more than 1<br />

frame.<br />

3. The application must read all isochronous OUT data packets from the receive FIFO<br />

(data <strong>and</strong> status) before the end of the periodic frame (EOPF interrupt in<br />

OTG_FS_GINTSTS).<br />

4. To receive data in the following frame, an isochronous OUT endpoint must be enabled<br />

after the EOPF (OTG_FS_GINTSTS) <strong>and</strong> before the SOF (OTG_FS_GINTSTS).<br />

Internal data flow:<br />

1. The internal data flow for isochronous OUT endpoints is the same as that for nonisochronous<br />

OUT endpoints, but for a few differences.<br />

2. When an isochronous OUT endpoint is enabled by setting the Endpoint Enable <strong>and</strong><br />

clearing the NAK bits, the Even/Odd frame bit must also be set appropriately. The core<br />

receives data on an isochronous OUT endpoint in a particular frame only if the<br />

following condition is met:<br />

– EONUM (in OTG_FS_DOEPCTLx) = SOFFN[0] (in OTG_FS_DSTS)<br />

818/995 Doc ID 13902 Rev 9

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

Saved successfully!

Ooh no, something went wrong!