- •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
Power modes
Idle mode |
In this mode, the CPU core is halted (CPU clock stopped). The Idle mode is taken wether the |
|
USB controller is running or not. The CPU can wake up on any USB interrupts. |
Power down |
In this mode, the oscillator is stopped and halts all the clocks (CPU and peripherals). The USB |
|
controller “wakes up” when: |
|
• the WAKEUPI interrupt is triggered (single asynchronous interrupt) |
Freeze clock
Memory access capability
The firmware has the ability to reduce the power consumption by setting the FRZCLK bit, which freeze the clock of USB controller. When FRZCLK is set, it is still possible to access to the following registers:
•USBCON,
•DPRAM direct access registers (DPADD7:0, UEDATX)
•UDCON (detach, ...)
•UDINT
•UDIEN
Moreover, when FRZCLK is set, only the asynchronous interrupt may be triggered :
•WAKEUPI
The CPU has the possibility to directly access to the USB internal memory (DPRAM).
The memory access mode is performed using 2 sfr’s: UDPADDH and UDPADDL.
To enter in this mode:
•the USBE bit must be cleared.
•the DPACC bit and the base address DPADD7:0 must be set.
Even if the USBE bit is cleared, the DPACC bit and DPADD7:0 field can be used by the firmware.
Then, a read or a write in UEDATX (device mode) is performed according to DPADD7:0 and the base address DPADD7:0 field is automatically increased. The endpoint FIFO pointers and the value of the UENUM registers are discarded in this mode.
The aim of this functionality is to use the DPRAM as extra-memory.
185
7707A–AVR–01/07
Memory management
186
When using this mode, there is no influence over the USB controller.
Unused
[DPADDL]
Endpoint 1 to N
Endpoint 0
USB DPRAM
The controller does only support the following memory allocation management.
The reservation of an Endpoint can only be made in the increasing order (Endpoint 0 to the last Endpoint). The firmware shall thus configure them in the same order.
The reservation of an Endpoint “ki” is done when its ALLOC bit is set. Then, the hardware allocates the memory and insert it between the Endpoints “ki-1” and “ki+1”. The “ki+1” Endpoint
memory “slides” up and its data is lost. Note that the “ki+2” and upper Endpoint memory does not slide.
Clearing an Endpoint enable (EPEN) does not clear either its ALLOC bit, or its configuration (EPSIZE/PSIZE, EPBK/PBK). To free its memory, the firmware should clear ALLOC. Then, the “ki+1” Endpoint memory automatically “slides” down. Note that the “ki+2” and upper Endpoint memory does not slide.
The following figure illustrates the allocation and reorganization of the USB memory in a typical example:
7707A–AVR–01/07
Table 17. Allocation and reorganization USB memory flow
|
|
Free memory |
|
Free memory |
|
Free memory |
|
|
Free memory |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
|
4 |
|
4 |
|
|
|
4 |
|
|
|
|
Conflict |
|
|
|
|
|
|
|
|
|
|
|
|||||
|
|
||||||||||||||
|
|
|
|
|
|
|
|
|
3 |
|
|
|
|
||
|
|
3 |
|
3 |
|
Lost memory |
|
|
|
|
|
|
|||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||
|
|
|
|
|
|
3 |
|
|
|
2 (bigger size) |
|
|
|
|
|
|
|
2 |
|
EPEN=0 |
|
|
|
|
|
|
|
|
|
||
|
|
||||||||||||||
|
|
|
(ALLOC=1) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
|
1 |
|
1 |
|
|
|
1 |
|
|
|
|
|
|
|
||||||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
0 |
|
0 |
|
0 |
|
|
|
0 |
|
|
|
|
|
|
|
||||||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
EPEN=1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
||
ALLOC=1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
||
|
|
Endpoints |
|
Endpoint Disable |
|
Free its memory |
|
|
Endpoint |
||||||
|
|
|
|
|
|
||||||||||
|
|
activation |
|
|
(ALLOC=0) |
|
|
Activatation |
|||||||
|
|
|
|
|
|
|
|||||||||
PAD suspend
•First, Endpoint 0 to Endpoint 4 are configured, in the growing order. The memory of each is reserved in the DPRAM.
•Then, the Endpoint 2is disabled (EPEN=0), but its memory reservation is internally kept by the controller.
•Its ALLOC bit is cleared: the Endpoint 3 “slides” down, but the Endpoint 4 does not “slide”.
•Finally, the firmware chooses to reconfigure the Endpoint 2, but with a bigger size. The controller reserved the memory after the endpoint 1 memory and automatically “slide” the Endpoint 3. The Endpoint 4 does not move and a memory conflict appear, in that both Endpoint 3 and 4 use a common area. The data of those endpoints are potentially lost.
Note that :
•the data of Endpoint 0 are never lost whatever the activation or deactivation of the higher Endpoint. Its data is lost if it is deactivated.
•Deactivate and reactivate the same Endpoint with the same parameters does not lead to a “slide” of the higher endpoints. For those endpoints, the data are preserved.
•CFGOK is set by hardware even in the case that there is a “conflict” in the memory allocation.
The next figures illustrates the pad behaviour:
•In the “idle” mode, the pad is put in low power consumption mode.
•In the “active” mode, the pad is working.
187
7707A–AVR–01/07
