Datasheet
Section 14 Universal Serial Bus (USB)
Rev.7.00 Dec. 24, 2008 Page 507 of 698
REJ09B0074-0700
(1) Setup Stage
USB function Firmware
Receive SETUP token
Receive 8-byte command
data in UEDR0s
To data stage
Set setup command
recive complete flag
(SetupTS in UIFR0 = 1)
Automatic
processing by
this module
Clear SetupTS flag
(SetupTS in UIFR0 = 0)
Clear EP0i FIFO (EP0iCLR in UFCLR = 1)
Clear EP0o FIFO (EP0oCLR in UFCLR = 1)
Read 8-byte data from UEDR0s
Decode command data
Determine data stage direction*
1
Write 1 to EP0s read complete bit
(EP0sRDFN in UTRG0 = 1)
To control-in
data stage
To control-out
data stage
Command
to be processed by
firmware?
EXIRQx
Yes
No
Notes: 1. In the setup stage, the firmware first analyzes the command data that is sent from the host and
required to be processed by the firmware, and determines subsequent processing.
(For example, the data stage direction.)
2. When the transfer direction is control-out, the EP0i transfer request interrupt that is required in the
status stage should be enabled. When the transfer direction is control-in, this interrupt is not
required and must be disabled.
*
2
Figure 14.12 Setup Stage Operation