Datasheet

Section 14 Universal Serial Bus (USB)
Rev.7.00 Dec. 24, 2008 Page 503 of 698
REJ09B0074-0700
(2) Suspend and Resume Interrupt Processing
Figure 14.8 is a flowchart of suspend and resume interrupt processing.
USB function
Firmware
Resume interrupt
processing
USB operating clock stabilization
detection interrupt processing
Suspend interrupt
processing
Start USB operating
clock oscillation
A USB operating clock
stabilization detection
interrupt occurs
Clear USB module
stop 2 mode
(Clear MSTPB0
in MSTPCRB to 0)
Clear resume flag
(Clear SPRSi in UIFR3
to 0)
Clear USB operating clock
stabilization detection flag
(Clear CK48READY
in UIFR3 to 0)
Resume main process
Prohibit IRQ6
(Clear IRQ6E in IER to 0)
Clear suspend flag
(Clear SPRSi in UIFR3
to 0)
Confirm that
remote-wakeup is
prohibited
Confirm that
remote-wakeup is enabled
Enable USB module
stop mode
(Set MSTPB0
in MSTPCRB to 1)
Set standby enable
flag to 1
Clear standby enable
flag to 0
Wait for USB operating
clock stabilization
Suspend
state confirmed?
(SPRSs in UIFR3 =
1?)
Suspend
state confirmed?
(SPRSs in UIFR3 =
1?)
Remote-
wakeup enabled?
(RWUPs in UDRR
= 1)
USB operating
clock stabilization time
has passed?
Yes
Yes
Yes
Yes
Yes
No
No
No
No
EXIRQx
No
*
4
*
4
*
5
*
3
*
1
*
5
*
1
*
2
Standby enable
flag = 0?
Suspend
state confirmed?
(SPRSs in UIFR3 =
1?)
IRQ6
Notes: 1. The standby enable flag is a software flag for controlling transition to the standby state (one of the power-down modes). There is no such
hardware flag.
2. Interrupts should be masked from when the IRQ6 interrupt is received until the SLEEP instruction is executed. Finally, unmask the interrupts
using the LDC instruction or the like and execute the SLEEP instruction immediately afterward.
3. The remote-wakeup function cannot be used unless it is enabled by the host. Accordingly, the remote-wakeup function cannot be used
unless it is enabled by the host. Accordingly, make sure to check RWUPs in UDRR before using the remote-wakeup function. However, it is
not necessary to confirm that the remote-wakeup function is enabled by the host if the application does not make use of this function.
4. When resuming using the remote wakeup function, the USB module stop state must already be cleared.
5. Return to the main process and wait for the USB operating clock stabilization detection interrupt. When resuming by means of remote-
wakeup the USB operating clock has already stabilized, so this step is not necessary.
Enable IRQ6 interrupt
(Set IRQ6E in IER to 1)
Clear suspend flag
(Clear SPRSi in UIFR3
to 0)
Figure 14.8 Example Flowchart of Suspend and Resume Interrupt Processing