ST STM32F205 series Reference Manual page 1085

Advanced arm-based 32-bit mcus
Hide thumbs Also See for STM32F205 series:
Table of Contents

Advertisement

RM0033
3.
Once an endpoint is enabled for data transfers, the core updates the Transfer size
register. At the end of the IN transfer, the application must read the Transfer size
register to determine how much data posted in the transmit FIFO have already been
sent on the USB.
4.
Data fetched into transmit FIFO = Application-programmed initial transfer size – core-
updated final transfer size
Internal data flow
1.
The application must set the transfer size and packet count fields in the endpoint-
specific registers and enable the endpoint to transmit the data.
2.
The application must also write the required data to the transmit FIFO for the endpoint.
3.
Every time a packet is written into the transmit FIFO by the application, the transfer size
for that endpoint is decremented by the packet size. The data is fetched from the
memory by the application, until the transfer size for the endpoint becomes 0. After
writing the data into the FIFO, the "number of packets in FIFO" count is incremented
(this is a 3-bit count, internally maintained by the core for each IN endpoint transmit
FIFO. The maximum number of packets maintained by the core at any time in an IN
endpoint FIFO is eight). For zero-length packets, a separate flag is set for each FIFO,
without any data in the FIFO.
4.
Once the data are written to the transmit FIFO, the core reads them out upon receiving
an IN token. For every non-isochronous IN data packet transmitted with an ACK
handshake, the packet count for the endpoint is decremented by one, until the packet
count is zero. The packet count is not decremented on a timeout.
5.
For zero length packets (indicated by an internal zero length flag), the core sends out a
zero-length packet for the IN token and decrements the packet count field.
6.
If there are no data in the FIFO for a received IN token and the packet count field for
that endpoint is zero, the core generates an "IN token received when TxFIFO is empty"
(ITTXFE) Interrupt for the endpoint, provided that the endpoint NAK bit is not set. The
core responds with a NAK handshake for non-isochronous endpoints on the USB.
7.
The core internally rewinds the FIFO pointers and no timeout interrupt is generated.
8.
When the transfer size is 0 and the packet count is 0, the transfer complete (XFRC)
interrupt for the endpoint is generated and the endpoint enable is cleared.
Application programming sequence
1.
Program the OTG_FS_DIEPTSIZx register with the transfer size and corresponding
packet count.
2.
Program the OTG_FS_DIEPCTLx register with the endpoint characteristics and set the
CNAK and EPENA (Endpoint Enable) bits.
3.
When transmitting non-zero length data packet, the application must poll the
TG_FS_DTXFSTSx register (where x is the FIFO number associated with that
O
first sends maximum-packet-size data packets and the second sends the zero-
length data packet alone.
First transfer: transfer size[EPNUM] = x × MPSIZ[epnum]; packet count = n;
Second transfer: transfer size[EPNUM] = 0; packet count = 1;
Data transmitted on USB = (application-programmed initial packet count – Core
updated final packet count) × MPSIZ[EPNUM]
Data yet to be transmitted on USB = (Application-programmed initial transfer size
– data transmitted on USB)
USB on-the-go full-speed (OTG_FS)
RM0033 Rev 8
1085/1378
1096

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the STM32F205 series and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

Stm32f207 seriesStm32f215 seriesStm32f217 series

Table of Contents