AT32WB415
Series Reference Manual
2022.04.13
Page 332
Ver 2.00
20.6.3.4 OTGFS USB configuration register (OTGFS_GUSBCFG)
This register is used to configure the controller after power-on or a change between host mode and
device mode. This register contains USB and USB-PHY related parameters. The application must
program the register before handling any transaction on either the AHB or USB. Do not change this
register after the initial configuration.
Bit
Register
Reset value
Type
Description
Bit 31
COTXPKT
0x0
rw
Accesible in both host mode and device modes
Corrupt Tx packet
This bit is for debug purpose only. Do not set this bit to 1.
Bit 30
FDEVMODE
0x0
rw
Accesible in both host mode and device modes
Force device mode
Writing 1 to this bit forces the controller to go into device
mode, irrespective of the status of the ID input poin.
0: Normal mode
1: Force device mode
After setting this bit, the application must wait at least 25ms
before the configuration takes effect.
Bit 29
FHSTMODE
0x0
rw
Accesible in both host mode and device modes
Force host mode
Writing 1 to this bit forces the controller to go into host
mode, irrespective of the status of the ID input poin.
0: Normal mode
1: Force host mode
After setting this bit, the application must wait at least 25ms
before the configuration takes effect.
Bit 28: 15 Reserved
0x0000
resd
Kept at its default value.
Bit 14
Reserved
0x0
resd
Kept at its default value.
Bit 13: 10 USBTRDTIM
0x5
rw
Accesible in device mode
USB Turnaround Time
This field sets the turnaround time in PHY clocks. It defines
the response time when the MAC sends a request to the
packet FIFO controller (PFC) to fetch data from the DFIFO
(SPRAM). These bits must be configured as follows:
0101: When the MAC interface is 16-bit UTMI+
1001: When the MAC interface is 8-bit UTMI+
Note: The aforementioned values are calculated based on
a minimum of 30MHz AHB frequency. The USB turnaround
time is critical for certifications with long cables and 5-Hub.
If you want the AHB to run below 30 MHz, and don’t care
about the USB turnaround time, you can set larger values
for these bits.
Bit 9: 3
Reserved
0x00
resd
Kept at its default value.
Bit 2: 0
TOUTCAL
0x0
rw
Accesible in both host mode and device modes
FS Timeout calibration
The number of PHY clocks that the application programs
in these bits is added to the full-speed interpacket timeout
duration in order to compensate for any additional latency
introduced by the PHY. This action can be required,
because the delay triggered by the PHY while generating
the line state condition can vary from one PHY to another.
In full-speed mode, the USB standard timeout value is
16~18 (inclusive) bit times. The application must program
these bits based on the enumeration speed. The number
of bit times added per PHY clock is 0.25 bit times.