Datasheet

273
ATmega16U4/32U4 [DATASHEET]
Atmel-7766J-USB-ATmega16U4/32U4-Datasheet_04/2016
Setting DETACH will disconnect the pull-up on the D+ or D- pad (depending on full or low speed mode
selected). Then, clearing DETACH will connect the pull-up on the D+ or D- pad.
Figure 22-3. Detach a Device in Full-speed
22.10 Remote Wake-up
The “Remote Wake-up” (or “upstream resume”) feature is the only operation allowed to be sent by the device on
its own initiative. Anyway, to do that, the device should first have received a DEVICE_REMOTE_WAKEUP
request from the host.
First, the USB controller must have detected the “suspend” state of the line: the remote wake-up can only
be sent when a SUSPI flag is set
The firmware has then the ability to set RMWKUP to send the “upstream resume” stream. This will
automatically be done by the controller after 5ms of inactivity on the USB line.
When the controller starts to send the “upstream resume”, the UPRSMI interrupt is triggered (if enabled).
SUSPI is cleared by hardware
RMWKUP is cleared by hardware at the end of the “upstream resume”
If the controller detects a good “End Of Resume” signal from the host, an EORSMI interrupt is triggered (if
enabled)
22.11 STALL Request
For each endpoint, the STALL management is performed using two bits:
STALLRQ (enable stall request)
STALLRQC (disable stall request)
STALLEDI (stall sent interrupt)
To send a STALL handshake at the next request, the STALLRQ request bit has to be set. All following requests
will be handshak’ed with a STALL until the STALLRQC bit is set.
Setting STALLRQC automatically clears the STALLRQ bit. The STALLRQC bit is also immediately cleared by
hardware after being set by software. Thus, the firmware will never read this bit as set.
Each time the STALL handshake is sent, the STALLEDI flag is set by the USB controller and the EPINTx
interrupt will be triggered (if enabled).
The incoming packets will be discarded (RXOUTI and RWAL will not be set).
The host will then send a command to reset the STALL: the firmware just has to set the STALLRQC bit and to
reset the endpoint.
22.11.1 Special Consideration for Control Endpoints
A SETUP request is always ACK’ed.
EN=1
D +
UVREF
D -
Detach, then
Attach
EN=1
D +
UVREF
D -