
139/230
ST92163 - USB PERIPHERAL (USB)
USB INTERFACE (
Cont’d
)
Procedure for entering Suspend Mode
1. Set the TIM_SUSP bit in the USBCTLR register
(bit 6 of R252 in page 15) to suspend the digital
part of the USB cell.
2. Clear both the Wake-up Pending Registers
WUPRH & WUPRL (R254 & R255 in page 57)
to flush all pending wakeup events.
3. Set the LP_SUSP bit in the USBCTLR register
(bit 1 of R252 in page 15) to put the USB cell in
Low Power Suspend mode.
4. Set the ID1S and WKUP-INT bits in the WUC-
TRL register (bit 0 & 1 of R249 in page 57) to
enable the interrupt from the wakeup lines.
5. Write the stop sequence 1, 0, 1 to the STOP bit
of the WUCTRL (bit 2 of R249 in page 57) to
enter stop mode. This stop sequence has to be
executed as continuous sequence of write
instructions without any other register read/
write instructions within the sequence.
6. Insert at least 3 NOP instructions after the stop
sequence in step 5 to allow the MCU clock to
stop.
7. Read the WKCTRL register.
If the STOP bit (bit 2) is 0, it means that the
MCU was stopped and is being woken up by an
external event.
If the STOP bit (bit 2) is 1, it means that the
stop sequence in step 5 was broken by an inter-
rupt or DMA request. In this case, step 5 has to
be executed again until the MCU is stopped.
Procedure for quitting Suspend Mode
There are two ways to wake up the ST9 from Stop
mode: USB bus activity or signal triggering on the
external wakeup lines.
– If the MCU is woken up by USB bus activity, an
“End of Suspend” interrupt is generated if it is en-
abled.
– If the MCU is woken up by one of the external
wakeup lines, an INTD1 interrupt is generated if
the INTD1 interrupt is enabled and the WKUP-
INT bit in the WUCTRL register (bit 0 of R249 in
page 57) is set.
– After the MCU is woken up, wait until the LOCK
bit in the CLK_FLAG register (bit 2 of R242 in
page 55) is at 1 to ensure that the clock PLL is
locked. Then set the CSU_CKSEL bit in the
CLK_FLAG register if it is necessary, since this
bit is cleared by hardware when the MCU stops.
– Check the bits in the Wake-up Pending Regis-
ters WU_WUPRH & WU_WUPRL to determine
which pin has woken up the MCU. Then clear the
Wake-up Pending Registers.
Procedure for sending the remote wakeup
(RESUME) signal
After the MCU has been woken up by one of the
external wakeup lines and the source of this wake-
up event is identified, the application may send a
remote wakeup (RESUME) signal using the fol-
lowing procedure:
1. To ensure that the host enables the remote
wakeup feature:
2. Clear the LP_SUSP bit in the USBCTLR regis-
ter (bit 1 of R252 in page 15) to power up the
USB transceiver. Do not clear the TIM_SUSP
bit in the USBCTLR register if an “End of Sus-
pend” interrupt is expected later.
3. Set the RESUME bit in the USBCTLR (bit 3 of
R252 in page 15) to send the RESUME signal.
4. Clear the RESUME bit after 1 to 15 ms, to
ensure that the RESUME signal lasts long
enough.
5. Clear the ESUSP bit in the USBISTR register
(bit 4 of R249 in page 15), since an “End of
Suspend” interrupt is generated by setting
RESUME bit falsely.
6. An “End of Suspend” interrupt will be generated
when the bus activity is resumed by the host, if
the TIM_SUSP bit is not cleared in step 2.
Note:
To reduce power consumption during Stop
mode, set as many I/O ports as possible to open
drain output mode and set all ports to 0.