![](http://datasheet.mmic.net.cn/30000/M30245MC-XXXGP_datasheet_2358670/M30245MC-XXXGP_260.png)
M30245 Group
Usage Notes
Rev.2.00
Oct 16, 2006
page 258 of 264
REJ03B0005-0200
Programming Notes
USB
The following Programming Notes should be incorporated into user code, to ensure strict adherence to the USB
protocol for Control Transfers.
(1) In applications requiring high-reliability, we recommend providing the system with protective measures, such as
USB function initialization by software or USB reset by the host, to prevent USB communication from being termi-
nated unexpectedly, for example due to external causes such as noise.
(2) USB2.0 specification stipulates a driver impedance 28 to 44
(see 7.1.1.1 Full-speed (12Mb/s) Driver Characteris-
tics). Connect a serial resistor (recommended value: 27 to 33
) to the USB D+ pin and the USB D- pin to satisfy this
specification. Also connect, if required, a capacitor between the USB D+ pin or USB D-pin and the Vss pin. These
capacitors are to control ringing or adjust the rise and fall times and the crossover point of D+/D-. The numerical
values and configuration of the peripheral components need to be adjusted according to differences in the charac-
teristic impedance and layout of the printed circuit board. on which they are mounted. Therefore, perform careful
evaluation of the system in use and observe the waveforms before deciding on connection or disconnection and
adjusting the values of the resistors and capacitors.
(3) Do not connect the D+ pin or the D- pin to a choke coil.
(4) If the USB Attach/Detach function will not be used, connect the UVcc pin and the USB D+ pin via a 1.5 k
resistor.
(The D+ line pull-up timing depends on the UVcc pin.) If the USB Attach/Detach function is used, connect the P90/
ATTACH pin and the USB D+ pin via a 1.5 k
resistor. Regardless of whether or not the USB Attach/Detach function
is used, connect the UVcc pin to the power supply. In addition, the time required for the host PC to recognize the USB
Attach/Detach state will vary depending state of the system as a whole, including board resistance and capacitance
components, USB cable capacitance, and the board characteristics and processing speed of the host. Perform
careful evaluation of the system in use.
(5) The interrupt service routine (ISR) associated with those USB Function interrupts that are caused by errors must
have execution priority over the ISR for EP0 interrupts. Upon receipt of a USB Function interrupt, the following actions
should be taken:
Step #1: From the USB Interrupt Status (USBIS) and the USB Endpoint 0 Control & Status (EP0CS) registers,
determine if the 'Error Interrupt Status Flag' & the SETUP_END flag (i.e., INTST8 &
EP0CSR5, respectively) are
both set.
[YES] => Set CLR_SETUP_END (EP0CSR11). Go to Step #2.
[NO] => No special S/W action required. Go to Step #1 after the next USB Function interrupt.
Step #2: Is EP0 IN FIFO loading in progress - i.e., data has been written to EP0 IN FIFO, but SET_IN_BUF_RDY
(EP0CSR7) is not yet set?
[YES] => Set SET_IN_BUF_RDY (EP0CSR7). Go to Step #3 after the next EP0 interrupt.
[NO] => No special S/W action required. Go to Step #1 after the next USB Function interrupt.
Step #3: Are OUT_BUF_RDY & SETUP (i.e., EP0CSR0 & EP0CSR2, respectively) set?
[YES] => Go to Step #4.
[NO] => Go to Step #3 after the next EP0 interrupt.
Step #4: Does the current Control Transfer Setup stage DATA0 packet identify a Control Read Transfer?
[YES] => Complete loading EP0 IN FIFO. Set CLR_OUT_BUF_RDY, SET_IN_BUF_RDY, & CLR_SETUP (i.e.,
EP0CSR6, EP0CSR7, & EP0CSR8, respectively). Go to Step #1 after the next USB Function interrupt.
[NO] => Go to Step #3 after the next EP0 interrupt.
Refer to the flowchart in Figure 1.211 for more information on this programming note.