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 />

3. When the application completely reads an isochronous OUT data packet (data <strong>and</strong><br />

status) from the receive FIFO, the core updates the RXDPID field in<br />

OTG_FS_DOEPTSIZx with the data PID of the last isochronous OUT data packet read<br />

from the receive FIFO.<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 Endpoint Enable, ClearNAK, <strong>and</strong> Even/Odd frame bits.<br />

– EPENA = 1<br />

– CNAK = 1<br />

– EONUM = (0: Even/1: Odd)<br />

3. In Slave mode, wait for the RXFLVL interrupt (in OTG_FS_GINTSTS) <strong>and</strong> empty the<br />

data packets from the receive FIFO<br />

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

4. The assertion of the XFRC interrupt (in OTG_FS_DOEPINTx) marks the completion of<br />

the isochronous OUT data transfer. This interrupt does not necessarily mean that the<br />

data in memory are good.<br />

5. This interrupt cannot always be detected for isochronous OUT transfers. Instead, the<br />

application can detect the IISOOXFRM interrupt in OTG_FS_GINTSTS.<br />

6. Read the OTG_FS_DOEPTSIZx register to determine the size of the received transfer<br />

<strong>and</strong> to determine the validity of the data received in the frame. The application must<br />

treat the data received in memory as valid only if one of the following conditions is met:<br />

– RXDPID = D0 (in OTG_FS_DOEPTSIZx) <strong>and</strong> the number of USB packets in<br />

which this payload was received = 1<br />

– RXDPID = D1 (in OTG_FS_DOEPTSIZx) <strong>and</strong> the number of USB packets in<br />

which this payload was received = 2<br />

– RXDPID = D2 (in OTG_FS_DOEPTSIZx) <strong>and</strong> the number of USB packets in<br />

which this payload was received = 3<br />

The number of USB packets in which this payload was received =<br />

Application programmed initial packet count – Core updated final packet count<br />

The application can discard invalid data packets.<br />

● Incomplete isochronous OUT data transfers<br />

This section describes the application programming sequence when isochronous OUT data<br />

packets are dropped inside the core.<br />

Internal data flow:<br />

1. For isochronous OUT endpoints, the XFRC interrupt (in OTG_FS_DOEPINTx) may not<br />

always be asserted. If the core drops isochronous OUT data packets, the application<br />

could fail to detect the XFRC interrupt (OTG_FS_DOEPINTx) under the following<br />

circumstances:<br />

– When the receive FIFO cannot accommodate the complete ISO OUT data packet,<br />

the core drops the received ISO OUT data<br />

– When the isochronous OUT data packet is received with CRC errors<br />

– When the isochronous OUT token received by the core is corrupted<br />

Doc ID 13902 Rev 9 819/995

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

Saved successfully!

Ooh no, something went wrong!