
- •Features
- •Disclaimer
- •Overview
- •Block Diagram
- •Pin Descriptions
- •Port B (PB7..PB0)
- •Port C (PC7..PC0)
- •Port D (PD7..PD0)
- •D-/SDATA
- •UGND
- •UVCC
- •UCAP
- •RESET/PC1/dW
- •XTAL1
- •XTAL2/PC0
- •AVR CPU Core
- •Introduction
- •Status Register
- •Stack Pointer
- •TABLE 1.
- •TABLE 2.
- •AVR AT90USB82/162 Memories
- •I/O Memory
- •Clock Systems and their Distribution
- •Clock Switch
- •Exemple of use
- •Swith from external clock to RC clock
- •Switch from RC clock to external clock
- •Clock Sources
- •Default Clock Source
- •External Clock
- •Internal PLL for USB interface
- •Idle Mode
- •Power-down Mode
- •Power-save Mode
- •Standby Mode
- •Analog Comparator
- •Brown-out Detector
- •Watchdog Timer
- •Port Pins
- •Resetting the AVR
- •Reset Sources
- •Power-on Reset
- •External Reset
- •Watchdog Reset
- •USB Reset
- •Watchdog Timer
- •TABLE 2.
- •TABLE 2.
- •Interrupts
- •TABLE 2.
- •Introduction
- •Configuring the Pin
- •Toggling the Pin
- •Reading the Pin Value
- •TABLE 3.
- •Unconnected Pins
- •Alternate Port Functions
- •Register Description for I/O-Ports
- •Timer/Counter0 and Timer/Counter1 Prescalers
- •Internal Clock Source
- •Prescaler Reset
- •External Clock Source
- •8-bit Timer/Counter0 with PWM
- •Overview
- •Registers
- •Definitions
- •Counter Unit
- •Normal Mode
- •Fast PWM Mode
- •8-bit Timer/Counter Register Description
- •Overview
- •Registers
- •Definitions
- •Counter Unit
- •Input Capture Unit
- •Noise Canceler
- •Force Output Compare
- •Normal Mode
- •Fast PWM Mode
- •16-bit Timer/Counter Register Description
- •TABLE 2.
- •TABLE 2.
- •Slave Mode
- •Master Mode
- •Data Modes
- •USART
- •Overview
- •Clock Generation
- •External Clock
- •Frame Formats
- •Parity Bit Calculation
- •TABLE 2.
- •TABLE 3.
- •TABLE 4.
- •Parity Generator
- •TABLE 3.
- •TABLE 2.
- •Receiver Error Flags
- •Parity Checker
- •Disabling the Receiver
- •TABLE 2.
- •Using MPCMn
- •Receiver Flow Control
- •Overview
- •Clock Generation
- •Frame Formats
- •TABLE 2.
- •Data Transfer
- •TABLE 3.
- •USB controller
- •Features
- •Block Diagram
- •Typical Application Implementation
- •Device mode
- •Bus Powered device
- •Introduction
- •Interrupts
- •Power modes
- •Idle mode
- •Power down
- •Freeze clock
- •Memory access capability
- •Memory management
- •PAD suspend
- •D+/D- Read/write
- •Registers description
- •USB general registers
- •USB Software Operating modes
- •USB Device Operating modes
- •Introduction
- •Power-on and reset
- •Endpoint reset
- •USB reset
- •Endpoint selection
- •Endpoint activation
- •Address Setup
- •Detach
- •Remote Wake-up
- •STALL request
- •Special consideration for Control Endpoints
- •STALL handshake and Retry mechanism
- •CONTROL endpoint management
- •Control Write
- •Control Read
- •Overview
- •“Manual” mode
- •Detailed description
- •IN endpoint management
- •“Manual” mode
- •Detailed description
- •Abort
- •Isochronous mode
- •Underflow
- •CRC Error
- •Overflow
- •Interrupts
- •Registers
- •USB device general registers
- •USB device endpoint registers
- •Characteristics
- •Analog Comparator
- •Application Section
- •Boot Reset Fuse
- •Simple Assembly Code Example for a Boot Loader
- •debugWIRE On-chip Debug System
- •Features
- •Overview
- •Physical Interface
- •Software Break Points
- •Limitations of debugWIRE
- •debugWIRE Related Register in I/O Memory
- •Fuse Bits
- •Latching of Fuses
- •Signature Bytes
- •Calibration Byte
- •Signal Names
- •Chip Erase
- •Reading the Flash
- •Reading the EEPROM
- •Electrical Characteristics
- •Absolute Maximum Ratings*
- •DC Characteristics
- •External Clock Drive Waveforms
- •External Clock Drive
- •Maximum speed vs. VCC
- •Supply Current of IO modules
- •Example 1
- •Example 2
- •Example 3
- •Instruction Set Summary
- •Packaging Information
- •TQFP32

|
|
|
|
|
|
|
|
|
|
|
|
|
If the endpoint uses 2 banks, the second one can be read by the HOST while the current is |
||||
|
being written by the CPU. Then, when the CPU clears FIFOCON, the next bank may be already |
||||
|
ready (free) and TXINI is set immediately. |
||||
Abort |
An “abort” stage can be produced by the host in some situations: |
||||
|
• In a control transaction: ZLP data OUT received during a IN stage, |
||||
|
• In an isochronous IN transaction: ZLP data OUT received on the OUT endpoint during a IN |
||||
|
stage on the IN endpoint |
||||
|
• ... |
||||
|
The KILLBK bit is used to kill the last “written” bank. The best way to manage this abort is to per- |
||||
|
form the following operations: |
||||
|
Table 18. Abort flow |
Endpoint |
|
|
Abort |
|
|
Clear |
|
|
UEIENX. |
|
|
TXINE |
|
|
NBUSYBK |
No |
|
=0 |
|
|
Yes |
|
|
Endpoint |
|
KILLBK=1 |
reset |
|
|
|
|
|
|
Yes |
KILLBK=1 |
|
|
|
|
|
No |
Disable the TXINI interrupt.
Abort is based on the fact that no banks are busy, meaning that nothing has to be sent.
Kill the last written bank.
Wait for the end of the procedure.
|
|
Abort done |
Isochronous mode |
|
|
Underflow |
An underflow can occur during IN stage if the host attempts to read a bank which is empty. In |
|
|
|
this situation, the UNDERFI interrupt is triggered. |
|
|
An underflow can also occur during OUT stage if the host send a packet while the banks are |
|
|
already full. Typically, he CPU is not fast enough. The packet is lost. |
|
|
It is not possible to have underflow error during OUT stage, in the CPU side, since the CPU |
|
|
should read only if the bank is ready to give data (RXOUTI=1 or RWAL=1) |
CRC Error |
A CRC error can occur during OUT stage if the USB controller detects a bad received packet. In |
|
|
|
this situation, the STALLEDI interrupt is triggered. This does not prevent the RXOUTI interrupt |
|
|
from being triggered. |
Overflow |
In Control, Isochronous, Bulk or Interrupt Endpoint, an overflow can occur during OUT stage, if |
|
|
|
the host attempts to write in a bank that is too small for the packet. In this situation, the OVERFI |
|
|
interrupt is triggered (if enabled). The packet is hacknowledged and the RXOUTI interrupt is also |
|
|
triggered (if enabled). The bank is filled with the first bytes of the packet. |
200 |
|
|
|
|
7707A–AVR–01/07

|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
It is not possible to have overflow error during IN stage, in the CPU side, since the CPU should |
||||
|
|
|||||
|
|
write only if the bank is ready to access data (TXINI=1 or RWAL=1). |
||||
|
Interrupts |
The next figure shows all the interrupts sources: |
|
|||
|
|
Figure 86. USB Device Controller Interrupt System |
|
|||
|
|
|
|
|
|
|
|
|
|
UPRSMI |
|
|
|
|
|
|
|
|
|
|
|
|
|
UDINT.6 |
UPRSME |
|
|
|
|
|
|
|
||
|
|
|
|
UDIEN.6 |
|
|
|
|
|
EORSMI |
|
|
|
|
|
|
|
|
|
|
|
|
|
UDINT.5 |
EORSME |
|
|
|
|
|
|
|
||
|
|
|
|
UDIEN.5 |
|
|
|
|
|
WAKEUPI |
|
|
|
|
|
|
|
|
|
|
|
|
|
UDINT.4 |
WAKEUPE |
USB Device |
|
|
|
|
|
|||
|
|
|
|
UDIEN.4 |
Interrupt |
EORSTI
UDINT.3
EORSTE
UDIEN.3
SOFI
UDINT.2
SOFE
UDIEN.2
SUSPI
UDINT.0
SUSPE
UDIEN.0
There are 2 kind of interrupts: processing (i.e. their generation are part of the normal processing) and exception (errors).
Processing interrupts are generated when:
• |
Upstream resume |
(UPRSMI) |
• |
End of resume |
(EORSMI) |
• |
Wake up |
(WAKEUPI) |
• End of reset (Speed Initialization) |
(EORSTI) |
|
• |
Start of frame |
(SOFI, if FNCERR=0) |
• Suspend detected after 3 ms of inactivity |
(SUSPI) |
|
Exception Interrupts are generated when: |
|
|
• CRC error in frame number of SOF |
(SOFI, FNCERR=1) |
201
7707A–AVR–01/07