Operational Model; Setup And Out Data Transfers - ST STM32F101xx Reference Manual

Arm-based 32-bit mcus
Hide thumbs Also See for STM32F101xx:
Table of Contents

Advertisement

OTG_FS programming model
1.
In the endpoint to be deactivated, clear the USB active endpoint bit in the
OTG_FS_DIEPCTLx register (for IN or bidirectional endpoints) or the
OTG_FS_DOEPCTLx register (for OUT or bidirectional endpoints).
2.
Once the endpoint is deactivated, the core ignores tokens addressed to that endpoint,
which results in a timeout on the USB.
Note:
1
The application must meet the following conditions to set up the device core to handle traffic:
NPTXFEM and RXFLVLM in GINTMSK must be cleared.
27.6

Operational model

27.6.1

SETUP and OUT data transfers

This section describes the internal data flow and application-level operations during data
OUT transfers and SETUP transactions.
Packet read
This section describes how to read packets (OUT data and SETUP packets) from the
receive FIFO in Slave mode.
1.
On catching an RXFLVL interrupt (OTG_FS_GINTSTS register), the application must
read the Receive status pop register (OTG_FS_GRXSTSP).
2.
The application can mask the RXFLVL interrupt (in OTG_FS_GINTSTS) by writing to
RXFLVL = 0 (in GINTMSK), until it has read the packet from the receive FIFO.
3.
If the received packet's byte count is not 0, the byte count amount of data is popped
from the receive Data FIFO and stored in memory. If the received packet byte count is
0, no data is popped from the receive data FIFO.
4.
The receive FIFO's packet status readout indicates one of the following:
a)
b)
c)
d)
e)
788/813
Global OUT NAK pattern:
PKTSTS = Global OUT NAK, BCNT = 0x000, EPNUM = Don't Care (0x0),
DPID = Don't Care (0b00).
These data indicate that the global OUT NAK bit has taken effect.
SETUP packet pattern:
PKTSTS = SETUP, BCNT = 0x008, EPNUM = Control EP Num, DPID = D0.
These data indicate that a SETUP packet for the specified endpoint is now
available for reading from the receive FIFO.
Setup stage done pattern:
PKTSTS = Setup Stage Done, BCNT = 0x0, EPNUM = Control EP Num,
DPID = Don't Care (0b00).
These data indicate that the Setup stage for the specified endpoint has completed
and the Data stage has started. After this entry is popped from the receive FIFO,
the core asserts a Setup interrupt on the specified control OUT endpoint.
Data OUT packet pattern:
PKTSTS = DataOUT, BCNT = size of the received data OUT packet (0 ≤ BCNT
≤ 1 024), EPNUM = EPNUM on which the packet was received, DPID = Actual
Data PID.
Data transfer completed pattern:
PKTSTS = Data OUT Transfer Done, BCNT = 0x0, EPNUM = OUT EP Num
on which the data transfer is complete, DPID = Don't Care (0b00).
RM0034

Advertisement

Table of Contents
loading
Need help?

Need help?

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

This manual is also suitable for:

Stm32f102xxStm32f103xxStm32f105xxStm32f107xx

Table of Contents

Save PDF