
RM0008
USB on-the-go full-speed (OTG_FS)
Doc ID 13902 Rev 12
811/1096
Endpoint control
●
The following endpoint controls are available to the application through the device
endpoint-
x
IN/OUT control register (DIEPCTL
x
/DOEPCTL
x
):
–
Endpoint enable/disable
–
Endpoint activate in current configuration
–
Program USB transfer type (isochronous, bulk, interrupt)
–
Program supported packet size
–
Program Tx-FIFO number associated with the IN endpoint
–
Program the expected or transmitted data0/data1 PID (bulk/interrupt only)
–
Program the even/odd frame during which the transaction is received or
transmitted (isochronous only)
–
Optionally program the NAK bit to always negative-acknowledge the host
regardless of the FIFO status
–
Optionally program the STALL bit to always stall host tokens to that endpoint
–
Optionally program the SNOOP mode for OUT endpoint not to check the CRC
field of received data
Endpoint transfer
The device endpoint-
x
transfer size registers (DIEPTSIZ
x
/DOEPTSIZ
x
) allow the application
to program the transfer size parameters and read the transfer status. Programming must be
done before setting the endpoint enable bit in the endpoint control register. Once the
endpoint is enabled, these fields are read-only as the OTG FS core updates them with the
current transfer status.
The following transfer parameters can be programmed:
●
Transfer size in bytes
●
Number of packets constituing the overall transfer size
Endpoint status/interrupt
The device endpoint-
x
interrupt registers (DIEPINT
x
/DOPEPINT
x)
indicate the status of an
endpoint with respect to USB- and AHB-related events. The application must read these
registers when the OUT endpoint interrupt bit or the IN endpoint interrupt bit in the core
interrupt register (OEPINT bit in OTG_FS_GINTSTS or IEPINT bit in OTG_FS_GINTSTS,
respectively) is set. Before the application can read these registers, it must first read the
device all endpoints interrupt (OTG_FS_DAINT) register to get the exact endpoint number
for the device endpoint-
x
interrupt register. The application must clear the appropriate bit in
this register to clear the corresponding bits in the DAINT and GINTSTS registers