![](http://datasheet.mmic.net.cn/30000/M30245MC-XXXGP_datasheet_2358670/M30245MC-XXXGP_82.png)
Rev.2.00
Oct 16, 2006
page 80 of 264
M30245 Group
Universal Serial Bus
REJ03B0005-0200
USB Special Function Registers
The MCU controls USB operation through the use of special function registers. Some USB-related special function
registers have a mix of read/write, read only, and write only register bits. Additionally, the bits may be configured to
allow the user to write only "0" or "1" to individual bits.
When accessing these registers, writing "0" to a register that can only be set to "1" by the CPU has no effect on that
register bit.
Writing "1" to a register that can only be set to "0" by the CPU has no effect on that register bit.
All USB SFRs, with the exceptions of Endpoint FIFO data registers, USBAD, and USBC can be accessed by word or
by byte at an even or odd address. Endpoint FIFO Data Registers can be accessed by either word or by byte at even
addresses only.
The contents of all USB Special Functions Registers, including USB Attach/Detach and USB Control, are preserved
after a software reset.
USB Attach/Detach Register
The USB Attach / Detach Register is shown in Figure 1.44. The register is used to attach and detach the USB
function from a USB host without physically disconnecting the USB cable. This functionality is enabled by setting
P90_SECOND to a "1". Doing this forces P90 to operate as a pull-up for D+ (through an external 1.5k ohm resistor).
The port driver is tri-stated and a "1" is always read from the port bit in this mode. When the ATTACH/DETACH bit is a
"1" (and P90_SECOND is a "1"), P90 is driven with the voltage on UVcc, causing D+ to be pulled up and the host to
detect an attach. When the ATTACH/DETACH bit is a "0" (and P90_SECOND is a "1"), P90 is tri-stated, causing D+ to
be pulled down (through the cable and 15k ohm resistor on the host/hub side) and a detach to be registered by the
host. A 1.5k ohm pull-up resistor must be connected externally from P90 to D+ when this functionality is used. When
it is not used, the 1.5k ohm resistor should be placed between UVcc and D+.
See "Vbus Detect" for information on the vbus detect enable bit.
Figure 1.44. USB Attach/Detach register (USBAD)
USB Attach/Detach Register
Symbol
Address
When reset
USBAD
001F16
0016
Bit name
Bit symbol
b7 b6 b5 b4 b3 b2 b1 b0
0 : Normal mode for Port 90
1 : Forces Port 90 to operate as pull up for D+.
P90-second
Function
Reserved
Must always be set to "0"
Port 90-Second
Attach/
Detach
Attach/Detach
0 : Tri-states, P90causing the host to detect a detach
1 : Drives P90 with voltage on UVcc, causing the host
to detect an attach
W
R
0 0 0 0 0
VBDT
Vbus detect enable
0 : Disabled
1 : Enabled