AT32WB415
Series Reference Manual
2022.04.13
Page 311
Ver 2.00
Program the OTGFS_DIEPTXF0 register to be able to transmit control IN data. The allocated
SRAM is equal to at least 1 largest-packet-size of control endpoint 0
5. Reset the device addres in the device configuration register
6. Program the following fields in the endpoint-specific registers to ensure that control OUT endpoint 0
is able to receive a SETUP packet
OTGFS_DOEPTSIZ0.SUPCNT = 0x3(to receive up to 3 consecutive SETUP packets)
At this point, all initialization required to receive SETUP packets is done.
20.5.4.3 Endpoint initialization on enumeration completion
This section describes the operations required for the application to perform when an enumeration
completion interrupt signal is detected:
Upon detecting the enumeration completion interrupt signal, read the OTGFS_DSTS register to
get the enumeration speed
Program the MPS bit in the OTGFS_DIEPCTL0 register to set the maximum packet size. This
operation is used to configure control endpoint 0. The maximum packet size for a control endpoint
depends on the enumeration speed
Unmask SOF interrupts.
At this point, the device is ready to receive SOF packets and has been configured to peform control
transfers on control endpoint 0.
20.5.4.4 Endpoint initialization on SetAddress command
This section describes the operations required for the application to perform when the application
receives a SetAddress command in a SETUP packet
Program the OTGFS_DCFG register with the device address received in the SetAddress
command
Program the controller to send an IN packet
20.5.4.5 Endpoint initialization on SetConfiguration/SetInterface
command
This section describes the operations required for the application to perform when the application
receives a SetConfiguration / SetInterface command in a SETUP packet.
When a SetConfiguration command is received, the application must program the endpoint
registers according to the characteristics of the valid endpoints defined in the new configuratoin
When a SetInterface command is received, the application must program the endpoint registers
of the endpoints affected by this command
Some endpoints that were valid in the pevious configuration are not valid in the new
configuration. These invalid endpoints must be disabled
Refer to Endpoint activation and USB endpoint deactivation for more information on how to
activate or disable a certain endpoint
Unmask the interrupt for each valid endpoint and mask the interrupts for all invalid endpoints in
the DAINTMSK register
Refer to OTGFS FIFO configuration for more information on how to program SRAM for each
FIFO
After all required endpoints are configured, the application must program the controller to send a
status IN packet
At this point, the device controller has been ready to receive and transmit any type of data packet.
20.5.4.6 Endpoint activation
This section describes how to activate a device endpoint or configure an existing device endpoint to a
new type.
1.Program the following bits in the OTGFS_DIEPCTLx register (for IN or bidirectional endpoints) or the
OTGFS_DOEPCTLx register (for OUT or bidirectional endpoints)