USB on-the-go full-speed (OTG_FS)
–
•
IN endpoint disable
Use the following sequence to disable a specific IN endpoint that has been previously
enabled.
Application programming sequence
1.
The application must stop writing data on the AHB for the IN endpoint to be disabled.
2.
The application must set the endpoint in NAK mode.
–
3.
Wait for the INEPNE interrupt in OTG_FS_DIEPINTx.
4.
Set the following bits in the OTG_FS_DIEPCTLx register for the endpoint that must be
disabled.
–
–
5.
Assertion of the EPDISD interrupt in OTG_FS_DIEPINTx indicates that the core has
completely disabled the specified endpoint. Along with the assertion of the interrupt, the
core also clears the following bits:
–
–
6.
The application must read the OTG_FS_DIEPTSIZx register for the periodic IN EP, to
calculate how much data on the endpoint were transmitted on the USB.
7.
The application must flush the data in the Endpoint transmit FIFO, by setting the
following fields in the OTG_FS_GRSTCTL register:
–
–
The application must poll the OTG_FS_GRSTCTL register, until the TXFFLSH bit is cleared
by the core, which indicates the end of flush operation. To transmit new data on this
endpoint, the application can re-enable the endpoint at a later point.
•
Generic non-periodic IN data transfers
Application requirements
1.
Before setting up an IN transfer, the application must ensure that all data to be
transmitted as part of the IN transfer are part of a single buffer.
2.
For IN transfers, the Transfer Size field in the Endpoint Transfer Size register denotes a
payload that constitutes multiple maximum-packet-size packets and a single short
packet. This short packet is transmitted at the end of the transfer.
–
–
–
1084/1378
INEPNEM = 1 in DIEPMSK
SNAK = 1 in OTG_FS_DIEPCTLx
EPDIS = 1 in OTG_FS_DIEPCTLx
SNAK = 1 in OTG_FS_DIEPCTLx
EPENA = 0 in OTG_FS_DIEPCTLx
EPDIS = 0 in OTG_FS_DIEPCTLx
TXFNUM (in OTG_FS_GRSTCTL) = Endpoint transmit FIFO number
TXFFLSH in (OTG_FS_GRSTCTL) = 1
To transmit a few maximum-packet-size packets and a short packet at the end of
the transfer:
Transfer size[EPNUM] = x × MPSIZ[EPNUM] + sp
If (sp > 0), then packet count[EPNUM] = x + 1.
Otherwise, packet count[EPNUM] = x
To transmit a single zero-length data packet:
Transfer size[EPNUM] = 0
Packet count[EPNUM] = 1
To transmit a few maximum-packet-size packets and a zero-length data packet at
the end of the transfer, the application must split the transfer into two parts. The
RM0033 Rev 8
RM0033
Need help?
Do you have a question about the STM32F205 series and is the answer not in the manual?