ATtiny828 8-bit AVR Microcontroller with 8K Bytes In-System Programmable Flash DATASHEET Features z High Performance, Low Power Atmel(R) AVR(R) 8-bit Microcontroller z Advanced RISC Architecture z 123 Powerful Instructions - Most Single Clock Cycle Execution 32 x 8 General Purpose Working Registers z Fully Static Operation z Up to 20 MIPS Throughput at 20 MHz z z Non-volatile Program and Data Memories z z z z z 8K Bytes of In-System Programmable Flash Program Memory z Endurance: 10,000 Write/Erase Cycles 256 Bytes of In-System Programmable EEPROM z Endurance: 100,000 Write/Erase Cycles 512 Bytes Internal SRAM Optional Boot Code Section with Independent Lock Bits Data Retention: 20 Years at 85oC / 100 Years at 25oC z Peripheral Features z z z z z z z One 8-bit and one 16-bit Timer/Counter with Two PWM Channels, Each Programmable Ultra Low Power Watchdog Timer On-chip Analog Comparator 10-bit Analog to Digital Converter z 28 External and 4 Internal, Single-ended Input Channels Full Duplex USART with Start Frame Detection Master/Slave SPI Serial Interface Slave I2C Serial Interface z Special Microcontroller Features z z z z z z z Low Power Idle, ADC Noise Reduction, and Power-down Modes Enhanced Power-on Reset Circuit Programmable Brown-out Detection Circuit with Supply Voltage Sampling External and Internal Interrupt Sources z Pin Change Interrupt on 28 Pins Calibrated 8MHz Oscillator with Temperature Calibration Option Calibrated 32kHz Ultra Low Power Oscillator High-Current Drive Capability on 8 I/O Pins z I/O and Packages z 32-lead TQFP, and 32-pad QFN/MLF: 28 Programmable I/O Lines z Speed Grade z 0 - 2 MHz @ 1.7 - 1.8V 0 - 4 MHz @ 1.8 - 5.5V z 0 - 10 MHz @ 2.7 - 5.5V z 0 - 20 MHz @ 4.5 - 5.5V z 8371A-AVR-08/12 z Low Power Consumption z Active Mode: 0.2 mA at 1.8V and 1MHz Idle Mode: 30 A at 1.8V and 1MHz z Power-Down Mode (WDT Enabled): 1 A at 1.8V z Power-Down Mode (WDT Disabled): 100 nA at 1.8V z Pin Configurations ATtiny828 Pinout in MLF32. 32 31 30 29 28 27 26 25 PC1 (PCINT17/ADC17/TOCC1/INT0/CLKO) PC0 (PCINT16/ADC16/TOCC0/SS/XCK) PD3 (PCINT27/ADC27/SCL/SCK) PD2 (PCINT26/ADC26/RESET/DW) PD1 (PCINT25/ADC25/MISO) PD0 (PCINT24/ADC24/SDA/MOSI) PB7 (PCINT15/ADC15) PB6 (PCINT14/ADC14) Figure 1. 1 2 3 4 5 6 7 8 24 23 22 21 20 19 18 17 PB5 (PCINT13/ADC13) PB4 (PCINT12/ADC12) PB3 (PCINT11/ADC11) GND PB2 (PCINT10/ADC10) PB1 (PCINT9/ADC9) AVCC PB0 (PCINT8/ADC8) 24 23 22 21 20 19 18 17 PB5 (PCINT13/ADC13) PB4 (PCINT12/ADC12) PB3 (PCINT11/ADC11) GND PB2 (PCINT10/ADC10) PB1 (PCINT9/ADC9) AVCC PB0 (PCINT8/ADC8) (PCINT0/ADC0) PA0 (PCINT1/ADC1/AIN0) PA1 (PCINT2/ADC2/AIN1) PA2 (PCINT3/ADC3) PA3 (PCINT4/ADC4) PA4 (PCINT5/ADC5) PA5 (PCINT6/ADC6) PA6 (PCINT7/ADC7) PA7 9 10 11 12 13 14 15 16 (PCINT18/ADC18/TOCC2/RXD/INT1) PC2 (PCINT19/ADC19/TOCC3/TXD) PC3 (PCINT20/ADC20/TOCC4) PC4 VCC GND (PCINT21/ADC21/TOCC5/ICP1/T0) PC5 (PCINT22/ADC22/CLKI/TOCC6) PC6 (PCINT23/ADC23/TOCC7/T1) PC7 NOTE: Bottom pad should be soldered to ground 32 31 30 29 28 27 26 25 PC1 (PCINT17/ADC17/TOCC1/INT0/CLKO) PC0 (PCINT16/ADC16/TOCC0/SS/XCK) PD3 (PCINT27/ADC27/SCL/SCK) PD2 (PCINT26/ADC26/RESET/DW) PD1 (PCINT25/ADC25/MISO) PD0 (PCINT24/ADC24/SDA/MOSI) PB7 (PCINT15/ADC15) PB6 (PCINT14/ADC14) ATtiny828 Pinout in TQFP32. (PCINT18/ADC18/TOCC2/RXD/INT1) PC2 (PCINT19/ADC19/TOCC3/TXD) PC3 (PCINT20/ADC20/TOCC4) PC4 VCC GND (PCINT21/ADC21/TOCC5/ICP1/T0) PC5 (PCINT22/ADC22/CLKI/TOCC6) PC6 (PCINT23/ADC23/TOCC7/T1) PC7 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 Figure 2. (PCINT0/ADC0) PA0 (PCINT1/ADC1/AIN0) PA1 (PCINT2/ADC2/AIN1) PA2 (PCINT3/ADC3) PA3 (PCINT4/ADC4) PA4 (PCINT5/ADC5) PA5 (PCINT6/ADC6) PA6 (PCINT7/ADC7) PA7 1. ATtiny828 [DATASHEET] 8371A-AVR-08/12 2 1.1 Pin Description 1.1.1 VCC Supply voltage. 1.1.2 AVCC AVCC is the supply voltage pin for the A/D converter and a selection of I/O pins. This pin should be externally connected to VCC even if the ADC is not used. If the ADC is used, it is recommended this pin is connected to VCC through a low-pass filter, as described in "Noise Canceling Techniques" on page 145. All pins of Port A and Port B are powered by AVCC. All other I/O pins take their supply voltage from VCC. 1.1.3 GND Ground. 1.1.4 RESET Reset input. A low level on this pin for longer than the minimum pulse length will generate a reset, even if the clock is not running and provided the reset pin has not been disabled. The minimum pulse length is given in Table 107 on page 250. Shorter pulses are not guaranteed to generate a reset. The reset pin can also be used as a (weak) I/O pin. 1.1.5 Port A (PA7:PA0) This is an 8-bit, bi-directional I/O port with internal pull-up resistors (selected for each bit). Output buffers have high sink and standard source capability. See Table 107 on page 250 for port drive strength. As inputs, port pins that are externally pulled low will source current provided that pull-up resistors are activated. Port pins are tri-stated when a reset condition becomes active, even if the clock is not running. This port has alternative pin functions for pin change interrupts, the analog comparator, and ADC. See "Alternative Port Functions" on page 63. 1.1.6 Port B (PB7:PB0) This is an 8-bit, bi-directional I/O port with internal pull-up resistors (selected for each bit). Output buffers have high sink and standard source capability. See Table 103 on page 247 for port drive strength. As inputs, port pins that are externally pulled low will source current provided that pull-up resistors are activated. Port pins are tri-stated when a reset condition becomes active, even if the clock is not running. This port has alternative pin functions for pin change interrupts, and ADC. See "Alternative Port Functions" on page 63. 1.1.7 Port C (PC7:PC0) This is an 8-bit, bi-directional I/O port with internal pull-up resistors (selected for each bit). Output buffers have high sink and standard source capability. Optionally, extra high sink capability can be enabled. See Table 103 on page 247 for port drive strength. As inputs, port pins that are externally pulled low will source current provided that pull-up resistors are activated. Port pins are tri-stated when a reset condition becomes active, even if the clock is not running. This port has alternative pin functions for pin change interrupts, ADC, timer/counter, external interrupts, and serial interfaces. See "Alternative Port Functions" on page 63. 1.1.8 Port D (PD3:PD0) This is a 4-bit, bi-directional I/O port with internal pull-up resistors (selected for each bit). Output buffers of PD0 and PD3 have symmetrical drive characteristics, with both sink and source capability. Output buffer PD1 has high sink and ATtiny828 [DATASHEET] 8371A-AVR-08/12 3 standard source capability, while PD2 only has weak drive characteristics due to its use as a reset pin. See Table 103 on page 247 for port drive strength. As inputs, port pins that are externally pulled low will source current provided that pull-up resistors are activated. Port pins are tri-stated when a reset condition becomes active, even if the clock is not running. This port has alternative pin functions for pin change interrupts, ADC, serial interfaces, and debugWire. See "Alternative Port Functions" on page 63. ATtiny828 [DATASHEET] 8371A-AVR-08/12 4 2. Overview ATtiny828 is a low-power CMOS 8-bit microcontrollers based on the AVR enhanced RISC architecture. By executing powerful instructions in a single clock cycle, the ATtiny828 achieves throughputs approaching 1 MIPS per MHz allowing the system designer to optimize power consumption versus processing speed. Figure 3. VCC Block Diagram RESET GND ON-CHIP DEBUGGER POWER SUPERVISION: POR BOD RESET EEPROM CALIBRATED ULP OSCILLATOR CALIBRATED OSCILLATOR WATCHDOG TIMER ISP INTERFACE DEBUG INTERFACE 8-BIT TIMER/COUNTER 16-BIT TIMER/COUNTER TWO-WIRE INTERFACE USART TIMING AND CONTROL PROGRAM MEMORY DATA MEMORY (FLASH) (SRAM) TEMPERATURE SENSOR CPU CORE ANALOG COMPARATOR MULTIPLEXER VOLTAGE REFERENCE ADC 8-BIT DATA BUS PORT A PORT B PORT C PORT D PA[7:0] PB[7:0] PC[7:0] PD[3:0] The AVR core combines a rich instruction set with 32 general purpose working registers. All 32 registers are directly connected to the Arithmetic Logic Unit (ALU), allowing two independent registers to be accessed in a single instruction, executed in one clock cycle. The resulting architecture is compact and code efficient while achieving throughputs up to ten times faster than conventional CISC microcontrollers. ATtiny828 [DATASHEET] 8371A-AVR-08/12 5 ATtiny828 provides the following features: z 8K bytes of in-system programmable Flash z 512 bytes of SRAM data memory z 256 bytes of EEPROM data memory z 28 general purpose I/O lines z 32 general purpose working registers z An 8-bit timer/counter with two PWM channels z A16-bit timer/counter with two PWM channels z Internal and external interrupts z A 10-bit ADC with 4 internal and 28 external chanels z An ultra-low power, programmable watchdog timer with internal oscillator z A programmable USART with start frame detection z A slave, I2C compliant Two-Wire Interface (TWI) z A master/slave Serial Peripheral Interface (SPI) z A calibrated 8MHz oscillator z A calibrated 32kHz, ultra low power oscillator z Three software selectable power saving modes. The device includes the following modes for saving power: z Idle mode: stops the CPU while allowing the timer/counter, ADC, analog comparator, SPI, TWI, and interrupt system to continue functioning z ADC Noise Reduction mode: minimizes switching noise during ADC conversions by stopping the CPU and all I/O modules except the ADC z Power-down mode: registers keep their contents and all chip functions are disabled until the next interrupt or hardware reset The device is manufactured using Atmel's high density non-volatile memory technology. The Flash program memory can be re-programmed in-system through a serial interface, by a conventional non-volatile memory programmer or by an onchip boot code, running on the AVR core. The boot program can use any interface to download the application program to the Flash memory. Software in the boot section of the Flash executes while the application section of the Flash is updated, providing true read-while-write operation. The ATtiny828 AVR is supported by a full suite of program and system development tools including: C compilers, macro assemblers, program debugger/simulators and evaluation kits. ATtiny828 [DATASHEET] 8371A-AVR-08/12 6 3. General Information 3.1 Resources A comprehensive set of drivers, application notes, data sheets and descriptions on development tools are available for download at http://www.atmel.com/avr. 3.2 Code Examples This documentation contains simple code examples that briefly show how to use various parts of the device. These code examples assume that the part specific header file is included before compilation. Be aware that not all C compiler vendors include bit definitions in the header files and interrupt handling in C is compiler dependent. Please confirm with the C compiler documentation for more details. 3.3 Data Retention Reliability Qualification results show that the projected data retention failure rate is much less than 1 PPM over 20 years at 85C or 100 years at 25C. ATtiny828 [DATASHEET] 8371A-AVR-08/12 7 4. CPU Core This section discusses the AVR core architecture in general. The main function of the CPU core is to ensure correct program execution. The CPU must therefore be able to access memories, perform calculations, control peripherals, and handle interrupts. Architectural Overview Figure 4. Block Diagram of the AVR Architecture 8-BIT DATA BUS INDIRECT ADDRESSING DATA MEMORY (SRAM) PROGRAM COUNTER PROGRAM MEMORY (FLASH) INSTRUCTION REGISTER INTERRUPT UNIT STATUS AND CONTROL GENERAL PURPOSE REGISTERS DIRECT ADDRESSING 4.1 X Y Z ALU INSTRUCTION DECODER CONTROL LINES In order to maximize performance and parallelism, the AVR uses a Harvard architecture - with separate memories and buses for program and data. Instructions in the Program memory are executed with a single level pipelining. While one instruction is being executed, the next instruction is pre-fetched from the Program memory. This concept enables instructions to be executed in every clock cycle. The Program memory is In-System Reprogrammable Flash memory. The fast-access Register File contains 32 x 8-bit general purpose working registers with a single clock cycle access time. This allows single-cycle Arithmetic Logic Unit (ALU) operation. In a typical ALU operation, two operands are output from the Register File, the operation is executed, and the result is stored back in the Register File - in one clock cycle. Six of the 32 registers can be used as three 16-bit indirect address register pointers for Data Space addressing - enabling efficient address calculations. One of the these address pointers can also be used as an address pointer for look up tables in Flash Program memory. These added function registers are the 16-bit X-, Y-, and Z-register, described later in this section. The ALU supports arithmetic and logic operations between registers or between a constant and a register. Single register operations can also be executed in the ALU. After an arithmetic operation, the Status Register is updated to reflect information about the result of the operation. ATtiny828 [DATASHEET] 8371A-AVR-08/12 8 Program flow is provided by conditional and unconditional jump and call instructions, capable of directly addressing the whole address space. Most AVR instructions have a single 16-bit word format but 32-bit wide instructions also exist. The actual instruction set varies, as some devices only implement a part of the instruction set. Program Flash memory is divided in two sections; the boot program section and the application program section. Both sections have dedicated lock bits for write and read/write protection. The SPM instruction, which is used to write the application memory section, must reside in the boot program section. During interrupts and subroutine calls, the return address Program Counter (PC) is stored on the Stack. The Stack is effectively allocated in the general data SRAM, and consequently the Stack size is only limited by the total SRAM size and the usage of the SRAM. All user programs must initialize the SP in the Reset routine (before subroutines or interrupts are executed). The Stack Pointer (SP) is read/write accessible in the I/O space. The data SRAM can easily be accessed through the five different addressing modes supported in the AVR architecture. The memory spaces in the AVR architecture are all linear and regular memory maps. A flexible interrupt module has its control registers in the I/O space with an additional Global Interrupt Enable bit in the Status Register. All interrupts have a separate Interrupt Vector in the Interrupt Vector table. The interrupts have priority in accordance with their Interrupt Vector position. The lower the Interrupt Vector address, the higher the priority. The I/O memory space contains 64 addresses for CPU peripheral functions as Control Registers, SPI, and other I/O functions. The I/O memory can be accessed directly, or as the Data Space locations following those of the Register File, 0x20 - 0x5F. In addition, the ATtiny828 has Extended I/O Space from 0x60 - 0xFF in SRAM where only the ST/STS/STD and LD/LDS/LDD instructions can be used. 4.2 ALU - Arithmetic Logic Unit The high-performance AVR ALU operates in direct connection with all the 32 general purpose working registers. Within a single clock cycle, arithmetic operations between general purpose registers or between a register and an immediate are executed. The ALU operations are divided into three main categories - arithmetic, logical, and bit-functions. Some implementations of the architecture also provide a powerful multiplier supporting both signed/unsigned multiplication and fractional format. See external document "AVR Instruction Set" and "Instruction Set Summary" on page 301 section for more information. 4.3 Status Register The Status Register contains information about the result of the most recently executed arithmetic instruction. This information can be used for altering program flow in order to perform conditional operations. Note that the Status Register is updated after all ALU operations. This will in many cases remove the need for using the dedicated compare instructions, resulting in faster and more compact code. See external document "AVR Instruction Set" and "Instruction Set Summary" on page 301 section for more information. The Status Register is neither automatically stored when entering an interrupt routine, nor restored when returning from an interrupt. This must be handled by software. 4.4 General Purpose Register File The Register File is optimized for the AVR Enhanced RISC instruction set. In order to achieve the required performance and flexibility, the following input/output schemes are supported by the Register File: z One 8-bit output operand and one 8-bit result input z Two 8-bit output operands and one 8-bit result input z Two 8-bit output operands and one 16-bit result input z One 16-bit output operand and one 16-bit result input Figure 5 below shows the structure of the 32 general purpose working registers in the CPU. ATtiny828 [DATASHEET] 8371A-AVR-08/12 9 Figure 5. General Purpose Working Registers 7 0 Addr. R0 0x00 R1 0x01 R2 0x02 R3 0x03 ... ... R12 0x0C R13 0x0D R14 0x0E R15 0x0F R16 0x10 R17 0x11 Special Function ... ... R26 0x1A X-register Low Byte R27 0x1B X-register High Byte R28 0x1C Y-register Low Byte R29 0x1D Y-register High Byte R30 0x1E Z-register Low Byte R31 0x1F Z-register High Byte Most of the instructions operating on the Register File are single cycle instructions with direct access to all registers. As shown in Figure 5, each register is also assigned a Data memory address, mapping them directly into the first 32 locations of the user Data Space. Although not being physically implemented as SRAM locations, this memory organization provides great flexibility in access of the registers, as the X-, Y- and Z-pointer registers can be set to index any register in the file. 4.4.1 The X-register, Y-register, and Z-register The registers R26..R31 have added functions to their general purpose usage. These registers are 16-bit address pointers for indirect addressing of the data space. The three indirect address registers X, Y, and Z are defined as described in Figure 6 below. Figure 6. The X-, Y-, and Z-registers 15 X-register 7 0 XH 0 7 R27 XL R26 15 Y-register 7 0 YH 0 7 R29 YL 7 0 R28 15 Z-register 0 0 ZH R31 0 7 ZL 0 R30 ATtiny828 [DATASHEET] 8371A-AVR-08/12 10 In the different addressing modes these address registers have functions as fixed displacement, automatic increment, and automatic decrement (see the instruction set reference for details). 4.5 Stack Pointer The stack is mainly used for storing temporary data, local variables and return addresses after interrupts and subroutine calls. The Stack Pointer registers (SPH and SPL) always point to the top of the stack. Note that the stack grows from higher memory locations to lower memory locations. This means that the PUSH instructions decreases and the POP instruction increases the stack pointer value. The stack pointer points to the area of data memory where subroutine and interrupt stacks are located. This stack space must be defined by the program before any subroutine calls are executed or interrupts are enabled. The pointer is decremented by one when data is put on the stack with the PUSH instruction, and incremented by one when data is fetched with the POP instruction. It is decremented by two when the return address is put on the stack by a subroutine call or a jump to an interrupt service routine, and incremented by two when data is fetched by a return from subroutine (the RET instruction) or a return from interrupt service routine (the RETI instruction). The AVR stack pointer is typically implemented as two 8-bit registers in the I/O register file. The width of the stack pointer and the number of bits implemented is device dependent. In some AVR devices all data memory can be addressed using SPL, only. In this case, the SPH register is not implemented. The stack pointer must be set to point above the I/O register areas, the minimum value being the lowest address of SRAM. See Table 3 on page 17. 4.6 Instruction Execution Timing This section describes the general access timing concepts for instruction execution. The AVR CPU is driven by the CPU clock clkCPU, directly generated from the selected clock source for the chip. No internal clock division is used. Figure 7 shows the parallel instruction fetches and instruction executions enabled by the Harvard architecture and the fast access Register File concept. This is the basic pipelining concept to obtain up to 1 MIPS per MHz with the corresponding unique results for functions per cost, functions per clocks, and functions per power-unit. Figure 7. The Parallel Instruction Fetches and Instruction Executions T1 T2 T3 T4 clkCPU 1st Instruction Fetch 1st Instruction Execute 2nd Instruction Fetch 2nd Instruction Execute 3rd Instruction Fetch 3rd Instruction Execute 4th Instruction Fetch Figure 8 shows the internal timing concept for the Register File. In a single clock cycle an ALU operation using two register operands is executed, and the result is stored back to the destination register. ATtiny828 [DATASHEET] 8371A-AVR-08/12 11 Figure 8. Single Cycle ALU Operation T1 T2 T3 T4 clkCPU Total Execution Time Register Operands Fetch ALU Operation Execute Result Write Back 4.7 Reset and Interrupt Handling The AVR provides several different interrupt sources. These interrupts and the separate Reset Vector each have a separate Program Vector in the Program memory space. All interrupts are assigned individual enable bits which must be written logic one together with the Global Interrupt Enable bit in the Status Register in order to enable the interrupt. Depending on the value of the program counter, interrupts may be automatically disabled when Boot Lock Bits (BLB02 or BLB12) are programmed. This feature improves software security. See section "Lock Bits" on page 225 for details. The lowest addresses in the Program memory space are by default defined as the Reset and Interrupt Vectors. The complete list of vectors is shown in "Interrupts" on page 48. The list also determines the priority levels of the different interrupts. The lower the address the higher is the priority level. RESET has the highest priority, and next is INT0 - the External Interrupt Request 0. The interrupt vector table can be moved to the start of Flash boot section by setting the IVSEL bit. For more information, see "MCUCR - MCU Control Register" on page 53 and "Interrupts" on page 48. The reset vector can also be moved to the start of Flash boot section by programming the BOOTRST fuse. See "Entering the Boot Loader Program" on page 216. When an interrupt occurs, the Global Interrupt Enable I-bit is cleared and all interrupts are disabled. The user software can write logic one to the I-bit to enable nested interrupts. All enabled interrupts can then interrupt the current interrupt routine. The I-bit is automatically set when a Return from Interrupt instruction - RETI - is executed. There are basically two types of interrupts. The first type is triggered by an event that sets the Interrupt Flag. For these interrupts, the Program Counter is vectored to the actual Interrupt Vector in order to execute the interrupt handling routine, and hardware clears the corresponding Interrupt Flag. Interrupt Flags can also be cleared by writing a logic one to the flag bit position(s) to be cleared. If an interrupt condition occurs while the corresponding interrupt enable bit is cleared, the Interrupt Flag will be set and remembered until the interrupt is enabled, or the flag is cleared by software. Similarly, if one or more interrupt conditions occur while the Global Interrupt Enable bit is cleared, the corresponding Interrupt Flag(s) will be set and remembered until the Global Interrupt Enable bit is set, and will then be executed by order of priority. The second type of interrupts will trigger as long as the interrupt condition is present. These interrupts do not necessarily have Interrupt Flags. If the interrupt condition disappears before the interrupt is enabled, the interrupt will not be triggered. When the AVR exits from an interrupt, it will always return to the main program and execute one more instruction before any pending interrupt is served. Note that the Status Register is not automatically stored when entering an interrupt routine, nor restored when returning from an interrupt routine. This must be handled by software. ATtiny828 [DATASHEET] 8371A-AVR-08/12 12 When using the CLI instruction to disable interrupts, the interrupts will be immediately disabled. No interrupt will be executed after the CLI instruction, even if it occurs simultaneously with the CLI instruction. The following example shows how this can be used to avoid interrupts during the timed EEPROM write sequence. Assembly Code Example in cli sbi sbi out r16, SREG ; store SREG value ; disable interrupts during timed sequence ; start EEPROM write EECR, EEMPE EECR, EEPE SREG, r16 ; restore SREG value (I-bit) C Code Example char cSREG; cSREG = SREG; _CLI(); EECR |= (1< t TOUT RESET TIME-OUT V RST t TOUT INTERNAL RESET 8.2.2 External Reset An External Reset is generated by a low level on the RESET pin if enabled. Reset pulses longer than the minimum pulse width (see section "System and Reset Characteristics" on page 250) will generate a reset, even if the clock is not running. Shorter pulses are not guaranteed to generate a reset. When the applied signal reaches the Reset Threshold Voltage - VRST - on its positive edge, the delay counter starts the MCU after the time-out period - tTOUT - has expired. ATtiny828 [DATASHEET] 8371A-AVR-08/12 40 Figure 16. External Reset During Operation CC 8.2.3 Watchdog Reset When the Watchdog times out, it will generate a short reset pulse. On the falling edge of this pulse, the delay timer starts counting the time-out period tTOUT. See page 41 for details on operation of the Watchdog Timer. Figure 17. Watchdog Reset During Operation CC CK 8.2.4 Brown-out Detection The Brown-Out Detection (BOD) circuit monitors that the VCC level is kept above a configurable trigger level, VBOT. When the BOD is enabled, a BOD reset will be given when VCC falls and remains below the trigger level for the length of the detection time, tBOD. The reset is kept active until VCC again rises above the trigger level. ATtiny828 [DATASHEET] 8371A-AVR-08/12 41 Figure 18. Brown-out Reset During Operation VCC VBOT+ VBOT- RESET tTOUT TIME-OUT INTERNAL RESET The BOD circuit will not detect a drop in VCC unless the voltage stays below the trigger level for the detection time, tBOD (see "System and Reset Characteristics" on page 250). The BOD circuit has three modes of operation: z Disabled: In this mode of operation VCC is not monitored and, hence, it is recommended only for applications where the power supply remains stable. z Enabled: In this mode the VCC level is continuously monitored. If VCC drops below VBOT for at least tBOD a brownout reset will be generated. z Sampled: In this mode the VCC level is sampled on each negative edge of a 1kHz clock that has been derived from the 32kHz ULP oscillator. Between each sample the BOD is turned off. Compared to the mode where BOD is constantly enabled this mode of operation reduces power consumption but fails to detect drops in VCC between two positive edges of the 1kHz clock. When a brown-out is detected in this mode, the BOD circuit is set to enabled mode to ensure that the device is kept in reset until VCC has risen above VBOT . The BOD will return to sampled mode after reset has been released and the fuses have been read in. The BOD mode of operation is selected using BODACT and BODPD fuse bits. The BODACT fuse bits determine how the BOD operates in active and idle mode, as shown in Table 11. Setting BOD Mode of Operation in Active and Idle Modes Table 11. BODACT1 BODACT0 Mode of Operation 0 0 Reserved 0 1 Sampled 1 0 Enabled 1 1 Disabled The BODPD fuse bits determine the mode of operation in all sleep modes except idle mode, as shown in Table 12. ATtiny828 [DATASHEET] 8371A-AVR-08/12 42 Setting BOD Mode of Operation in Sleep Modes Other Than Idle Table 12. BODPD1 BODPD0 Mode of Operation 0 0 Reserved 0 1 Sampled 1 0 Enabled 1 1 Disabled See "Fuse Bits" on page 226. 8.3 Internal Voltage Reference ATtiny828 features an internal bandgap reference. This reference is used for Brown-out Detection, and it can be used as an input to the Analog Comparator or the ADC. The bandgap voltage varies with supply voltage and temperature. 8.3.1 Voltage Reference Enable Signals and Start-up Time The voltage reference has a start-up time that may influence the way it should be used. The start-up time is given in "System and Reset Characteristics" on page 250. To save power, the reference is not always turned on. The reference is on during the following situations: z When the BOD is enabled. z When the internal reference is connected to the Analog Comparator. z When the ADC is enabled. Thus, when the BOD is not enabled, after setting the ACBG bit or enabling the ADC, the user must always allow the reference to start up before the output from the Analog Comparator or ADC is used. To reduce power consumption in Power-down mode, the user can avoid the three conditions above to ensure that the reference is turned off before entering Power-down mode. 8.4 Watchdog Timer The Watchdog Timer is clocked from the internal 32kHz ultra low power oscillator (see page 29). By controlling the Watchdog Timer prescaler, the Watchdog Reset interval can be adjusted as shown in Table 15 on page 47. The WDR - Watchdog Reset - instruction resets the Watchdog Timer. The Watchdog Timer is also reset when it is disabled and when a Chip Reset occurs. Ten different clock cycle periods can be selected to determine the reset period. If the reset period expires without another Watchdog Reset, the ATtiny828 resets and executes from the Reset Vector. The Wathdog Timer can also be configured to generate an interrupt instead of a reset. This can be very helpful when using the Watchdog to wake-up from Power-down. To prevent unintentional disabling of the Watchdog or unintentional change of time-out period, two different safety levels are selected by the fuse WDTON as shown in Table 13 See "Timed Sequences for Changing the Configuration of the Watchdog Timer" on page 44 for details. Table 13. WDT Configuration as a Function of the Fuse Settings of WDTON WDTON Safety Level WDT Initial State How to Disable the WDT How to Change Time-out Unprogrammed 1 Disabled Timed sequence No limitations Programmed 2 Enabled Always enabled Timed sequence ATtiny828 [DATASHEET] 8371A-AVR-08/12 43 Watchdog Timer WDP0 WDP1 WDP2 WDP3 OSC/256K OSC/64K OSC/128K OSC/32K OSC/8K OSC/2K OSC/1K OSC/512 WATCHDOG RESET OSC/16K WATCHDOG PRESCALER 32 kHz ULP OSCILLATOR OSC/4K Figure 19. MUX WDE MCU RESET 8.4.1 Timed Sequences for Changing the Configuration of the Watchdog Timer The sequence for changing configuration differs slightly between the two safety levels. Separate procedures are described for each level. z Safety Level 1 In this mode, the Watchdog Timer is initially disabled, but can be enabled by writing the WDE bit to one without any restriction. A timed sequence is needed when disabling an enabled Watchdog Timer. To disable an enabled Watchdog Timer, the following procedure must be followed: z 1. Write the signature for change enable of protected I/O registers to register CCP 2. Within four instruction cycles, in the same operation, write WDE and WDP bits Safety Level 2 In this mode, the Watchdog Timer is always enabled, and the WDE bit will always read as one. A timed sequence is needed when changing the Watchdog Time-out period. To change the Watchdog Time-out, the following procedure must be followed: 8.4.2 1. Write the signature for change enable of protected I/O registers to register CCP 2. Within four instruction cycles, write the WDP bit. The value written to WDE is irrelevant Code Examples The following code example shows how to turn off the WDT. The example assumes that interrupts are controlled (e.g., by disabling interrupts globally) so that no interrupts will occur during execution of these functions. ATtiny828 [DATASHEET] 8371A-AVR-08/12 44 Assembly Code Example WDT_off: wdr ; Clear WDRF in MCUSR in r16, MCUSR andi r16, ~(1< ... Note: ; Set address of next RESET INT0_ISR INT1_ISR PCINT0_ISR PCINT1_ISR PCINT2_ISR PCINT3_ISR WDT_ISR TIM1_CAPT_ISR TIM1_COMPA_ISR TIM1_COMPB_ISR TIM1_OVF_ISR TIM0_COMPA_ISR TIM0_COMPB_ISR TIM0_OVF_ISR SPI_ISR USART0_RXS_ISR USART0_RXC_ISR USART0_DRE_ISR USART0_TXC_ISR ADC_ISR EE_RDY_ISR ANA_COMP_ISR TWI_ISR SPM_RDY_ISR RESERVED ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; Address Address Address Address Address Address Address Address Address Address Address Address Address Address Address Address Address Address Address Address Address Address Address Address Address Address 0x0000 0x0001 0x0002 0x0003 0x0004 0x0005 0x0006 0x0007 0x0008 0x0009 0x000A 0x000B 0x000C 0x000D 0x000E 0x000F 0x0010 0x0011 0x0012 0x0013 0x0014 0x0015 0x0016 0x0017 0x0018 0x0019 ; Main program start ; Address 0x001A See "Code Examples" on page 7. Table 17 shows reset and interrupt vector placement for combinations of BOOTRST and IVSEL settings. ATtiny828 [DATASHEET] 8371A-AVR-08/12 49 Table 17. Reset and Interrupt Vector Placement BOOTRST (1) IVSEL 1 Note: Reset Address Start of Interrupt Vector Table 0 0x000 0x001 1 1 0x000 Boot reset address (2) + 0x001 0 0 Boot reset address (2) 0x001 0 1 Boot reset address (2) Boot reset address (2) + 0x001 1. For the BOOTRST fuse "1" means unprogrammed while "0" means programmed. 2. The boot reset address is shown in Table 82 on page 217. The following is a program example for the case where: z The BOOTRST fuse is unprogrammed z Boot section size set to 2K bytes z The IVSEL bit in MCUCR is set before any interrupts are enabled Assembly Code Example .org 0x0000 ; Set address of next statement RESET: ; Main program start ; Address 0x0000 ... .org 0x0C01 rjmp rjmp ... rjmp rjmp Note: INT0_ISR INT1_ISR ; Set address of next statement ; Address 0x0C01 ; Address 0x0C02 SPM_RDY_ISR ; Address 0x0C18 RESERVED ; Address 0x0C19 See "Code Examples" on page 7. The following is a program example for the case where: z The BOOTRST fuse is programmed z Boot section size set to 2K bytes ATtiny828 [DATASHEET] 8371A-AVR-08/12 50 Assembly Code Example .org 0x0001 rjmp rjmp ... rjmp rjmp ; Set address of next statement INT0_ISR INT1_ISR ; Address 0x0001 ; Address 0x0002 SPM_RDY_ISR RESERVED ; Address 0x0018 ; Address 0x0019 .org 0x0C00 ; Set address of next statement RESET: ; Main program start ; Address 0x0C00 ... Note: See "Code Examples" on page 7. The following is a program example for the case where: z The BOOTRST fuse is programmed z Boot section size set to 2K bytes z The IVSEL bit in MCUCR is set before any interrupts are enabled Assembly Code Example .org 0x0C00 rjmp rjmp rjmp ... rjmp rjmp ; Set address of next statement RESET INT0_ISR INT1_ISR ; Address 0x0C00 ; Address 0x0C01 ; Address 0x0C02 SPM_RDY_ISR RESERVED ; Address 0x0C18 ; Address 0x0C19 RESET: ... 9.2 ; Main program start ; Address 0x0C1A External Interrupts External Interrupts are triggered by the INT0 and INT1 pins, or by any of the PCINTn pins. Note that, if enabled, the interrupts will trigger even if the INTn or PCINTn pins are configured as outputs. This feature provides a way of generating software interrupts. ATtiny828 [DATASHEET] 8371A-AVR-08/12 51 The pin change interrupts trigger as follows: z Pin Change Interrupt 0 (PCI0): triggers if any enabled PCINT[7:0] pin toggles z Pin Change Interrupt 1 (PCI1): triggers if any enabled PCINT[15:8] pin toggles z Pin Change Interrupt 2 (PCI2): triggers if any enabled PCINT[23:16] pin toggles z Pin Change Interrupt 3(PCI3): triggers if any enabled PCINT[27:24] pin toggles Registers PCMSK0, PCMSK1, PCMSK2, and PCMSK3 control which pins contribute to the pin change interrupts. Pin change interrupts on PCINT[27:0] are detected asynchronously, which means that these interrupts can be used for waking the part also from sleep modes other than Idle mode. In order for a pin change interrupt (PCINT) to be generated, the device must have an active I/O clock. As shown in Table 9 on page 34, the I/O clock domain is active in Idle Mode, but not in deeper sleep modes. In sleep modes deeper than Idle Mode, a toggled pin must remain in its toggled state until the device has fully woken up. See Table 7 on page 30 for wake up times. If the pin toggles back to its initial state during wake up the device will still complete the procedure but will not generate an interrupt once awake. External interrupts INT0 and INT1 can be triggered by a falling or rising edge, or a low level. When INT0 or INT1 is enabled and configured as level triggered, the interrupt will trigger as long as the pin is held low. Note that recognition of falling or rising edge interrupts on INT0 and INT1 requires the presence of an I/O clock, as described in "Clock System" on page 27. 9.2.1 Low Level Interrupt A low level interrupt on INT0 or INT1 is detected asynchronously. This means that the interrupt source can be used for waking the part also from sleep modes other than Idle (the I/O clock is halted in all sleep modes except Idle). Note that if a level triggered interrupt is used for wake-up from Power-down, the required level must be held long enough for the MCU to complete the wake-up to trigger the level interrupt. If the level disappears before the end of the Start-up Time, the MCU will still wake up, but no interrupt will be generated. The start-up time is defined as described in "Clock System" on page 27. If the low level on the interrupt pin is removed before the device has woken up then program execution will not be diverted to the interrupt service routine but continue from the instruction following the SLEEP command. 9.2.2 Pin Change Interrupt Timing A timing example of a pin change interrupt is shown in Figure 20. ATtiny828 [DATASHEET] 8371A-AVR-08/12 52 Figure 20. Timing of pin change interrupts pin_lat PCINT(0) D pcint_in_(0) Q clk 0 pcint_syn pcint_setflag PCIF pin_sync LE x PCINT(0) in PCMSK(x) clk clk PCINT(0) pin_lat pin_sync pcint_in_(0) pcint_syn pcint_setflag PCIF 9.3 Register Description 9.3.1 MCUCR - MCU Control Register Bit 7 6 5 4 3 2 1 0x35 (0x55) - - - - - - IVSEL - Read/Write R R R R R R R/W R/W Initial Value 0 0 0 0 0 0 0 0 z 0 MCUCR Bits 7:2, 0 - Res: Reserved Bits These bits are reserved and will always read zero. z Bit 1 - IVSEL: Interrupt Vector Select When this bit is cleared, interrupt vectors are placed at the start of Flash memory. When this bit is set, interrupt vectors are moved to the beginning of the boot loader section. The start address of the boot section is determined by the BOOTSZ Fuses. See "Configuring the Boot Loader" on page 216 for details. If interrupt vectors are placed in the boot loader section and boot lock bit BLB02 is programmed, interrupts will be disabled while executing from the application section. If interrupt vectors are placed in the application section and boot lock bit BLB12 is programmed, interrupts will be disabled while executing from the boot loader section. ATtiny828 [DATASHEET] 8371A-AVR-08/12 53 To avoid unintentional changes to this bit, the following sequence must be followed: 9.3.2 1. Write the required signature to the CCP register. See page 14. 2. Within four instruction cycles, write the desired value to IVSEL. PCMSK3 - Pin Change Mask Register 3 Bit 7 6 5 4 3 2 1 0 (0x73) - - - - PCINT27 PCINT26 PCINT25 PCINT24 Read/Write R R R R R/W R/W R/W R/W Initial Value 0 0 0 0 0 0 0 0 z PCMSK3 Bits 7:4 - Res: Reserved Bits These bits are reserved and will always read zero. z Bits 3:0 - PCINT[27:24] : Pin Change Interrupt Mask Bits Each PCINTn bit selects if the pin change interrupt of the corresponding I/O pin is enabled. Pin change interrupt on a pin is enabled by setting the mask bit for the pin (PCINTn) and the corresponding group bit (PCIEn) in PCICR. When this bit is cleared the pin change interrupt on the corresponding pin is disabled. 9.3.3 PCMSK2 - Pin Change Mask Register 2 Bit 7 6 5 4 3 2 1 0 PCINT23 PCINT22 PCINT21 PCINT20 PCINT19 PCINT18 PCINT17 PCINT16 Read/Write R/W R/W R/W R/W R/W R/W R/W R/W Initial Value 0 0 0 0 0 0 0 0 (0x6D) z PCMSK2 Bits 7:0 - PCINT[23:16] : Pin Change Interrupt Mask Bits Each PCINTn bit selects if the pin change interrupt of the corresponding I/O pin is enabled. Pin change interrupt on a pin is enabled by setting the mask bit for the pin (PCINTn) and the corresponding group bit (PCIEn) in PCICR. When this bit is cleared the pin change interrupt on the corresponding pin is disabled. 9.3.4 PCMSK1 - Pin Change Mask Register 1 Bit 7 6 5 4 3 2 1 0 PCINT15 PCINT14 PCINT13 PCINT12 PCINT11 PCINT10 PCINT9 PCINT8 Read/Write R/W R/W R/W R/W R/W R/W R/W R/W Initial Value 0 0 0 0 0 0 0 0 (0x6C) z PCMSK1 Bits 7:0 - PCINT[15:8] : Pin Change Interrupt Mask Bits Each PCINTn bit selects if the pin change interrupt of the corresponding I/O pin is enabled. Pin change interrupt on a pin is enabled by setting the mask bit for the pin (PCINTn) and the corresponding group bit (PCIEn) in PCICR. When this bit is cleared the pin change interrupt on the corresponding pin is disabled. ATtiny828 [DATASHEET] 8371A-AVR-08/12 54 9.3.5 PCMSK0 - Pin Change Mask Register 0 Bit 7 6 5 4 3 2 1 0 PCINT7 PCINT6 PCINT5 PCINT4 PCINT3 PCINT2 PCINT1 PCINT0 Read/Write R/W R/W R/W R/W R/W R/W R/W R/W Initial Value 0 0 0 0 0 0 0 0 (0x6B) z PCMSK0 Bits 7:0 - PCINT[7:0] : Pin Change Interrupt Mask Bits Each PCINTn bit selects if the pin change interrupt of the corresponding I/O pin is enabled. Pin change interrupt on a pin is enabled by setting the mask bit for the pin (PCINTn) and the corresponding group bit (PCIEn) in PCICR. When this bit is cleared the pin change interrupt on the corresponding pin is disabled. 9.3.6 EICRA - External Interrupt Control Register A The External Interrupt Control Register contains bits for controlling external interrupt sensing and power management. Bit 7 6 5 4 3 2 1 0 (0x69) - - - - ISC11 ISC10 ISC01 ISC00 Read/Write R R R R R/W R/W R/W R/W Initial Value 0 0 0 0 0 0 0 0 z Bits 3:2 - ISC11, ISC10: Interrupt Sense Control, INT1 z Bits 1:0 - ISC01, ISC00: Interrupt Sense Control, INT0 EICRA External interrupts INT0 and INT1 are triggered by activity on pin INT0 and INT1, provided that the SREG I-flag and the corresponding interrupt mask are set. The conditions required to trigger the interrupt are defined in Table 18. Table 18. External Interrupt Sense Control ISCn1 ISCn0 0 0 The low level of INT0/INT1 generates an interrupt request (1) 0 1 Any logical change on INT0/INT1 generates an interrupt request (2) 1 0 The falling edge of INT0/INT1 generates an interrupt request (2) 1 1 The rising edge of INT0/INT1 generates an interrupt request (2) Note: Description 1. If low level interrupt is selected, the low level must be held until the completion of the currently executing instruction to generate an interrupt. 2. The value on the INT0/INT1 pin is sampled before detecting edges. If edge or toggle interrupt is selected, pulses that last longer than one clock period will generate an interrupt. Shorter pulses are not guaranteed to generate an interrupt. ATtiny828 [DATASHEET] 8371A-AVR-08/12 55 9.3.7 PCICR - Pin Change Interrupt Control Register Bit 7 6 5 4 3 2 1 0 (0x68) - - - - PCIE3 PCIE2 PCIE1 PCIE0 Read/Write R R R R R/W R/W R/W R/W Initial Value 0 0 0 0 0 0 0 0 z PCICR Bits 7:4 - Res: Reserved Bits These bits are reserved and will always read zero. z Bit 3 - PCIE3: Pin Change Interrupt Enable 3 When this bit and the I-bit of SREG are set the Pin Change Interrupt 3 is enabled. Any change on an enabled PCINT[27:24] pin will cause a PCINT3 interrupt. See Table 17 on page 50. Each pin can be individually enabled. See "PCMSK3 - Pin Change Mask Register 3" on page 54. z Bit 2 - PCIE2: Pin Change Interrupt Enable 2 When this bit and the I-bit of SREG are set the Pin Change Interrupt 2 is enabled. Any change on an enabled PCINT[23:16] pin will cause a PCINT2 interrupt. See Table 17 on page 50. Each pin can be individually enabled. See "PCMSK2 - Pin Change Mask Register 2" on page 54. z Bit 1 - PCIE1: Pin Change Interrupt Enable 1 When this bit and the I-bit of SREG are set the Pin Change Interrupt 1 is enabled. Any change on an enabled PCINT[15:8] pin will cause a PCINT1 interrupt. See Table 17 on page 50. Each pin can be individually enabled. See "PCMSK1 - Pin Change Mask Register 1" on page 54. z Bit 0 - PCIE0: Pin Change Interrupt Enable 0 When this bit and the I-bit of SREG are set the Pin Change Interrupt 0 is enabled. Any change on an enabled PCINT[7:0] pin will cause a PCINT0 interrupt. See Table 17 on page 50. Each pin can be individually enabled. See "PCMSK0 - Pin Change Mask Register 0" on page 55. 9.3.8 EIMSK - External Interrupt Mask Register Bit 7 6 5 4 3 2 1 0 0x1D (0x3D) - - - - - - INT1 INT0 Read/Write R R R R R R R/W R/W Initial Value 0 0 0 0 0 0 0 0 z EIMSK Bits 7:2 - Res: Reserved Bits These bits are reserved and will always read zero. z Bit 1 - INT1: External Interrupt Request 1 Enable The external interrupt for pin INT1 is enabled when this bit and the I-bit in the Status Register (SREG) are set. The trigger conditions are set with the ISC1n bits. Activity on the pin will cause an interrupt request even if INT0 has been configured as an output. ATtiny828 [DATASHEET] 8371A-AVR-08/12 56 z Bit 0 - INT0: External Interrupt Request 0 Enable The external interrupt for pin INT0 is enabled when this bit and the I-bit in the Status Register (SREG) are set. The trigger conditions are set with the ISC0n bits. Activity on the pin will cause an interrupt request even if INT1 has been configured as an output. 9.3.9 EIFR - External Interrupt Flag Register Bit 7 6 5 4 3 2 1 0 0x1C (0x3C) - - - - - - INTF1 INTF0 Read/Write R R R R R R R/W R/W Initial Value 0 0 0 0 0 0 0 0 z EIFR Bits 7:2 - Res: Reserved Bits These bits are reserved and will always read zero. z Bit 1 - INTF1: External Interrupt Flag 0 This bit is set when activity on INT1 has triggered an interrupt request. Provided that the I-bit in SREG and the INT1 bit in EIMSK are set, the MCU will jump to the corresponding interrupt vector. The flag is cleared when the interrupt service routine is executed. Alternatively, the flag can be cleared by writing a logical one to it. This flag is always cleared when INT1 is configured as a level interrupt. z Bit 0 - INTF0: External Interrupt Flag 0 This bit is set when activity on INT0 has triggered an interrupt request. Provided that the I-bit in SREG and the INT0 bit in EIMSK are set, the MCU will jump to the corresponding interrupt vector. The flag is cleared when the interrupt service routine is executed. Alternatively, the flag can be cleared by writing a logical one to it. This flag is always cleared when INT0 is configured as a level interrupt. 9.3.10 PCIFR - Pin Change Interrupt Flag Register Bit 7 6 5 4 3 2 1 0 0x1B (0x3B) - - - - PCIF3 PCIF2 PCIF1 PCIF0 Read/Write R R R R R/W R/W R/W R/W Initial Value 0 0 0 0 0 0 0 0 z PCIFR Bits 7:4 - Res: Reserved Bits These bits are reserved and will always read zero. z Bit 3 - PCIF3: Pin Change Interrupt Flag 3 This bit is set when a logic change on any PCINT[27:24] pin has triggered an interrupt request. Provided that the I-bit in SREG and the PCIE3 bit in PCICR are set, the MCU will jump to the corresponding interrupt vector. The flag is cleared when the interrupt routine is executed. Alternatively, the flag can be cleared by writing a logical one to it. ATtiny828 [DATASHEET] 8371A-AVR-08/12 57 z Bit 2 - PCIF2: Pin Change Interrupt Flag 2 This bit is set when a logic change on any PCINT[23:16] pin has triggered an interrupt request. Provided that the I-bit in SREG and the PCIE2 bit in PCICR are set, the MCU will jump to the corresponding interrupt vector. The flag is cleared when the interrupt routine is executed. Alternatively, the flag can be cleared by writing a logical one to it. z Bit 1 - PCIF1: Pin Change Interrupt Flag 1 This bit is set when a logic change on any PCINT[15:8] pin has triggered an interrupt request. Provided that the I-bit in SREG and the PCIE1 bit in PCICR are set, the MCU will jump to the corresponding interrupt vector. The flag is cleared when the interrupt routine is executed. Alternatively, the flag can be cleared by writing a logical one to it. z Bit 0 - PCIF0: Pin Change Interrupt Flag 0 This bit is set when a logic change on any PCINT[7:0] pin has triggered an interrupt request. Provided that the I-bit in SREG and the PCIE0 bit in PCICR are set, the MCU will jump to the corresponding interrupt vector. The flag is cleared when the interrupt routine is executed. Alternatively, the flag can be cleared by writing a logical one to it. ATtiny828 [DATASHEET] 8371A-AVR-08/12 58 10. I/O Ports 10.1 Overview All AVR ports have true Read-Modify-Write functionality when used as general digital I/O ports. This means that the direction of one port pin can be changed without unintentionally changing the direction of any other pin with the SBI and CBI instructions. The same applies when changing drive value (if configured as output) or enabling/disabling of pull-up resistors. The pin driver is strong enough to drive LED displays directly. All port pins have individually selectable pull-up resistors with a supply-voltage invariant resistance. All I/O pins have protection diodes to both VCC and Ground as indicated in Figure 21 on page 59. See "Electrical Characteristics" on page 247 for a complete list of parameters. Figure 21. I/O Pin Equivalent Schematic Rpu Logic Pxn Cpin See Figure "General Digital I/O" for Details All registers and bit references in this section are written in general form. A lower case "x" represents the numbering letter for the port, and a lower case "n" represents the bit number. However, when using the register or bit defines in a program, the precise form must be used. For example, PORTB3 for bit no. 3 in Port B, here documented generally as PORTxn. The physical I/O Registers and bit locations are listed in "Register Description" on page 81. Four I/O memory address locations are allocated for each port, one each for the Data Register - PORTx, Data Direction Register - DDRx, Pull-up Enable Register - PUEx, and the Port Input Pins - PINx. The Port Input Pins I/O location is read only, while the Data Register, the Data Direction Register, and the Pull-up Enable Register are read/write. However, writing a logic one to a bit in the PINx Register, will result in a toggle in the corresponding bit in the Data Register. Using the I/O port as General Digital I/O is described in "Ports as General Digital I/O" on page 59. Most port pins are multiplexed with alternative functions for the peripheral features on the device. How each alternative function interferes with the port pin is described in "Alternative Port Functions" on page 63. Refer to the individual module sections for a full description of the alternative functions. Note that enabling the alternative function of some of the port pins does not affect the use of the other pins in the port as general digital I/O. 10.2 Ports as General Digital I/O The ports are bi-directional I/O ports with optional internal pull-ups. Figure 22 shows a functional description of one I/Oport pin, here generically called Pxn. ATtiny828 [DATASHEET] 8371A-AVR-08/12 59 Figure 22. General Digital I/O(1) REx Q D PUExn Q CLR RESET Q WEx D DDxn Q CLR WDx RESET DATA BUS RDx 1 Q Pxn D 0 PORTxn Q CLR RESET WRx WPx RRx SLEEP SYNCHRONIZER D Q L Q D RPx Q PINxn Q clk I/O SLEEP: clk I/O : Note: SLEEP CONTROL I/O CLOCK WEx: REx: WDx: RDx: WRx: RRx: RPx: WPx: WRITE PUEx READ PUEx WRITE DDRx READ DDRx WRITE PORTx READ PORTx REGISTER READ PORTx PIN WRITE PINx REGISTER 1. WEx, WRx, WPx, WDx, REx, RRx, RPx, and RDx are common to all pins within the same port. clkI/O, and SLEEP are common to all ports. 10.2.1 Configuring the Pin Each port pin consists of four register bits: DDxn, PORTxn, PUExn, and PINxn. As shown in "Register Description" on page 81, the DDxn bits are accessed at the DDRx I/O address, the PORTxn bits at the PORTx I/O address, the PUExn bits at the PUEx I/O address, and the PINxn bits at the PINx I/O address. The DDxn bit in the DDRx Register selects the direction of this pin. If DDxn is written logic one, Pxn is configured as an output pin. If DDxn is written logic zero, Pxn is configured as an input pin. If PORTxn is written logic one when the pin is configured as an output pin, the port pin is driven high (one). If PORTxn is written logic zero when the pin is configured as an output pin, the port pin is driven low (zero). ATtiny828 [DATASHEET] 8371A-AVR-08/12 60 The pull-up resistor is activated, if the PUExn is written logic one. To switch the pull-up resistor off, PUExn has to be written logic zero. Table 19 summarizes the control signals for the pin value. Table 19. Port Pin Configurations DDxn PORTxn PUExn I/O Pull-up Comment 0 X 0 Input No Tri-state (hi-Z) 0 X 1 Input Yes Sources current if pulled low externally 1 0 0 Output No Output low (sink) 1 0 1 Output Yes NOT RECOMMENDED. Output low (sink) and internal pull-up active. Sources current through the internal pull-up resistor and consumes power constantly 1 1 0 Output No Output high (source) 1 1 1 Output Yes Output high (source) and internal pull-up active Port pins are tri-stated when a reset condition becomes active, even when no clocks are running. 10.2.2 Toggling the Pin Writing a logic one to PINxn toggles the value of PORTxn, independent on the value of DDRxn. Note that the SBI instruction can be used to toggle one single bit in a port. 10.2.3 Reading the Pin Value Independent of the setting of Data Direction bit DDxn, the port pin can be read through the PINxn Register bit. As shown in Figure 22 on page 60, the PINxn Register bit and the preceding latch constitute a synchronizer. This is needed to avoid metastability if the physical pin changes value near the edge of the internal clock, but it also introduces a delay. Figure 23 shows a timing diagram of the synchronization when reading an externally applied pin value. The maximum and minimum propagation delays are denoted tpd,max and tpd,min respectively. Figure 23. Synchronization when Reading an Externally Applied Pin value SYSTEM CLK INSTRUCTIONS XXX XXX in r17, PINx SYNC LATCH PINxn r17 0x00 0xFF t pd, max t pd, min ATtiny828 [DATASHEET] 8371A-AVR-08/12 61 Consider the clock period starting shortly after the first falling edge of the system clock. The latch is closed when the clock is low, and goes transparent when the clock is high, as indicated by the shaded region of the "SYNC LATCH" signal. The signal value is latched when the system clock goes low. It is clocked into the PINxn Register at the succeeding positive clock edge. As indicated by the two arrows tpd,max and tpd,min, a single signal transition on the pin will be delayed between 1/2 and 11/2 system clock period depending upon the time of assertion. When reading back a software assigned pin value, a nop instruction must be inserted as indicated in Figure 24 on page 62. The out instruction sets the "SYNC LATCH" signal at the positive edge of the clock. In this case, the delay tpd through the synchronizer is one system clock period. Figure 24. Synchronization when Reading a Software Assigned Pin Value SYSTEM CLK r16 INSTRUCTIONS 0xFF out PORTx, r16 nop in r17, PINx SYNC LATCH PINxn r17 0x00 0xFF t pd 10.2.4 Digital Input Enable and Sleep Modes As shown in Figure 22 on page 60, the digital input signal can be clamped to ground at the input of the schmitt-trigger. The signal denoted SLEEP in the figure, is set by the MCU sleep controller in Power-down and Standby modes to avoid high power consumption if some input signals are left floating, or have an analog signal level close to VCC/2. SLEEP is overridden for port pins enabled as external interrupt pins. If the external interrupt request is not enabled, SLEEP is active also for these pins. SLEEP is also overridden by various other alternative functions as described in "Alternative Port Functions" on page 63. If a logic high level ("one") is present on an asynchronous external interrupt pin configured as "Interrupt on Rising Edge, Falling Edge, or Any Logic Change on Pin" while the external interrupt is not enabled, the corresponding External Interrupt Flag will be set when resuming from the above mentioned Sleep mode, as the clamping in these sleep mode produces the requested logic change. 10.2.5 Unconnected Pins If some pins are unused, it is recommended to ensure that these pins have a defined level. Even though most of the digital inputs are disabled in the deep sleep modes as described above, floating inputs should be avoided to reduce current consumption in all other modes where the digital inputs are enabled (Reset, Active mode and Idle mode). The simplest method to ensure a defined level of an unused pin, is to enable the internal pull-up. In this case, the pull-up will be disabled during reset. If low power consumption during reset is important, it is recommended to use an external pull-up or pulldown. Connecting unused pins directly to VCC or GND is not recommended, since this may cause excessive currents if the pin is accidentally configured as an output. ATtiny828 [DATASHEET] 8371A-AVR-08/12 62 10.2.6 Program Example The following code example shows how to set port B pin 0 high, pin 1 low, and define the port pins from 2 to 3 as input with a pull-up assigned to port pin 2. The resulting pin values are read back again, but as previously discussed, a nop instruction is included to be able to read back the value recently assigned to some of the pins. Assembly Code Example ; Define pull-ups and set outputs high ; Define directions for port pins ldi r16,(1<>8); UBRRL = (unsigned char)baud; /* Enable receiver and transmitter */ UCSRB = (1<> 1) & 0x01; return ((resh << 8) | resl); } Note: 1. See "Code Examples" on page 7. The receive function example reads all the I/O registers into the register file before any computation is done. This gives an optimal receive buffer utilization since the buffer location read will be free to accept new data as early as possible. 17.7.3 Receive Complete Flag and Interrupt The USART receiver has one flag that indicates the receiver state. The Receive Complete flag (RXC) indicates if there are unread data present in the receive buffer. This flag is set when unread data exist in the receive buffer, and cleared when the receive buffer is empty (i.e., it does not contain any unread data). If the receiver is disabled (RXEN = 0), the receive buffer will be flushed and, consequently, the RXC bit will become zero. When the Receive Complete Interrupt Enable (RXCIE) is set, the USART Receive Complete interrupt will be executed as long as the RXC flag is set (and provided that global interrupts are enabled). When interrupt-driven data reception is used, the receive complete routine must read the received data from UDR in order to clear the RXC flag, otherwise a new interrupt will occur once the interrupt routine terminates. 17.7.4 Receiver Error Flags The USART receiver has three error flags: Frame Error (FE), Data OverRun Error (DOR) and Parity Error (UPE). All error flags are located in the receive buffer together with the frame for which they indicate the error status, and they can be accessed via UCSRA. Due to the buffering of error flags, they must be read before the receive buffer (UDR), since reading UDR changes the buffer. Error flags can not be changed by software, however, for upward compatibility of future USART implementations all flags must be cleared when UCSRA is written . None of the error flags can generate an interrupt. z The Frame Error flag (FE) indicates the state of the first stop bit of the next readable frame stored in the receive buffer. The flag is zero when the stop bit was correctly read (as one), and the flag is one when the stop bit was incorrect (zero). This flag can be used for detecting out-of-sync conditions,for detecting break conditions and for ATtiny828 [DATASHEET] 8371A-AVR-08/12 175 protocol handling. The flag is not affected by the USBS bit, since the receiver ignores all stop bits, except the first. For compatibility with future devices, this bit must always be cleared when writing UCSRA. z The Data OverRun flag (DOR) indicates data loss due to a receiver buffer full condition. A data overrun situation occurs when the receive buffer is full (two characters), there is a new character waiting in the receive shift register, and a new start bit is detected. If the flag is set there was one or more serial frames lost between the frame last and the next frame read from UDR. For compatibility with future devices, this bit must always be cleared when writing to UCSRA. The flag is cleared when the frame received was successfully moved from the shift register to the receive buffer. z The Parity Error flag (UPE) indicates that the next frame in the receive buffer had a parity error. If parity check is not enabled the flag will always be zero. For compatibility with future devices, this bit must always be cleared when writing UCSRA. For more details, see "Parity Bit Calculation" on page 168 and "Parity Checker" on page 176. 17.7.5 Parity Checker The parity checker is active when the high USART Parity Mode bit (UPM1) is set. The type of parity check to be performed (odd or even) is selected by the UPM0 bit. When enabled, the parity checker calculates the parity of the data bits in incoming frames and compares the result with the parity bit from the serial frame. The result of the check is stored in the receive buffer together with the received data and stop bits. The Parity Error flag (UPE) can then be read by software to check if the frame had a parity error. If parity checking is enabled (UPM = 1), the UPE bit is set if the next character that can be read from the receive buffer had a parity error when received. This bit is valid until the receive buffer (UDR) is read. 17.7.6 Disabling the Receiver Unlike the transmitter, the receiver is disabled immediately and any data from ongoing receptions will be lost. When disabled (RXEN = 0), the receiver will no longer override the normal function of the RxD port pin and the FIFO buffer is flushed, with any remaining data in the buffer lost. 17.7.7 Flushing the Receive Buffer The receiver buffer FIFO will be flushed when the receiver is disabled, i.e., the buffer will be emptied of its contents. Unread data will be lost. To flush the buffer during normal operation, due to for instance an error condition, read the UDR until the RXC flag is cleared. The following code example shows how to flush the receive buffer. Assembly Code Example(1) USART_Flush: sbis ret in rjmp UCSRA, RXC r16, UDR USART_Flush C Code Example(1) void USART_Flush( void ) { unsigned char dummy; while ( UCSRA & (1< 2 CPU clock cycles z When fck >= 12MHz: 3 CPU clock cycles Minimum high period of serial clock: z When fck < 12MHz: > 2 CPU clock cycles z When fck >= 12MHz: 3 CPU clock cycles 23.3.1 Pin Mapping The pin mapping is listed in Table 100 on page 243. Note that not all parts use the SPI pins dedicated for the internal SPI interface. ATtiny828 [DATASHEET] 8371A-AVR-08/12 242 Table 100. Pin Mapping Serial Programming Symbol Pins I/O Description MOSI PD0 I Serial Data in MISO PD1 O Serial Data out SCK PD3 I Serial Clock 23.3.2 Programming Algorithm When writing serial data to the ATtiny828, data is clocked on the rising edge of SCK. When reading data from the ATtiny828, data is clocked on the falling edge of SCK. See Figure 107 on page 257 and Figure 108 on page 257 for timing details. To program and verify the ATtiny828 in the serial programming mode, the following sequence is recommended (See Table 101 on page 244): 1. Power-up sequence: apply power between VCC and GND while RESET and SCK are set to "0" z In some systems, the programmer can not guarantee that SCK is held low during power-up. In this case, RESET must be given a positive pulse after SCK has been set to '0'. The duration of the pulse must be at least tRST plus two CPU clock cycles. See Table 107 on page 250 for definition of minimum pulse width on RESET pin, tRST 2. Wait for at least 20 ms and then enable serial programming by sending the Programming Enable serial instruction to the MOSI pin 3. The serial programming instructions will not work if the communication is out of synchronization. When in sync, the second byte (0x53) will echo back when issuing the third byte of the Programming Enable instruction 4. 5. z Regardless if the echo is correct or not, all four bytes of the instruction must be transmitted z If the 0x53 did not echo back, give RESET a positive pulse and issue a new Programming Enable command The Flash is programmed one page at a time. The memory page is loaded one byte at a time by supplying the 6 LSB of the address and data together with the Load Program Memory Page instruction z To ensure correct loading of the page, data low byte must be loaded before data high byte for a given address is applied z The Program Memory Page is stored by loading the Write Program Memory Page instruction with the 7 MSB of the address z If polling (RDY/BSY) is not used, the user must wait at least tWD_FLASH before issuing the next page (See Table 102 on page 246). Accessing the serial programming interface before the Flash write operation completes can result in incorrect programming. The EEPROM can be programmed one byte or one page at a time. z A: Byte programming. The EEPROM array is programmed one byte at a time by supplying the address and data together with the Write instruction. EEPROM memory locations are automatically erased before new data is written. If polling (RDY/BSY) is not used, the user must wait at least tWD_EEPROM before issuing the next byte (See Table 102 on page 246). In a chip erased device, no 0xFFs in the data file(s) need to be programmed z B: Page programming (the EEPROM array is programmed one page at a time). The memory page is loaded one byte at a time by supplying the 6 LSB of the address and data together with the Load EEPROM Memory Page instruction. The EEPROM memory page is stored by loading the Write EEPROM Memory Page Instruction with the 7 MSB of the address. When using EEPROM page access only byte locations loaded with the Load EEPROM Memory Page instruction are altered and the remaining locations remain unchanged. If polling (RDY/BSY) is not used, the user must wait at least tWD_EEPROM before issuing the next byte (See Table 102 on page 246). In a chip erased device, no 0xFF in the data file(s) need to be programmed ATtiny828 [DATASHEET] 8371A-AVR-08/12 243 6. Any memory location can be verified by using the Read instruction, which returns the content at the selected address at the serial output pin (MISO) 7. At the end of the programming session, RESET can be set high to commence normal operation 8. Power-off sequence (if required): set RESET to "1", and turn VCC power off 23.3.3 Programming Instruction set The instruction set for serial programming is described in Table 101 and Figure 100 on page 245. Table 101. Serial Programming Instruction Set Instruction Format Instruction/Operation Byte 1 Byte 2 Byte 3 Byte4 Programming Enable $AC $53 $00 $00 Chip Erase (Program Memory/EEPROM) $AC $80 $00 $00 Poll RDY/BSY $F0 $00 $00 data byte out Load Extended Address byte (1) $4D $00 Extended adr $00 Load Program Memory Page, High byte $48 $00 adr LSB high data byte in Load Program Memory Page, Low byte $40 $00 adr LSB low data byte in Load EEPROM Memory Page (page access) $C1 $00 0000 000aa (2) data byte in Read Program Memory, High byte $28 adr MSB adr LSB high data byte out Read Program Memory, Low byte $20 adr MSB adr LSB low data byte out Read EEPROM Memory $A0 0000 00aa (2) aaaa aaaa (2) data byte out Read Lock bits $58 $00 $00 data byte out Read Signature Byte $30 $00 0000 000aa (2) data byte out Read Fuse bits $50 $00 $00 data byte out Read Fuse High bits $58 $08 $00 data byte out Read Fuse Extended Bits $50 $08 $00 data byte out Read Calibration Byte $38 $00 $00 data byte out $4C adr MSB (4) adr LSB (4) Load Instructions Read Instructions Write Instructions (3) Write Program Memory Page (2) aaaa aaaa (2) $00 Write EEPROM Memory $C0 0000 00aa data byte in Write EEPROM Memory Page (page access) $C2 0000 00aa (2) aaaa aa00 (2) $00 Write Lock bits (5) $AC $E0 $00 data byte in ATtiny828 [DATASHEET] 8371A-AVR-08/12 244 Instruction Format Instruction/Operation Byte 1 Byte 2 Byte 3 Byte4 Write Fuse bits (5) $AC $A0 $00 data byte in Write Fuse High bits (5) $AC $A8 $00 data byte in Write Fuse Extended Bits (5) $AC $A4 $00 data byte in Notes: 1. Not all instructions are applicable for all parts. 2. a = address. 3. Instructions accessing program memory use a word address. This address may be random within the page range. 4. Word addressing. 5. To ensure future compatibility, unused fuses and lock bits should be unprogrammed (`1') . If the LSB of RDY/BSY data byte out is `1', a programming operation is still pending. Wait until this bit returns `0' before the next instruction is carried out. Within the same page, the low data byte must be loaded prior to the high data byte. After data is loaded to the page buffer, program the EEPROM page, see Figure 100 on page 245. Figure 100. Serial Programming Instruction example Serial Programming Instruction Load Program Memory Page (High/Low Byte)/ Load EEPROM Memory Page (page access) Byte 1 Byte 2 Adr A drr M MS MSB SB Bit 15 B Byte 3 Write Program Memory Page/ Write EEPROM Memory Page Byte 1 Byte 4 Byte 2 Adr LSB Byte 3 Adr MSB Bit 15 B 0 Byte 4 Adr A dr LSB LS SB 0 Page Buffer Page Offset Page 0 Page 1 Page 2 Page Number Page N-1 Program Memory/ EEPROM Memory 23.4 Programming Time for Flash and EEPROM Flash and EEPROM wait times are listed in Table 102 on page 246. ATtiny828 [DATASHEET] 8371A-AVR-08/12 245 Table 102. Typical Wait Delays Before Next Flash or EEPROM Location Can Be Written Symbol Minimum Wait Delay tWD_FLASH 4.5 ms tWD_EEPROM 3.6 ms tWD_ERASE 9.0 ms ATtiny828 [DATASHEET] 8371A-AVR-08/12 246 24. Electrical Characteristics 24.1 Absolute Maximum Ratings* Operating Temperature . . . . . . . . . . . -55C to +125C *NOTICE: Storage Temperature . . . . . . . . . . . . . -65C to +150C Voltage on any Pin except RESET with respect to Ground. . . . . . . . . . -0.5V to VCC+0.5V Stresses beyond those listed under "Absolute Maximum Ratings" may cause permanent damage to the device. This is a stress rating only and functional operation of the device at these or other conditions beyond those indicated in the operational sections of this specification is not implied. Exposure to absolute maximum rating conditions for extended periods may affect device reliability. Voltage on RESET with respect to Ground-0.5V to +13.0V Maximum Operating Voltage . . . . . . . . . . . . . . . . 6.0V DC Current per I/O Pin. . . . . . . . . . . . . . . . . . 40.0 mA DC Current VCC and GND Pins . . . . . . . . . . 200.0 mA 24.2 DC Characteristics Table 103. DC Characteristics. T = -40C to +85C Symbol Parameter Condition Min VIL Input Low Voltage VCC = 1.7V - 2.4V VCC = 2.4V - 5.5V Input High-voltage Except RESET pin Input High-voltage RESET pin VIH Output Low Voltage (4) RESET pin as I/O (6) Max Units -0.5 0.2VCC(3) 0.3VCC(3) V VCC = 1.7V - 2.4V VCC = 2.4V - 5.5V 0.7VCC(2) 0.6VCC(2) VCC +0.5 V VCC = 1.7V to 5.5V 0.9VCC(2) VCC +0.5 V VCC = 5V, IOL = 2 mA (5) 0.6 VCC = 3V, IOL = 1 mA(5) 0.5 VCC = 1.8V, IOL = 0.4mA(5) 0.4 VCC = 5V, IOL = 10 mA (4) Output Low Voltage Standard Sink I/O Pin (7) VOL Output Low Voltage (4) High Sink I/O Pin (8) (4) Output Low Voltage Extra High Sink I/O Pin (9) Typ (1) (5) 0.6 VCC = 3V, IOL = 5 mA (5) 0.5 VCC = 1.8V, IOL = 2mA (5) 0.4 VCC = 5V, IOL = 20 mA (5) 0.6 VCC = 3V, IOL = 10 mA(5) 0.5 VCC = 1.8V, IOL = 4mA (5) 0.4 VCC = 5V, IOL = 20 mA (5) 0.6 VCC = 3V, IOL = 20 mA (5) 0.6 (5) VCC = 1.8V, IOL = 8mA V 0.5 ATtiny828 [DATASHEET] 8371A-AVR-08/12 247 Symbol Parameter Condition VCC = 5V, IOH = -10 mA (4) VOH Output High-voltage Except RESET pin(6) Min (5) Typ (1) Max Units 4.3 VCC = 3V, IOH = -5 mA (5) 2.5 VCC = 1.8V, IOH = -2 mA (5) 1.4 V ILIL Input Leakage Current, I/O Pin (absolute value) VCC = 5.5V, pin low <0.05 1 A ILIH Input Leakage Current, I/O Pin (absolute value) VCC = 5.5V, pin high <0.05 1 A ILIAC Input Leakage Current, Analog Comparator VCC = 5V VIN = VCC/2 -50 50 nA RRST Reset Pull-up Resistor VCC = 5.5V, input low 30 60 k RPU I/O Pin Pull-up Resistor VCC = 5.5V, input low 20 50 k Power Supply Current(10) ICC Power-down mode(11) Active 1 MHz, VCC = 2V 0.2 0.4 mA Active 4 MHz, VCC = 3V 1.2 2 mA Active 8 MHz, VCC = 5V 3.9 5 mA Idle 1 MHz, VCC = 2V 0.03 0.1 mA Idle 4 MHz, VCC = 3V 0.2 0.4 mA Idle 8 MHz, VCC = 5V 0.9 1.5 mA WDT enabled, VCC = 3V 1.8 4 A WDT disabled, VCC = 3V 0.1 2 A Notes: 1. Typical values at 25C. 2. "Min" means the lowest value where the pin is guaranteed to be read as high. 3. "Max" means the highest value where the pin is guaranteed to be read as low. 4. Under steady-state (non-transient) conditions I/O ports can sink/source more current than the test conditions, however, the sum current of PORTA and PORTB mustn't exceed 100mA. Also, the sum current of PORTC and PORTD mustn't exceed 120mA. VOL/VOH is not guaranteed to meet specifications if pin or port currents exceed the limits given. 5. Pins are not guaranteed to sink/source currents greater than those listed at the given supply voltage. 6. The RESET pin must tolerate high voltages when entering and operating in programming modes and, as a consequence, has a weak drive strength as compared to regular I/O pins. See "Reset Pin as I/O" on page 279, and "Reset Pin as I/O" on page 285. 7. Ports with standard sink strength: PORTD0, PORTD3. 8. Ports with high sink strength: PORTA[7:0], PORTB[7:0], PORTC[7:0], PORTD1. 9. Ports with extra high strength: PORTC[7:0]. See "PHDE - Port High Drive Enable Register" on page 81. 10. Results obtained using external clock and methods described in "Minimizing Power Consumption" on page 35. Power reduction fully enabled (PRR = 0xFF) and with no I/O drive. 11. BOD Disabled. ATtiny828 [DATASHEET] 8371A-AVR-08/12 248 24.3 Speed The maximum operating frequency of the device is dependent on supply voltage, VCC . The relationship between supply voltage and maximum operating frequency is piecewise linear, as shown in Figure 101. Figure 101. Maximum Operating Frequency vs. Supply Voltage 20 MHz 10 MHz 4 MHz 2 MHz 1.7V 1.8V 24.4 2.7V 5.5V 4.5V Clock Characteristics 24.4.1 Accuracy of Calibrated Internal Oscillator It is possible to manually calibrate the internal oscillator to be more accurate than default factory calibration. Note that the oscillator frequency depends on temperature and voltage. Voltage and temperature characteristics can be found in "Internal Oscillator Speed" on page 293. Table 104. Calibration Accuracy of Internal 8MHz Oscillator Calibration Method Factory Calibration User Calibration (3) Notes: 1. Target Frequency VCC Temperature Accuracy (1) 8.0 MHz 3V 25C 2% (2) 10% (2) Within: 7.3 - 8.1 MHz Within: 1.7V - 5.5V Within: -40C to +85C 1% Accuracy of oscillator frequency at calibration point (fixed temperature and voltage). 2. See device ordering codes on page 303 for alternatives. 3. Not available in ATtiny828R devices. 24.4.2 Accuracy of Calibrated 32kHz Oscillator It is possible to manually calibrate the internal 32kHz oscillator to be more accurate than default factory calibration. Note that the oscillator frequency depends on temperature and voltage. Voltage and temperature characteristics can be found in "Internal Oscillator Speed" on page 293. ATtiny828 [DATASHEET] 8371A-AVR-08/12 249 Table 105. Calibration Accuracy of Internal 32kHz Oscillator Calibration Method Target Frequency VCC Temperature Accuracy 32kHz 1.7 - 5.5V -40C to +85C 30% Factory Calibration 24.4.3 External Clock Drive Figure 102. External Clock Drive Waveform V IH1 V IL1 Table 106. External Clock Drive Characteristics VCC = 1.7 - 5.5V 24.5 VCC = 2.7-5.5V VCC = 4.5-5.5V Symbol Parameter Min. Max. Min. Max. Min. Max. Unit 1/tCLCL Clock Frequency 0 4 0 8 0 12 MHz tCLCL Clock Period 250 125 83 ns tCHCX High Time 100 40 20 ns tCLCX Low Time 100 40 20 ns tCLCH Rise Time 2.0 1.6 0.5 s tCHCL Fall Time 2.0 1.6 0.5 s tCLCL Period change from one clock cycle to next 2 2 2 % System and Reset Characteristics Table 107. Symbol Reset and Internal Voltage Characteristics Parameter Condition VRST RESET Pin Threshold Voltage VBG Internal bandgap voltage VCC = 2.7V TA = 25C tRST Minimum pulse width on RESET Pin VCC = 1.8V VCC = 3V VCC = 5V Note: 1. Min(1) Typ(1) 0.2 VCC 1.0 1.1 Max(1) Units 0.9VCC V 1.2 V 2000 700 400 ns Values are guidelines, only ATtiny828 [DATASHEET] 8371A-AVR-08/12 250 24.5.1 Power-On Reset Table 108. Symbol Characteristics of Enhanced Power-On Reset. TA = -40 to +85C Parameter Min(1) Typ(1) Max(1) Units VPOR Release threshold of power-on reset (2) 1.1 1.4 1.6 V VPOA Activation threshold of power-on reset (3) 0.6 1.3 1.6 V SRON Power-On Slope Rate 0.01 Note: V/ms 1. Values are guidelines, only 2. Threshold where device is released from reset when voltage is rising 3. The Power-on Reset will not work unless the supply voltage has been below VPOT (falling) 24.5.2 Brown-Out Detection Table 109. VBOT vs. BODLEVEL Fuse Coding BODLEVEL[2:0] Fuses Min(1) Typ(1) Max(1) 11X 1.7 1.8 2.0 101 2.5 2.7 2.9 100 4.1 4.3 4.5 0XX Note: 24.6 1. Units V Reserved VBOT may be below nominal minimum operating voltage for some devices. For devices where this is the case, the device is tested down to VCC = VBOT during the production test. This guarantees that a Brown-out Reset will occur before VCC drops to a voltage where correct operation of the microcontroller is no longer guaranteed. Temperature Sensor Table 110. Accuracy of Temperature Sensor at Factory Calibration Symbol Parameter Condition ATS Accuracy VCC = 4.0, TA = 25C - 85C Note: Min Typ Max Units C 10 1. Firmware calculates temperature based on factory calibration value. 2. Min and max values are not guaranteed. Contact your local Atmel sales office if higher accuracy is required. ATtiny828 [DATASHEET] 8371A-AVR-08/12 251 24.7 Two-Wire Serial Interface Characteristics The following data is based on simulations and characterisations. Parameters listed in Table 111 on page 252 are not tested in production. Symbols refer to Figure 103. Table 111. Two-Wire Serial Interface Characteristics Min Max Uni t Input Low voltage -0.5 0.3 VCC V VIH Input High voltage 0.7 VCC VCC + 0.5 V VHYS Hysteresis of Schmitt-trigger inputs VOL Output Low voltage tSP Symbol Parameter VIL Condition VCC > 2.7V 0.05 VCC VCC < 2.7V 0 IOL = 3mA, VCC > 2.7V V - V 0 0.4 Spikes suppressed by input filter 0 50 ns fSCL SCL clock frequency (1) 0 400 kHz tHD:STA Hold time (repeated) START Condition 0.6 - s tLOW Low period of SCL clock 1.3 - s tHIGH High period of SCL clock 0.6 - s tSU:STA Set-up time for repeated START condition 0.6 - s tHD:DAT Data hold time 0 0.9 s tSU:DAT Data setup time 100 - ns tSU:STO Setup time for STOP condition 0.6 - s tBUF Bus free time between STOP and START condition 1.3 - s IOL = 2mA, VCC < 2.7V Notes: 1. fCK = CPU clock frequency. Figure 103. Two-Wire Serial Bus Timing tOF tHIGH tLOW SCL tSU:STA tHD:STA tR tLOW tHD:DAT tSU:DAT tSU:STO SDA tBUF ATtiny828 [DATASHEET] 8371A-AVR-08/12 252 24.8 ADC Characteristics Table 112. Symbol ADC Characteristics. T = -40C to +85C. VCC = 1.7 - 5.5V Parameter Condition Min Typ Resolution Absolute accuracy (Including INL, DNL, and Quantization, Gain and Offset Errors) RAIN Units 10 Bits VREF = VCC = 4V, ADC clock = 200 kHz 2 LSB VREF = VCC = 4V, ADC clock = 1 MHz 3 LSB VREF = VCC = 4V, ADC clock = 200 kHz Noise Reduction Mode 1.5 LSB VREF = VCC = 4V, ADC clock = 1 MHz Noise Reduction Mode 2.5 LSB Integral Non-Linearity (INL) (Accuracy after Offset and Gain Calibration) VREF = VCC = 4V, ADC clock = 200 kHz 1 LSB Differential Non-linearity (DNL) VREF = VCC = 4V, ADC clock = 200 kHz 0.5 LSB Gain Error VREF = VCC = 4V, ADC clock = 200 kHz 2.5 LSB Offset Error VREF = VCC = 4V, ADC clock = 200 kHz 1.5 LSB Conversion Time Free Running Conversion Clock Frequency VIN Max Input Voltage 13 260 s 50 1000 kHz GND VREF V Input Bandwidth 38.5 kHz Analog Input Resistance 100 M ADC Conversion Output 0 1023 LSB ATtiny828 [DATASHEET] 8371A-AVR-08/12 253 24.9 Analog Comparator Characteristics Table 113. Analog Comparator Characteristics, T = -40C to +85C Symbol Parameter Condition VAIO Input Offset Voltage VCC = 5V, VIN = VCC / 2 ILAC Input Leakage Current VCC = 5V, VIN = VCC / 2 Analog Propagation Delay (from saturation to slight overdrive) VCC = 2.7V 750 VCC = 4.0V 500 Analog Propagation Delay (large step change) VCC = 2.7V 100 VCC = 4.0V 75 Digital Propagation Delay VCC = 1.7V - 5.5 1 tAPD tDPD Min Typ Max Units < 10 40 mV 50 nA -50 ns 2 CLK 24.10 Parallel Programming Characteristics Figure 104. Parallel Programming Timing, Including some General Timing Requirements tXLWL tXHXL CLKI tDVXH tXLDX tBVPH tPLBX t BVWL Data & Contol (DATA, XA0/1, BS1, BS2) PAGEL tWLBX tPHPL tWLWH WR tPLWL WLRL RDY/BSY tWLRH ATtiny828 [DATASHEET] 8371A-AVR-08/12 254 Figure 105. Parallel Programming Timing, Loading Sequence with Timing Requirements(1) LOAD ADDRESS (LOW BYTE) LOAD DATA LOAD DATA (HIGH BYTE) LOAD DATA (LOW BYTE) tXLPH t XLXH LOAD ADDRESS (LOW BYTE) tPLXH CLKI BS1 PAGEL z DATA ADDR0 (Low Byte) DATA (Low Byte) DATA (High Byte) ADDR1 (Low Byte) XA0 XA1 Note: 1. The timing requirements shown in Figure 104 (i.e., tDVXH, tXHXL, and tXLDX) also apply to loading operation. Figure 106. Parallel Programming Timing, Reading Sequence (within the Same Page) with Timing Requirements(1) LOAD ADDRESS (LOW BYTE) READ DATA (LOW BYTE) READ DATA (HIGH BYTE) LOAD ADDRESS (LOW BYTE) tXLOL CLKI tBVDV BS1 tOLDV OE DATA tOHDZ ADDR0 (Low Byte) DATA (Low Byte) DATA (High Byte) ADDR1 (Low Byte) XA0 XA1 Note: 1. The timing requirements shown in Figure 104 (i.e., tDVXH, tXHXL, and tXLDX) also apply to reading operation. ATtiny828 [DATASHEET] 8371A-AVR-08/12 255 Table 114. Parallel Programming Characteristics, T = 25C, VCC = 5V Symbol Parameter Min VPP Programming Enable Voltage 11.5 IPP Programming Enable Current tDVXH Data and Control Valid before CLKI High 67 ns tXLXH CLKI Low to CLKI High 200 ns tXHXL CLKI Pulse Width High 150 ns tXLDX Data and Control Hold after CLKI Low 67 ns tXLWL CLKI Low to WR Low 0 ns tXLPH CLKI Low to PAGEL high 0 ns tPLXH PAGEL low to CLKI high 150 ns tBVPH BS1 Valid before PAGEL High 67 ns tPHPL PAGEL Pulse Width High 150 ns tPLBX BS1 Hold after PAGEL Low 67 ns tWLBX BS2/1 Hold after WR Low 67 ns tPLWL PAGEL Low to WR Low 67 ns tBVWL BS1 Valid to WR Low 67 ns tWLWH WR Pulse Width Low 150 ns tWLRL WR Low to RDY/BSY Low (1) Typ Max Units 12.5 V 250 A 0 1 s tWLRH WR Low to RDY/BSY High 3.7 4.5 ms tWLRH_CE WR Low to RDY/BSY High for Chip Erase(2) 7.5 9 ms tXLOL CLKI Low to OE Low 0 tBVDV BS1 Valid to DATA valid 0 tOLDV tOHDZ Notes: 1. 2. ns 250 ns OE Low to DATA Valid 250 ns OE High to DATA Tri-stated 250 ns tWLRH is valid for the Write Flash, Write EEPROM, Write Fuse bits and Write Lock bits commands. tWLRH_CE is valid for the Chip Erase command. ATtiny828 [DATASHEET] 8371A-AVR-08/12 256 24.11 Serial Programming Characteristics Figure 107. Serial Programming Timing MOSI tSHOX tOVSH SCK tSLSH tSHSL MISO Figure 108. Serial Programming Waveform SERIAL DATA INPUT (MOSI) MSB LSB SERIAL DATA OUTPUT (MISO) MSB LSB SERIAL CLOCK INPUT (SCK) SAMPLE Table 115. Symbol 1/tCLCL tCLCL Serial Programming Characteristics, T = -40C to +85C, VCC = 1.7 - 5.5V (Unless Otherwise Noted) Parameter Oscillator Frequency Oscillator Period Min 0 Typ Max Units 4 MHz 250 ns 1/tCLCL Oscillator Freq. (VCC = 4.5V - 5.5V) 0 tCLCL Oscillator Period (VCC = 4.5V - 5.5V) 50 ns tSHSL SCK Pulse Width High 2 tCLCL(1) ns tSLSH SCK Pulse Width Low 2 tCLCL(1) ns tOVSH MOSI Setup to SCK High tCLCL ns tSHOX MOSI Hold after SCK High 2 tCLCL ns Note: 1. 20 MHz 2 tCLCL for fck < 12MHz, 3 tCLCL for fck >= 12 MHz ATtiny828 [DATASHEET] 8371A-AVR-08/12 257 25. Typical Characteristics The data contained in this section is largely based on simulations and characterization of similar devices in the same process and design methods. Thus, the data should be treated as indications of how the part will behave. The following charts show typical behavior. These figures are not tested during manufacturing. During characterisation devices are operated at frequencies higher than test limits but they are not guaranteed to function properly at frequencies higher than the ordering code indicates. All current consumption measurements are performed with all I/O pins configured as inputs and with internal pull-ups enabled. Current consumption is a function of several factors such as operating voltage, operating frequency, loading of I/O pins, switching rate of I/O pins, code executed and ambient temperature. The dominating factors are operating voltage and frequency. A sine wave generator with rail-to-rail output is used as clock source but current consumption in Power-Down mode is independent of clock selection. The difference between current consumption in Power-Down mode with Watchdog Timer enabled and Power-Down mode with Watchdog Timer disabled represents the differential current drawn by the Watchdog Timer. The current drawn from pins with a capacitive load may be estimated (for one pin) as follows: I CP V CC x C L x f SW where VCC = operating voltage, CL = load capacitance and fSW = average switching frequency of I/O pin. Current Consumption in Active Mode Figure 109. Active Supply Current vs. Low Frequency (0.1 - 1.0 MHz) 1 0,9 5.5 V 0,8 5.0 V 0,7 4.5 V 0,6 ICC [mA] 25.1 4.0 V 0,5 0,4 3.3 V 0,3 2.7 V 0,2 1.8 V 0,1 0 0 0,1 0,2 0,3 0,4 0,5 0,6 0,7 0,8 0,9 1 Frequency [MHz] ATtiny828 [DATASHEET] 8371A-AVR-08/12 258 Figure 110. Active Supply Current vs. Frequency (1 - 20 MHz) 10 5.5 V 9 5.0 V 8 4.5 V 7 ICC [mA] 6 4.0 V 5 4 3.3 V 3 2.7 V 2 1 1.8 V 0 0 2 4 6 8 10 12 14 16 18 20 Frequency [MHz] Figure 111. Active Supply Current vs. VCC (Internal Oscillator, 8 MHz) 5 -40 25 85 4,5 4 3,5 ICC [mA] 3 2,5 2 1,5 1 0,5 0 1,5 2 2,5 3 3,5 4 4,5 5 5,5 VCC [V] ATtiny828 [DATASHEET] 8371A-AVR-08/12 259 Figure 112. Active Supply Current vs. VCC (Internal Oscillator, 1 MHz) 1,2 -40 25 85 1 ICC [mA] 0,8 0,6 0,4 0,2 0 1,5 2 2,5 3 3,5 4 4,5 5 5,5 VCC [V] Figure 113. Active Supply Current vs. VCC (Internal Oscillator, 32kHz) 0,04 -40 25 85 0,035 0,03 ICC [mA] 0,025 0,02 0,015 0,01 0,005 0 1,5 2 2,5 3 3,5 4 4,5 5 5,5 VCC [V] ATtiny828 [DATASHEET] 8371A-AVR-08/12 260 Current Consumption in Idle Mode Figure 114. Idle Supply Current vs. Low Frequency (0.1 - 1.0 MHz) 0,14 5.5 V 0,12 5.0 V 0,1 4.5 V 4.0 V 0,06 3.3 V ICC [mA] 0,08 2.7 V 0,04 1.8 V 0,02 0 0 0,1 0,2 0,3 0,4 0,5 0,6 0,7 0,8 0,9 1 Frequency [MHz] Figure 115. Idle Supply Current vs. Frequency (1 - 20 MHz) 3 5.5 V 2,5 5.0 V 2 ICC [mA] 25.2 4.5 V 1,5 4.0 V 1 3.3 V 0,5 2.7 V 1.8 V 0 0 2 4 6 8 10 12 14 16 18 20 Frequency [MHz] ATtiny828 [DATASHEET] 8371A-AVR-08/12 261 Figure 116. Idle Supply Current vs. VCC (Internal Oscillator, 8 MHz) 1,2 85 25 -40 1 ICC [mA] 0,8 0,6 0,4 0,2 0 1,5 2 2,5 3 3,5 4 4,5 5 5,5 VCC [V] Figure 117. Idle Supply Current vs. VCC (Internal Oscillator, 1 MHz) 0,3 85 25 -40 0,25 ICC [mA] 0,2 0,15 0,1 0,05 0 1,5 2 2,5 3 3,5 4 4,5 5 5,5 VCC [V] ATtiny828 [DATASHEET] 8371A-AVR-08/12 262 Figure 118. Idle Supply Current vs. VCC (Internal Oscillator, 32kHz) 0,01 -40 25 85 0,009 0,008 0,007 ICC [mA] 0,006 0,005 0,004 0,003 0,002 0,001 0 1,5 2 2,5 3 3,5 4 4,5 5 5,5 VCC [V] Current Consumption in Power-down Mode Figure 119. Power-down Supply Current vs. VCC (Watchdog Timer Disabled) 0,9 0,8 85 0,7 0,6 0,5 ICC [uA] 25.3 0,4 0,3 0,2 25 0,1 -40 0 1,5 2 2,5 3 3,5 4 4,5 5 5,5 VCC [V] ATtiny828 [DATASHEET] 8371A-AVR-08/12 263 Figure 120. Power-down Supply Current vs. VCC (Watchdog Timer Enabled) 6 -40 85 25 5 ICC [uA] 4 3 2 1 0 1,5 2 2,5 3 3,5 4 4,5 5 5,5 VCC [V] Current Consumption in Reset Figure 121. Reset Current vs. Frequency (0.1 - 1MHz, Excluding Pull-Up Current) 0,12 5.5 V 0,1 5.0 V 4.5 V 0,08 ICC [mA] 25.4 4.0 V 0,06 3.3 V 0,04 2.7 V 1.8 V 0,02 0 0 0,1 0,2 0,3 0,4 0,5 0,6 0,7 0,8 0,9 1 Frequency [MHz] ATtiny828 [DATASHEET] 8371A-AVR-08/12 264 Figure 122. Reset Current vs. Frequency (1 - 20MHz, Excluding Pull-Up Current) 2,5 5.5 V 2 5.0 V 4.5 V ICC [mA] 1,5 4.0 V 1 3.3 V 0,5 2.7 V 1.8 V 0 0 2 4 6 8 10 12 14 16 18 20 Frequency [MHz] Figure 123. Reset Current vs. VCC (No Clock, excluding Reset Pull-Up Current) 0,006 -40 0,005 25 85 ICC [mA] 0,004 0,003 0,002 0,001 0 1,5 2 2,5 3 3,5 4 4,5 5 5,5 VCC [V] ATtiny828 [DATASHEET] 8371A-AVR-08/12 265 Current Consumption of Peripheral Units Figure 124. Current Consumption of Peripherals at 4MHz vs. VCC 250 ADC 200 ICC [uA] 150 SPI 100 TWI USART0 T/C1 50 T/C0 0 1,5 2 2,5 3 3,5 4 4,5 5 5,5 VCC [V] Figure 125. Current Consumption of Peripherals at 3V vs. Frequency 500 450 ADC 400 350 300 ICC [uA] 25.5 250 200 SPI TWI 150 USART0 T/C1 100 T/C0 50 0 0 2 4 6 8 10 12 14 16 18 20 Frequency [MHz] ATtiny828 [DATASHEET] 8371A-AVR-08/12 266 Figure 126. Watchdog Timer Current vs. VCC 0,006 -40 0,005 25 85 ICCWDT [mA] 0,004 0,003 0,002 0,001 0 1,5 2 2,5 3 3,5 4 4,5 5 5,5 VCC [V] Figure 127. Brownout Detector Current vs. VCC 0,03 0,025 85 25 -40 ICC [mA] 0,02 0,015 0,01 0,005 0 1,5 2 2,5 3 3,5 4 4,5 5 5,5 VCC [V] ATtiny828 [DATASHEET] 8371A-AVR-08/12 267 Figure 128. Sampled Brownout Detector Current vs. VCC 0,008 -40 0,007 85 25 0,006 ICC [mA] 0,005 0,004 0,003 0,002 0,001 0 1,5 2 2,5 3 3,5 4 4,5 5 5,5 VCC [V] 25.6 Pull-up Resistors 25.6.1 I/O Pins Figure 129. I/O pin Pull-up Resistor Current vs. Input Voltage (VCC = 1.8V) 60 50 25 85 -40 IOP [uA] 40 30 20 10 0 0 0,4 0,8 1,2 1,6 2 VOP [V] ATtiny828 [DATASHEET] 8371A-AVR-08/12 268 Figure 130. I/O Pin Pull-up Resistor Current vs. input Voltage (VCC = 2.7V) 80 25 85 -40 70 60 IOP [uA] 50 40 30 20 10 0 0 0,5 1 1,5 2 2,5 3 VOP [V] Figure 131. I/O pin Pull-up Resistor Current vs. Input Voltage (VCC = 5V) 160 25 85 -40 IOP [uA] 120 80 40 0 0 1 3 2 4 5 VOP [V] ATtiny828 [DATASHEET] 8371A-AVR-08/12 269 25.6.2 Reset Pin Figure 132. Reset Pull-up Resistor Current vs. Reset Pin Voltage (VCC = 1.8V) 40 25 -40 85 35 30 IRESET [uA] 25 20 15 10 5 0 0 0,2 0,4 0,6 0,8 1 1,2 1,4 1,6 1,8 2 VRESET [V] Figure 133. Reset Pull-up Resistor Current vs. Reset Pin Voltage (VCC = 2.7V) 60 25 -40 85 50 IRESET [uA] 40 30 20 10 0 0 0,5 1 1,5 2 2,5 3 VRESET [V] ATtiny828 [DATASHEET] 8371A-AVR-08/12 270 Figure 134. Reset Pull-up Resistor Current vs. Reset Pin Voltage (VCC = 5V) 120 25 -40 85 100 IRESET [uA] 80 60 40 20 0 0 2 1 3 4 5 VRESET [V] 25.7 Input Thresholds 25.7.1 I/O Pins Figure 135. VIH: Input Threshold Voltage vs. VCC (I/O Pin, Read as `1') 3,5 85 25 -40 3 Threshold [V] 2,5 2 1,5 1 0,5 0 1,5 2 2,5 3 3,5 4 4,5 5 5,5 VCC [V] ATtiny828 [DATASHEET] 8371A-AVR-08/12 271 Figure 136. VIL: Input Threshold Voltage vs. VCC (I/O Pin, Read as `0') 2,5 85 25 -40 Threshold [V] 2 1,5 1 0,5 0 1,5 2 2,5 3 3,5 4 4,5 5 5,5 VCC [V] Figure 137. VIH-VIL: Input Hysteresis vs. VCC (I/O Pin) 1 0,9 0,8 Hysteresis [V] 0,7 0,6 -40 25 85 0,5 0,4 0,3 0,2 0,1 0 1,5 2 2,5 3 3,5 4 4,5 5 5,5 VCC [V] ATtiny828 [DATASHEET] 8371A-AVR-08/12 272 25.7.2 TWI Pins Figure 138. VIH: Input Threshold Voltage vs. VCC (I/O Pin, Read as `1') 3,5 85 25 -40 3 Threshold [V] 2,5 2 1,5 1 0,5 0 1,5 2 2,5 3 3,5 4 4,5 5 5,5 VCC [V] Figure 139. VIL: Input Threshold Voltage vs. VCC (I/O Pin, Read as `0') 3 2,5 -40 85 25 Threshold [V] 2 1,5 1 0,5 0 1,5 2 2,5 3 3,5 4 4,5 5 5,5 VCC [V] ATtiny828 [DATASHEET] 8371A-AVR-08/12 273 Figure 140. VIH-VIL: Input Hysteresis vs. VCC (I/O Pin) 1 0,9 85 25 -40 0,8 0,7 Hysteresis [V] 0,6 0,5 0,4 0,3 0,2 0,1 0 1,5 2 2,5 3 3,5 4 4,5 5 5,5 VCC [V] 25.7.3 Reset Pin as I/O Figure 141. VIH: Input Threshold Voltage vs. VCC (Reset Pin as I/O, Read as `1') 3 85 25 -40 2,5 Threshold [V] 2 1,5 1 0,5 0 1,5 2 2,5 3 3,5 4 4,5 5 5,5 VCC [V] ATtiny828 [DATASHEET] 8371A-AVR-08/12 274 Figure 142. VIL: Input Threshold Voltage vs. VCC (Reset Pin as I/O, Read as `0') 2,5 -40 85 25 2 Threshold [V] 1,5 1 0,5 0 1,5 2 2,5 3 3,5 4 4,5 5 5,5 VCC [V] Figure 143. VIH-VIL: Input Hysteresis vs. VCC (Reset Pin as I/O) 1 Hysteresis [V] 0,8 0,6 85 25 -40 0,4 0,2 0 1,5 2 2,5 3 3,5 4 4,5 5 5,5 VCC [V] ATtiny828 [DATASHEET] 8371A-AVR-08/12 275 25.7.4 Reset Pin Figure 144. VIH: Input Threshold Voltage vs. VCC (Reset Pin, Read as `1') 2,5 -40 25 85 2 Threshold [V] 1,5 1 0,5 0 1,5 2 2,5 3 3,5 4 4,5 5 5,5 VCC [V] Figure 145. VIL: Input Threshold Voltage vs. VCC (Reset Pin, Read as `0') 2,5 85 -40 25 2 Threshold [V] 1,5 1 0,5 0 1,5 2 2,5 3 3,5 4 4,5 5 5,5 VCC [V] ATtiny828 [DATASHEET] 8371A-AVR-08/12 276 Figure 146. VIH-VIL: Input Hysteresis vs. VCC (Reset Pin ) 1 0,8 Hysteresis [V] 0,6 0,4 0,2 0 1,5 2 2,5 3 3,5 4 4,5 5 -40 25 5,5 85 -0,2 VCC [V] 25.8 Current Source Strength 25.8.1 I/O Pins Figure 147. VOH: Output Voltage vs. Source Current (I/O Pin, VCC = 1.8V) 2 1,8 1,6 1,4 VOH [V] 1,2 -40 1 0,8 25 0,6 85 0,4 0,2 0 0 1 2 3 4 5 IOH [mA] ATtiny828 [DATASHEET] 8371A-AVR-08/12 277 Figure 148. VOH: Output Voltage vs. Source Current (I/O Pin, VCC = 3V) 3 -40 25 85 2,5 VOH [V] 2 1,5 1 0,5 0 0 1 2 3 4 5 6 7 8 9 10 IOH [mA] Figure 149. VOH: Output Voltage vs. Source Current (I/O Pin, VCC = 5V) 5 -40 25 85 4 VOH [V] 3 2 1 0 0 2 4 6 8 10 12 14 16 18 20 IOH [mA] ATtiny828 [DATASHEET] 8371A-AVR-08/12 278 25.8.2 Reset Pin as I/O Figure 150. VOH: Output Voltage vs. Source Current (Reset Pin as I/O, VCC = 1.8V 1,6 1,4 1,2 VOH [V] 1 0,8 0,6 0,4 -40 25 0,2 85 0 0 0,2 0,4 0,6 0,8 1 IOH [mA] Figure 151. VOH: Output Voltage vs. Source Current (Reset Pin as I/O, VCC = 3V 2,5 2 1,5 VOH [V] -40 25 1 0,5 85 0 0 0,2 0,4 0,6 0,8 1 ATtiny828 [DATASHEET] 8371A-AVR-08/12 279 Figure 152. VOH: Output Voltage vs. Source Current (Reset Pin as I/O, VCC = 5V 5 4 -40 25 VOH [V] 3 2 1 85 0 0,2 0 25.9 0,4 0,6 0,8 1 Current Sink Capability 25.9.1 I/O Pins with Standard Sink Capability Figure 153. VOL: Output Voltage vs. Sink Current (Standard I/O Pin, VCC = 1.8V) 1 0,8 85 VOL [V] 0,6 25 0,4 -40 0,2 0 0 0,5 1 1,5 2 2,5 3 3,5 4 4,5 5 IOL [mA] ATtiny828 [DATASHEET] 8371A-AVR-08/12 280 Figure 154. VOL: Output Voltage vs. Sink Current (Standard I/O Pin, VCC = 3V) 1 0,8 0,6 VOL [V] 85 25 0,4 -40 0,2 0 0 2 6 4 8 10 IOL [mA] Figure 155. VOL: Output Voltage vs. Sink Current (Standard I/O Pin, VCC = 5V) 1 85 0,8 25 0,6 VOL [V] -40 0,4 0,2 0 0 2 4 6 8 10 12 14 16 18 20 IOL [mA] ATtiny828 [DATASHEET] 8371A-AVR-08/12 281 25.9.2 I/O Pins with High Sink Capability Figure 156. VOL: Output Voltage vs. Sink Current (High Sink I/O Pin, VCC = 1.8V) 1 0,8 85 VOL [V] 0,6 25 0,4 -40 0,2 0 0 1 2 3 4 5 6 7 8 9 10 IOL [mA] Figure 157. VOL: Output Voltage vs. Sink Current (High Sink I/O Pin, VCC = 3V) 1 0,8 85 VOL [V] 0,6 25 -40 0,4 0,2 0 0 5 10 15 20 IOL [mA] ATtiny828 [DATASHEET] 8371A-AVR-08/12 282 Figure 158. VOL: Output Voltage vs. Sink Current (High Sink I/O Pin, VCC = 5V) 1 0,8 VOL [V] 0,6 85 0,4 25 -40 0,2 0 0 2 4 6 8 10 12 14 16 18 20 IOL [mA] 25.9.3 I/O Pins with Extra High Sink Capability Figure 159. VOL: Output Voltage vs. Sink Current (Extra High Sink I/O Pin, VCC = 1.8V) 1 0,8 85 VOL [V] 0,6 25 0,4 -40 0,2 0 0 3 6 9 12 15 IOL [mA] ATtiny828 [DATASHEET] 8371A-AVR-08/12 283 Figure 160. VOL: Output Voltage vs. Sink Current (Extra High Sink I/O Pin, VCC = 3V) 1 0,8 VOL [V] 0,6 85 0,4 25 -40 0,2 0 0 5 10 15 20 IOL [mA] Figure 161. VOL: Output Voltage vs. Sink Current (Extra High Sink I/O Pin, VCC = 5V) 1 0,8 VOL [V] 0,6 0,4 85 25 -40 0,2 0 0 2 4 6 8 10 12 14 16 18 20 IOL [mA] ATtiny828 [DATASHEET] 8371A-AVR-08/12 284 25.9.4 Reset Pin as I/O Figure 162. VOL: Output Voltage vs. Sink Current (Reset Pin as I/O, VCC = 1.8V) 1 85 0,9 0,8 0,7 25 VOL [V] 0,6 0,5 -40 0,4 0,3 0,2 0,1 0 0 0,1 0,2 0,3 0,4 0,5 0,6 0,7 0,8 0,9 1 Figure 163. VOL: Output Voltage vs. Sink Current (Reset Pin as I/O, VCC = 3V) 1 0,9 0,8 0,7 85 VOL [V] 0,6 0,5 25 0,4 -40 0,3 0,2 0,1 0 0 0,2 0,4 0,6 0,8 1 1,2 1,4 1,6 1,8 2 ATtiny828 [DATASHEET] 8371A-AVR-08/12 285 Figure 164. VOL: Output Voltage vs. Sink Current (Reset Pin as I/O, VCC = 5V) 1 85 0,8 25 0,6 VOL [V] -40 0,4 0,2 0 0 1 2 4 3 5 25.10 BOD Figure 165. BOD Threshold vs Temperature (BODLEVEL = 4.3V) 4,36 VCC RISING 4,34 4,32 Threshold [V] 4,3 4,28 VCC FALLING 4,26 4,24 4,22 4,2 -60 -40 -20 0 20 40 60 80 100 Temperature [C] ATtiny828 [DATASHEET] 8371A-AVR-08/12 286 Figure 166. BOD Threshold vs Temperature (BODLEVEL = 2.7V) 2,78 2,76 VCC RISING Threshold [V] 2,74 2,72 2,7 VCC FALLING 2,68 2,66 2,64 -60 -40 -20 0 20 40 60 80 100 Temperature [C] Figure 167. BOD Threshold vs Temperature (BODLEVEL = 1.8V) 1,83 VCC RISING 1,82 Threshold [V] 1,81 1,8 VCC FALLING 1,79 1,78 1,77 1,76 -60 -40 -20 0 20 40 60 80 100 Temperature [C] ATtiny828 [DATASHEET] 8371A-AVR-08/12 287 Figure 168. Sampled BOD Threshold vs Temperature (BODLEVEL = 4.3V) 4,36 VCC RISING VCC FALLING 4,35 Threshold [V] 4,34 4,33 4,32 4,31 4,3 4,29 -60 -40 -20 0 20 40 60 80 100 Temperature [C] Figure 169. Sampled BOD Threshold vs Temperature (BODLEVEL = 2.7V) 2,765 VCC RISING 2,76 VCC FALLING 2,755 Threshold [V] 2,75 2,745 2,74 2,735 2,73 2,725 2,72 -60 -40 -20 0 20 40 60 80 100 Temperature [C] ATtiny828 [DATASHEET] 8371A-AVR-08/12 288 Figure 170. Sampled BOD Threshold vs Temperature (BODLEVEL = 1.8V) 1,83 VCC RISING 1,825 VCC FALLING Threshold [V] 1,82 1,815 1,81 1,805 1,8 -60 -40 -20 0 20 40 60 80 100 Temperature [C] 25.11 Bandgap Voltage Figure 171. Bandgap Voltage vs. Supply Voltage 1,12 1,11 85 Bandgap Voltage [V] 25 1,1 1,09 -40 1,08 1,07 1,5 2 2,5 3 3,5 4 4,5 5 5,5 Vcc [V] ATtiny828 [DATASHEET] 8371A-AVR-08/12 289 Figure 172. Bandgap Voltage vs. Temperature (VCC = 3.3V) 1,1 5 3 1,8 Bandgap Voltage [V] 1,09 1,08 1,07 1,06 -40 -20 0 20 40 60 80 100 Temperature [C] 25.12 Reset Figure 173. POR Trigger Levels 1,5 1,45 1,4 RISING Threshold [V] 1,35 1,3 1,25 FALLING 1,2 1,15 1,1 -40 -20 0 20 40 60 80 100 Temperature ATtiny828 [DATASHEET] 8371A-AVR-08/12 290 Figure 174. Minimum Reset Pulse Width vs. VCC 3000 2500 Pulsewidth [ns] 2000 1500 1000 500 85 25 -40 0 1,5 2 2,5 3 3,5 4 4,5 5 5,5 VCC [V] 25.13 Analog Comparator Offset Figure 175. Analog Comparator Offset vs. VIN (VCC = 5V) 0,014 -40 0,012 0,01 Offset [V] 0,008 25 0,006 85 0,004 0,002 0 0 0,5 1 1,5 2 2,5 3 3,5 4 4,5 5 Vin [V] ATtiny828 [DATASHEET] 8371A-AVR-08/12 291 Figure 176. Analog Comparator Offset vs. VCC (VIN = 1.1V) 0,008 0,007 0,006 -40 0,005 Offset [V] 25 0,004 85 0,003 0,002 0,001 0 1,5 2 2,5 3 3,5 4 4,5 5 5,5 VCC [V] Figure 177. Analog Comparator Hysteresis vs. VIN (VCC = 5.0V) 0,12 0,1 -40 25 85 Hysteresis [V] 0,08 0,06 0,04 0,02 0 0 0,5 1 1,5 2 2,5 3 3,5 4 4,5 5 Vin [V] ATtiny828 [DATASHEET] 8371A-AVR-08/12 292 25.14 Internal Oscillator Speed 25.14.1 8MHz Oscillator with CKDIV8 Enabled Figure 178. Calibrated Oscillator Frequency vs. VCC (One-point Calibration) 1,05 -40 1,04 25 1,03 Frequency [MHz] 1,02 85 1,01 1 0,99 0,98 0,97 1,5 2 2,5 3 3,5 4 4,5 5 5,5 VCC [V] Figure 179. Calibrated Oscillator Frequency vs. VCC (Two-point Calibration) 1,06 -40 1,04 Frequency [MHz] 25 85 1,02 1 0,98 0,96 1,5 2 2,5 3 3,5 4 4,5 5 5,5 ATtiny828 [DATASHEET] 8371A-AVR-08/12 293 Figure 180. Calibrated Oscillator Frequency vs. Temperature (One-point Calibration) 1,04 1,03 Frequency [MHz] 1,02 1,01 5.0 V 1 0,99 3.0 V 0,98 1.8 V 0,97 -40 -30 -20 -10 0 10 20 30 40 50 60 70 80 90 100 Temperature [] Figure 181. Calibrated Oscillator Frequency vs. Temperature (Two-point Calibration) 1,03 1,02 1,01 Frequency [MHz] 5.0 V 1 0,99 3.0 V 0,98 1.8 V 0,97 -40 -20 0 20 40 60 80 100 Temperature [] ATtiny828 [DATASHEET] 8371A-AVR-08/12 294 Figure 182. Calibrated Oscillator Frequency vs. OSCCAL0 Value 2 1,8 -40 25 85 1,6 Frequency [MHz] 1,4 1,2 1 0,8 0,6 0,4 0,2 0 0 16 32 48 64 80 96 112 128 144 160 176 192 208 224 240 25.14.2 32kHz ULP Oscillator Figure 183. ULP Oscillator Frequency vs. VCC 0,033 -40 Frequency [MHz] 0,032 25 0,031 0,03 85 0,029 0,028 1,5 2 2,5 3 3,5 4 4,5 5 5,5 VCC [V] ATtiny828 [DATASHEET] 8371A-AVR-08/12 295 Figure 184. ULP Oscillator Frequency vs. Temperature 0,033 0,032 Frequency [MHz] 0,031 0,03 1.8 V 3.0 V 5.0 V 0,029 0,028 -40 -20 0 20 40 60 80 100 Temperature [] Figure 185. ULP Oscillator Frequency vs. OSCCAL1 Value 45000 40000 3 Frequency [Hz] 35000 2 30000 1 0 25000 20000 -40 -20 0 20 40 60 80 100 Temperature [C] ATtiny828 [DATASHEET] 8371A-AVR-08/12 296 26. Register Summary Address Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 (0xFF) Reserved - - - - - - - - (0xFE) Reserved - - - - - - - - (0xFD) Reserved - - - - - - - - (0xFC) Reserved - - - - - - - - (0xFB) Reserved - - - - - - - - (0xFA) Reserved - - - - - - - - (0xF9) Reserved - - - - - - - - (0xF8) Reserved - - - - - - - - (0xF7) Reserved - - - - - - - - (0xF6) Reserved - - - - - - - - (0xF5) Reserved - - - - - - - - (0xF4) Reserved - - - - - - - - (0xF3) Reserved - - - - - - - - (0xF2) Reserved - - - - - - - - (0xF1) OSCTCAL0B Oscillator Temperature Compensation Register B (0xF0) OSCTCAL0A Oscillator Temperature Compensation Register A (0xEF) Reserved - - - - - - - - Page(s) Page 33 Page 33 (0xEE) Reserved - - - - - - - - (0xED) Reserved - - - - - - - - (0xEC) Reserved - - - - - - - - (0xEB) Reserved - - - - - - - - (0xEA) Reserved - - - - - - - - (0xE9) TOCPMSA1 TOCC7S1 TOCC7S0 TOCC6S1 TOCC6S0 TOCC5S1 TOCC5S0 TOCC4S1 TOCC4S0 Page 127 (0xE8) TOCPMSA0 TOCC3S1 TOCC3S0 TOCC2S1 TOCC2S0 TOCC1S1 TOCC1S0 TOCC0S1 TOCC0S0 Page 127 (0xE7) Reserved - - - - - - - - (0xE6) Reserved - - - - - - - - (0xE5) Reserved - - - - - - - - (0xE4) Reserved - - - - - - - - (0xE3) Reserved - - - - - - - - (0xE2) TOCPMCOE TOCC7OE TOCC6OE TOCC5OE TOCC4OE TOCC3OE TOCC2OE TOCC1OE TOCC0OE (0xE1) Reserved - - - - - - - - Page 128 (0xE0) Reserved - - - - - - - - (0xDF) DIDR3 - - - - ADC27D ADC26D ADC25D ADC24D Page 154 (0xDE) DIDR2 ADC23D ADC22D ADC21D ADC20D ADC19D ADC18D ADC17D ADC16D Page 154 (0xDD) Reserved - - - - - - - - (0xDC) Reserved - - - - - - - - (0xDB) Reserved - - - - - - - - (0xDA) Reserved - - - - - - - - (0xD9) Reserved - - - - - - - - (0xD8) Reserved - - - - - - - - (0xD7) Reserved - - - - - - - - (0xD6) Reserved - - - - - - - - (0xD5) Reserved - - - - - - - - (0xD4) Reserved - - - - - - - - (0xD3) Reserved - - - - - - - - (0xD2) Reserved - - - - - - - - (0xD1) Reserved - - - - - - - - (0xD0) Reserved - - - - - - - - (0xCF) Reserved - - - - - - - - (0xCE) Reserved - - - - - - - - (0xCD) Reserved - - - - - - - - (0xCC) Reserved - - - - - - - - (0xCB) Reserved - - - - - - - - (0xCA) Reserved - - - - - - - - (0xC9) Reserved - - - - - - - - (0xC8) Reserved - - - - - - - - (0xC7) Reserved - - - - - - - - (0xC6) UDR (0xC5) UBRRH (0xC4) UBRRL USART Data Register - - - - Pages 184, 195 USART Baud Register High Page 189, 198 USART Baud Rate Register Low Page 189, 198 (0xC3) UCSRD RXSIE RXS SFDE - - - - - Page 188 (0xC2) UCSRC UMSEL1 UMSEL0 UPM1 UPM0 USBS UCSZ1/UDO UCSZ0/UCP UCPOL Page 186, 197 (0xC1) UCSRB RXCIE TXCIE UDRIE RXEN TXEN UCSZ2 RXB8 TXB8 Page 185, 196 (0xC0) UCSRA RXC TXC UDRE FE DOR UPE U2X MPCM Page 184, 196 (0xBF) Reserved - - - - - - - - (0xBE) Reserved - - - - - - - - ATtiny828 [DATASHEET] 8371A-AVR-08/12 297 Address Name (0xBD) TWSD Bit 7 Bit 6 Bit 5 TWI Slave Data Register Bit 4 Bit 3 Bit 2 Bit 1 Page 211 (0xBC) TWSA TWI Slave Address Register Page 210 TWI Slave Address Mask Register Bit 0 TWAE Page(s) (0xBB) TWSAM (0xBA) TWSSRA TWDIF TWASIF TWCH TWRA TWC TWBE TWDIR TWAS Page 209 (0xB9) TWSCRB - - - - - TWAA TWCMD1 TWCMD0 Page 208 (0xB8) TWSCRA TWSHE - TWDIE TWASIE TWEN TWSIE TWPME TWSME Page 207 (0xB7) Reserved - - - - - - - - (0xB6) Reserved - - - - - - - - (0xB5) Reserved - - - - - - - - (0xB4) Reserved - - - - - - - - (0xB3) Reserved - - - - - - - - (0xB2) Reserved - - - - - - - - (0xB1) Reserved - - - - - - - - (0xB0) Reserved - - - - - - - - (0xAF) Reserved - - - - - - - - (0xAE) Reserved - - - - - - - - (0xAD) Reserved - - - - - - - - (0xAC) Reserved - - - - - - - - (0xAB) Reserved - - - - - - - - (0xAA) Reserved - - - - - - - - (0xA9) Reserved - - - - - - - - (0xA8) Reserved - - - - - - - - (0xA7) Reserved - - - - - - - - (0xA6) Reserved - - - - - - - - (0xA5) Reserved - - - - - - - - (0xA4) Reserved - - - - - - - - (0xA3) Reserved - - - - - - - - (0xA2) Reserved - - - - - - - - (0xA1) Reserved - - - - - - - - (0xA0) Reserved - - - - - - - - (0x9F) Reserved - - - - - - - - (0x9E) Reserved - - - - - - - - (0x9D) Reserved - - - - - - - - (0x9C) Reserved - - - - - - - - (0x9B) Reserved - - - - - - - - (0x9A) Reserved - - - - - - - - (0x99) Reserved - - - - - - - - (0x98) Reserved - - - - - - - - (0x97) Reserved - - - - - - - - (0x96) Reserved - - - - - - - - (0x95) Reserved - - - - - - - - (0x94) Reserved - - - - - - - - (0x93) Reserved - - - - - - - - (0x92) Reserved - - - - - - - - (0x91) Reserved - - - - - - - - (0x90) Reserved - - - - - - - - (0x8F) Reserved - - - - - - - - (0x8E) Reserved - - - - - - - - (0x8D) Reserved - - - - - - - - (0x8C) Reserved - - - - - - - - (0x8B) OCR1BH Timer/Counter1 - Output Compare Register B High Byte Page 128 (0x8A) OCR1BL Timer/Counter1 - Output Compare Register B Low Byte Page 128 (0x89) OCR1AH Timer/Counter1 - Output Compare Register A High Byte Page 128 (0x88) OCR1AL Timer/Counter1 - Output Compare Register A Low Byte Page 128 (0x87) ICR1H Timer/Counter1 - Input Capture Register High Byte Page 129 (0x86) ICR1L Timer/Counter1 - Input Capture Register Low Byte Page 129 (0x85) TCNT1H Timer/Counter1 - Counter Register High Byte Page 128 Timer/Counter1 - Counter Register Low Byte Page 211 (0x84) TCNT1L (0x83) Reserved - - - (0x82) TCCR1C FOC1A FOC1B - - - - - - Page 127 (0x81) TCCR1B ICNC1 ICES1 - WGM13 WGM12 CS12 CS11 CS10 Page 125 (0x80) TCCR1A COM1A1 COM1A0 COM1B1 COM1B0 - - WGM11 WGM10 Page 123 (0x7F) DIDR1 ADC15D ADC14D ADC13D ADC12D ADC11D ADC10D ADC9D ADC8D Page 154 Pages 136, 154 - - Page 128 - - - (0x7E) DIDR0 ADC7D ADC6D ADC5D ADC4D ADC3D ADC2D ADC1D ADC0D (0x7D) ADMUXB - - REFS - - - - MUX5 Page 150 (0x7C) ADMUXA - - - MUX4 MUX3 MUX2 MUX1 MUX0 Page 149 (0x7B) ADCSRB - - - - ADLAR ADTS2 ADTS1 ADTS0 Page 153 (0x7A) ADCSRA ADEN ADSC ADATE ADIF ADIE ADPS2 ADPS1 ADPS0 Page 151 ATtiny828 [DATASHEET] 8371A-AVR-08/12 298 Address Name (0x79) ADCH Bit 7 Bit 6 Bit 5 ADC - Conversion Result High Byte Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Page(s) (0x78) ADCL ADC - Conversion Result Low Byte (0x77) Reserved - - - - - - - - (0x76) Reserved - - - - - - - - (0x75) Reserved - - - - - - - - (0x74) Reserved - - - - - - - - (0x73) PCMSK3 - - - - PCINT27 PCINT26 PCINT25 PCINT24 (0x72) Reserved - - - - - - - - (0x71) Reserved - - - - - - - - (0x70) Reserved - - - - - - - - (0x6F) TIMSK1 - - ICIE1 - - OCIE1B OCIE1A TOIE1 Page 129 (0x6E) TIMSK0 - - - - - OCIE0B OCIE0A TOIE0 Page 102 (0x6D) PCMSK2 PCINT23 PCINT22 PCINT21 PCINT20 PCINT19 PCINT18 PCINT17 PCINT16 Page 54 (0x6C) PCMSK1 PCINT15 PCINT14 PCINT13 PCINT12 PCINT11 PCINT10 PCINT9 PCINT8 Page 54 (0x6B) PCMSK0 PCINT7 PCINT6 PCINT5 PCINT4 PCINT3 PCINT2 PCINT1 PCINT0 Page 55 (0x6A) Reserved - - - - - - - - (0x69) EICRA - - - - ISC11 ISC10 ISC01 ISC00 Page 55 (0x68) PCICR - - - - PCIE3 PCIE2 PCIE1 PCIE0 Page 56 Page 151 Page 151 Page 54 (0x67) OSCCAL1 - - - - - - CAL11 CAL10 Page 33 (0x66) OSCCAL0 CAL07 CAL06 CAL05 CAL04 CAL03 CAL02 CAL01 CAL00 Page 32 (0x65) Reserved - - - - - - - - (0x64) PRR PRTWI - PRTIM0 - PRTIM1 PRSPI PRUSART0 PRADC (0x63) Reserved - - - - - - - - (0x62) Reserved - - - - - - - - (0x61) CLKPR - - - - CLKPS3 CLKPS2 CLKPS1 CLKPS0 Page 31 (0x60) WDTCSR WDIF WDIE WDP3 - WDE WDP2 WDP1 WDP0 Page 46 0x3F (0x5F) SREG I T H S V N Z C Page 15 0x3E (0x5E) SPH - - - - - - SP9 SP8 Page 14 0x3D (0x5D) SPL SP7 SP6 SP5 SP4 SP3 SP2 SP1 SP0 Page 14 0x3C (0x5C) Reserved - - - - - - - - 0x3B (0x5B) Reserved - - - - - - - - 0x3A (0x5A) Reserved - - - - - - - - 0x39 (0x59) Reserved - - - - - - - - 0x38 (0x58) Reserved - - - - - - - - 0x37 (0x57) SPMCSR SPMIE RWWSB RSIG RWWSRE RWFLB PGWRT PGERS SPMEN Page 223 0x36 (0x56) CCP 0x35 (0x55) MCUCR - - - - - - IVSEL - Page 53 0x34 (0x54) MCUSR - - - - WDRF BORF EXTRF PORF Page 45 0x33 (0x53) SMCR - - - - - SM1 SM0 SE Page 37 0x32 (0x52) Reserved - - - - - - - - ACIE ACIC ACIS1 ACIS0 Page 134 ACNMUX1 ACNMUX0 ACPMUX1 ACPMUX0 Page 135 CPU Change Protection Register 0x31 (0x51) DWDR 0x30 (0x50) ACSRA ACD ACPMUX2 ACO HSEL HLEV ACLP Page 14 debugWire Data Register ACI Page 37 Page 213 0x2F (0x4F) ACSRB 0x2E (0x4E) SPDR 0x2D (0x4D) SPSR SPIF WCOL - 0x2C (0x4C) SPCR SPIE SPE DORD 0x2B (0x4B) GPIOR2 General Purpose I/O Register 2 Page 25 0x2A (0x4A) GPIOR1 General Purpose I/O Register 1 Page 25 0x29 (0x49) Reserved 0x28 (0x48) OCR0B Timer/Counter0 - Output Compare Register B Page 102 0x27 (0x47) OCR0A Timer/Counter0 - Output Compare Register A Page 102 0x26 (0x46) TCNT0 Timer/Counter0 - Counter Register 0x25 (0x45) TCCR0B FOC0A FOC0B - - WGM02 CS02 CS01 CS00 SPI Data Register Page 163 - - - - SPI2X Page 162 MSTR CPOL CPHA SPR1 SPR0 Page 161 Page 101 Page 100 0x24 (0x44) TCCR0A COM0A1 COM0A0 COM0B1 COM0B0 - - WGM01 WGM00 Page 97 0x23 (0x43) GTCCR TSM - - - - - - PSR Page 132 0x22 (0x42) Reserved 0x21 (0x41) EEARL EEPROM Address Register Low Byte Page 23 0x20 (0x40) EEDR EEPROM Data Register Page 24 0x1F (0x3F) EECR 0x1E (0x3E) GPIOR0 - - EEPM1 EEPM0 EERIE EEMPE EEPE EERE Page 24 0x1D (0x3D) EIMSK - - - - - INT1 INT0 Page 56 0x1C (0x3C) EIFR - - - - - - INT1 INTF0 Page 57 0x1B (0x3B) PCIFR - - - - PCIF3 PCIF2 PCIF1 PCIF0 Page 57 0x1A (0x3A) Reserved - - - - - - - - 0x19 (0x39) Reserved - - - - - - - - 0x18 (0x38) Reserved - - - - - - - - 0x17 (0x37) Reserved - - - - - - - - 0x16 (0x36) TIFR1 - - ICF1 - - OCF1B OCF1A TOV1 General Purpose I/O register 0 - Page 26 Page 130 ATtiny828 [DATASHEET] 8371A-AVR-08/12 299 Address Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Page(s) 0x15 (0x35) TIFR0 - - - - - OCF0B OCF0A TOV0 Page 103 0x14 (0x34) PHDE - - - - - PHDEC - - Page 81 0x13 (0x33) Reserved - - - - - - - - 0x12 (0x32) Reserved - - - - - - - - 0x11 (0x31) Reserved - - - - - - - - 0x10 (0x30) Reserved - - - - - - - - 0x0F (0x2F) PUED - - - - PUED3 PUED2 PUED1 PUED0 0x0E (0x2E) PORTD - - - - PORTD3 PORTD2 PORTD1 PORTD0 Page 82 0x0D (0x2D) DDRD - - - - DDD3 DDD2 DDD1 DDD0 Page 82 Page 82 0x0C (0x2C) PIND - - - - PIND3 PIND2 PIND1 PIND0 Page 83 0x0B (0x2B) PUEC PUEC7 PUEC6 PUEC5 PUEC4 PUEC3 PUEC2 PUEC1 PUEC0 Page 83 0x0A (0x2A) PORTC PORTC7 PORTC6 PORTC5 PORTC4 PORTC3 PORTC2 PORTC1 PORTC0 Page 83 0x09 (0x29) DDRC DDC7 DDC6 DDC5 DDC4 DDC3 DDC2 DDC1 DDC0 Page 83 0x08 (0x28) PINC PINC7 PINC6 PINC5 PINC4 PINC3 PINC2 PINC1 PINC0 Page 84 0x07 (0x27) PUEB PUEB7 PUEB6 PUEB5 PUEB4 PUEB3 PUEB2 PUEB1 PUEB0 Page 84 0x06 (0x26) PORTB PORTB7 PORTB6 PORTB5 PORTB4 PORTB3 PORTB2 PORTB1 PORTB0 Page 84 0x05 (0x25) DDRB DDB7 DDB6 DDB5 DDB4 DDB3 DDB2 DDB1 DDB0 Page 84 0x04 (0x24) PINB PINB7 PINB6 PINB5 PINB4 PINB3 PINB2 PINB1 PINB0 Page 85 0x03 (0x23) PUEA PUEA7 PUEA6 PUEA5 PUEA4 PUEA3 PUEA2 PUEA1 PUEA0 Page 85 0x02 (0x22) PORTA PORTA7 PORTA6 PORTA5 PORTA4 PORTA3 PORTA2 PORTA1 PORTA0 Page 85 0x01 (0x21) DDRA DDA7 DDA6 DDA5 DDA4 DDA3 DDA2 DDA1 DDA0 Page 85 0x00 (0x20) PINA PINA7 PINA6 PINA5 PINA4 PINA3 PINA2 PINA1 PINA0 Page 86 Note: 1. For compatibility with future devices, reserved bits should be written to zero if accessed. Reserved I/O memory addresses should never be written. 2. I/O Registers within the address range 0x00 - 0x1F are directly bit-accessible using the SBI and CBI instructions. In these registers, the value of single bits can be checked by using the SBIS and SBIC instructions. 3. Some of the Status Flags are cleared by writing a logical one to them. Note that, unlike most other AVRs, the CBI and SBI instructions will only operation the specified bit, and can therefore be used on registers containing such Status Flags. The CBI and SBI instructions work with registers 0x00 to 0x1F only. ATtiny828 [DATASHEET] 8371A-AVR-08/12 300 27. Instruction Set Summary Mnemonics Operands Description Operation Flags #Clocks ARITHMETIC AND LOGIC INSTRUCTIONS ADD Rd, Rr Add two Registers Rd Rd + Rr Z,C,N,V,H ADC Rd, Rr Add with Carry two Registers Rd Rd + Rr + C Z,C,N,V,H 1 ADIW Rdl,K Add Immediate to Word Rdh:Rdl Rdh:Rdl + K Z,C,N,V,S 2 SUB Rd, Rr Subtract two Registers Rd Rd - Rr Z,C,N,V,H 1 SUBI Rd, K Subtract Constant from Register Rd Rd - K Z,C,N,V,H 1 SBC Rd, Rr Subtract with Carry two Registers Rd Rd - Rr - C Z,C,N,V,H 1 1 SBCI Rd, K Subtract with Carry Constant from Reg. Rd Rd - K - C Z,C,N,V,H 1 SBIW Rdl,K Subtract Immediate from Word Rdh:Rdl Rdh:Rdl - K Z,C,N,V,S 2 1 AND Rd, Rr Logical AND Registers Rd Rd * Rr Z,N,V ANDI Rd, K Logical AND Register and Constant Rd Rd * K Z,N,V 1 OR Rd, Rr Logical OR Registers Rd Rd v Rr Z,N,V 1 ORI Rd, K Logical OR Register and Constant Rd Rd v K Z,N,V 1 EOR Rd, Rr Exclusive OR Registers Rd Rd Rr Z,N,V 1 COM Rd One's Complement Rd 0xFF - Rd Z,C,N,V 1 NEG Rd Two's Complement Rd 0x00 - Rd Z,C,N,V,H 1 SBR Rd,K Set Bit(s) in Register Rd Rd v K Z,N,V 1 CBR Rd,K Clear Bit(s) in Register Rd Rd * (0xFF - K) Z,N,V 1 INC Rd Increment Rd Rd + 1 Z,N,V 1 DEC Rd Decrement Rd Rd - 1 Z,N,V 1 TST Rd Test for Zero or Minus Rd Rd * Rd Z,N,V 1 CLR Rd Clear Register Rd Rd Rd Z,N,V 1 SER Rd Set Register Rd 0xFF None 1 Relative Jump PC PC + k + 1 None 2 Indirect Jump to (Z) PC Z None 2 Relative Subroutine Call PC PC + k + 1 None 3 BRANCH INSTRUCTIONS RJMP k IJMP RCALL k ICALL Indirect Call to (Z) PC Z None 3 RET Subroutine Return PC STACK None 4 RETI Interrupt Return PC STACK I if (Rd = Rr) PC PC + 2 or 3 None 4 CPSE Rd,Rr Compare, Skip if Equal 1/2/3 CP Rd,Rr Compare Rd - Rr Z, N,V,C,H 1 CPC Rd,Rr Compare with Carry Rd - Rr - C Z, N,V,C,H 1 CPI Rd,K Compare Register with Immediate Rd - K Z, N,V,C,H SBRC Rr, b Skip if Bit in Register Cleared if (Rr(b)=0) PC PC + 2 or 3 None 1/2/3 1 SBRS Rr, b Skip if Bit in Register is Set if (Rr(b)=1) PC PC + 2 or 3 None 1/2/3 SBIC P, b Skip if Bit in I/O Register Cleared if (P(b)=0) PC PC + 2 or 3 None 1/2/3 SBIS P, b Skip if Bit in I/O Register is Set if (P(b)=1) PC PC + 2 or 3 None 1/2/3 BRBS s, k Branch if Status Flag Set if (SREG(s) = 1) then PCPC+k + 1 None 1/2 BRBC s, k Branch if Status Flag Cleared if (SREG(s) = 0) then PCPC+k + 1 None 1/2 BREQ k Branch if Equal if (Z = 1) then PC PC + k + 1 None 1/2 BRNE k Branch if Not Equal if (Z = 0) then PC PC + k + 1 None 1/2 BRCS k Branch if Carry Set if (C = 1) then PC PC + k + 1 None 1/2 BRCC k Branch if Carry Cleared if (C = 0) then PC PC + k + 1 None 1/2 BRSH k Branch if Same or Higher if (C = 0) then PC PC + k + 1 None 1/2 BRLO k Branch if Lower if (C = 1) then PC PC + k + 1 None 1/2 BRMI k Branch if Minus if (N = 1) then PC PC + k + 1 None 1/2 BRPL k Branch if Plus if (N = 0) then PC PC + k + 1 None 1/2 BRGE k Branch if Greater or Equal, Signed if (N V= 0) then PC PC + k + 1 None 1/2 BRLT k Branch if Less Than Zero, Signed if (N V= 1) then PC PC + k + 1 None 1/2 BRHS k Branch if Half Carry Flag Set if (H = 1) then PC PC + k + 1 None 1/2 BRHC k Branch if Half Carry Flag Cleared if (H = 0) then PC PC + k + 1 None 1/2 BRTS k Branch if T Flag Set if (T = 1) then PC PC + k + 1 None 1/2 BRTC k Branch if T Flag Cleared if (T = 0) then PC PC + k + 1 None 1/2 BRVS k Branch if Overflow Flag is Set if (V = 1) then PC PC + k + 1 None 1/2 BRVC k Branch if Overflow Flag is Cleared if (V = 0) then PC PC + k + 1 None 1/2 BRIE k Branch if Interrupt Enabled if ( I = 1) then PC PC + k + 1 None 1/2 BRID k Branch if Interrupt Disabled if ( I = 0) then PC PC + k + 1 None 1/2 BIT AND BIT-TEST INSTRUCTIONS SBI P,b Set Bit in I/O Register I/O(P,b) 1 None 2 CBI P,b Clear Bit in I/O Register I/O(P,b) 0 None 2 LSL Rd Logical Shift Left Rd(n+1) Rd(n), Rd(0) 0 Z,C,N,V 1 LSR Rd Logical Shift Right Rd(n) Rd(n+1), Rd(7) 0 Z,C,N,V 1 ROL Rd Rotate Left Through Carry Rd(0)C,Rd(n+1) Rd(n),CRd(7) Z,C,N,V 1 ROR Rd Rotate Right Through Carry Rd(7)C,Rd(n) Rd(n+1),CRd(0) Z,C,N,V 1 ATtiny828 [DATASHEET] 8371A-AVR-08/12 301 Mnemonics Operands Description Operation Flags #Clocks ASR Rd Arithmetic Shift Right Rd(n) Rd(n+1), n=0..6 Z,C,N,V 1 SWAP Rd Swap Nibbles Rd(3..0)Rd(7..4),Rd(7..4)Rd(3..0) None 1 BSET s Flag Set SREG(s) 1 SREG(s) 1 BCLR s Flag Clear SREG(s) 0 SREG(s) 1 BST Rr, b Bit Store from Register to T T Rr(b) T 1 BLD Rd, b Bit load from T to Register Rd(b) T None 1 1 SEC Set Carry C1 C CLC Clear Carry C0 C 1 SEN Set Negative Flag N1 N 1 CLN Clear Negative Flag N0 N 1 SEZ Set Zero Flag Z1 Z 1 CLZ Clear Zero Flag Z0 Z 1 SEI Global Interrupt Enable I1 I 1 CLI Global Interrupt Disable I0 I 1 1 SES Set Signed Test Flag S1 S CLS Clear Signed Test Flag S0 S 1 SEV Set Twos Complement Overflow. V1 V 1 CLV Clear Twos Complement Overflow V0 V 1 SET Set T in SREG T1 T 1 CLT Clear T in SREG T0 T 1 SEH CLH Set Half Carry Flag in SREG Clear Half Carry Flag in SREG H1 H0 H H 1 1 Rd Rr Rd+1:Rd Rr+1:Rr None 1 None 1 DATA TRANSFER INSTRUCTIONS MOV Rd, Rr Move Between Registers MOVW Rd, Rr Copy Register Word LDI Rd, K Load Immediate Rd K None 1 LD Rd, X Load Indirect Rd (X) None 2 LD Rd, X+ Load Indirect and Post-Inc. Rd (X), X X + 1 None 2 LD Rd, - X Load Indirect and Pre-Dec. X X - 1, Rd (X) None 2 LD Rd, Y Load Indirect Rd (Y) None 2 LD Rd, Y+ Load Indirect and Post-Inc. Rd (Y), Y Y + 1 None 2 LD Rd, - Y Load Indirect and Pre-Dec. Y Y - 1, Rd (Y) None 2 LDD Rd,Y+q Load Indirect with Displacement Rd (Y + q) None 2 LD Rd, Z Load Indirect Rd (Z) None 2 LD Rd, Z+ Load Indirect and Post-Inc. Rd (Z), Z Z+1 None 2 LD Rd, -Z Load Indirect and Pre-Dec. Z Z - 1, Rd (Z) None 2 LDD Rd, Z+q Load Indirect with Displacement Rd (Z + q) None 2 2 LDS Rd, k Load Direct from SRAM Rd (k) None ST X, Rr Store Indirect (X) Rr None 2 ST X+, Rr Store Indirect and Post-Inc. (X) Rr, X X + 1 None 2 ST - X, Rr Store Indirect and Pre-Dec. X X - 1, (X) Rr None 2 ST Y, Rr Store Indirect (Y) Rr None 2 ST Y+, Rr Store Indirect and Post-Inc. (Y) Rr, Y Y + 1 None 2 ST - Y, Rr Store Indirect and Pre-Dec. Y Y - 1, (Y) Rr None 2 STD Y+q,Rr Store Indirect with Displacement (Y + q) Rr None 2 ST Z, Rr Store Indirect (Z) Rr None 2 ST Z+, Rr Store Indirect and Post-Inc. (Z) Rr, Z Z + 1 None 2 ST -Z, Rr Store Indirect and Pre-Dec. Z Z - 1, (Z) Rr None 2 STD Z+q,Rr Store Indirect with Displacement (Z + q) Rr None 2 STS k, Rr Store Direct to SRAM (k) Rr None 2 Load Program Memory R0 (Z) None 3 LPM LPM Rd, Z Load Program Memory Rd (Z) None 3 LPM Rd, Z+ Load Program Memory and Post-Inc Rd (Z), Z Z+1 None 3 Store Program Memory (Z) R1:R0 None - In Port Rd P None 1 SPM IN Rd, P OUT P, Rr Out Port P Rr None 1 PUSH Rr Push Register on Stack STACK Rr None 2 POP Rd Pop Register from Stack Rd STACK None 2 MCU CONTROL INSTRUCTIONS NOP No Operation None 1 SLEEP Sleep (see specific descr. for Sleep function) None 1 WDR BREAK Watchdog Reset Break (see specific descr. for WDR/timer) For On-chip Debug Only None None 1 N/A ATtiny828 [DATASHEET] 8371A-AVR-08/12 302 28. Ordering Information 28.1 ATtiny828 Speed (MHz) (1) Supply Voltage (V) (1) Temperature Range Package (2) Accuracy (3) Ordering Code (4) 10% ATtiny828-AU 2% ATtiny828R-AU 10% ATtiny828-AUR 2% ATtiny828R-AUR 10% ATtiny828-MU 2% ATtiny828R-MU 10% ATtiny828-MUR 2% ATtiny828R-MUR 32A 20 MHz 1.7 - 5.5V Industrial (5) (-40C to +85C) 32M1-A Notes: 1. For speed vs. supply voltage, see section "Speed" on page 249. 2. All packages are Pb-free, halide-free and fully green and they comply with the European directive for Restriction of Hazardous Substances (RoHS). 3. Indicates accuracy of internal oscillator. See "Accuracy of Calibrated Internal Oscillator" on page 249. 4. Code indicators: z U: matte tin z R: tape & reel 5. These devices can also be supplied in wafer form. Please contact your local Atmel sales office for detailed ordering information and minimum quantities. Package Type 32A 32-lead, Thin (1.0 mm) Plastic Quad Flat Package (TQFP) 32M1-A 32-pad, 5 x 5 x 1.0 body, Lead Pitch 0.50 mm, Quad Flat No-Lead (QFN) ATtiny828 [DATASHEET] 8371A-AVR-08/12 303 29. Packaging Information 29.1 32A PIN 1 IDENTIFIER PIN 1 e B E1 E D1 D C 0~7 A1 A2 A L COMMON DIMENSIONS (Unit of measure = mm) SYMBOL Notes: 1. This package conforms to JEDEC reference MS-026, Variation ABA. 2. Dimensions D1 and E1 do not include mold protrusion. Allowable protrusion is 0.25mm per side. Dimensions D1 and E1 are maximum plastic body size dimensions including mold mismatch. 3. Lead coplanarity is 0.10mm maximum. MIN NOM MAX A - - 1.20 A1 0.05 - 0.15 A2 0.95 1.00 1.05 D 8.75 9.00 9.25 D1 6.90 7.00 7.10 E 8.75 9.00 9.25 E1 6.90 7.00 7.10 B 0.30 - 0.45 C 0.09 - 0.20 L 0.45 - 0.75 e NOTE Note 2 Note 2 0.80 TYP 2010-10-20 R 2325 Orchard Parkway San Jose, CA 95131 TITLE 32A, 32-lead, 7 x 7mm body size, 1.0mm body thickness, 0.8mm lead pitch, thin profile plastic quad flat package (TQFP) DRAWING NO. REV. 32A C ATtiny828 [DATASHEET] 8371A-AVR-08/12 304 29.2 32M1-A D D1 1 2 3 0 Pin 1 ID E1 SIDE VIEW E TOP VIEW A3 A2 A1 A K 0.08 C P D2 1 2 3 P Pin #1 Notch (0.20 R) K e SYMBOL MIN NOM MAX A 0.80 0.90 1.00 A1 - 0.02 0.05 A2 - 0.65 1.00 A3 E2 b COMMON DIMENSIONS (Unit of Measure = mm) L BOTTOM VIEW 0.20 REF b 0.18 0.23 0.30 D 4.90 5.00 5.10 D1 4.70 4.75 4.80 D2 2.95 3.10 3.25 E 4.90 5.00 5.10 E1 4.70 4.75 4.80 E2 2.95 3.10 3.25 e Note: JEDEC Standard MO-220, Fig. 2 (Anvil Singulation), VHHD-2. NOTE 0.50 BSC L 0.30 0.40 0.50 P - - 0.60 12o 0 - K 0.20 - - - 5/25/06 R 2325 Orchard Parkway San Jose, CA 95131 TITLE 32M1-A, 32-pad, 5 x 5 x 1.0mm Body, Lead Pitch 0.50mm, 3.10mm Exposed Pad, Micro Lead Frame Package (MLF) DRAWING NO. 32M1-A ATtiny828 [DATASHEET] 8371A-AVR-08/12 REV. E 305 30. Errata The revision letters in this section refer to the revision of the corresponding ATtiny828 device. 30.1 Rev. A z Port Pin Restrictions When ULP Oscillator Is Disabled 1. Port Pin Restrictions When ULP Oscillator Is Disabled Port pin PD3 is not guaranteed to perform as a reliable input when the Ultra Low Power (ULP) oscillator is not running. In addition, the pin is pulled down internally when ULP oscillator is disabled. TWI and SPI use may be limited when ULP is not running since pin PD3 is used by SCL and SCK signals. Problem Fix / Workaround The ULP oscillator is automatically activated when required. To use PD3 as an input or clock signal of TWI/SPI, activate the watchdog timer. The watchdog timer automatically enables the ULP oscillator. ATtiny828 [DATASHEET] 8371A-AVR-08/12 306 31. Revision History Doc. Rev. Date 8371A 08/2012 Comments Initial document release. ATtiny828 [DATASHEET] 8371A-AVR-08/12 307 ATtiny828 [DATASHEET] 8371A-AVR-08/12 308 Table of Contents Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1. Pin Configurations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 1.1 Pin Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 2. Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 3. General Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 3.1 3.2 3.3 Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Code Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Data Retention . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 4. CPU Core . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 4.1 4.2 4.3 4.4 4.5 4.6 4.7 4.8 Architectural Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 ALU - Arithmetic Logic Unit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 Status Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 General Purpose Register File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 Stack Pointer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 Instruction Execution Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 Reset and Interrupt Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 Register Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 5. Memories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 5.1 5.2 5.3 5.4 Program Memory (Flash) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Data Memory (SRAM) and Register Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . Data Memory (EEPROM) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Register Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 17 19 23 6. Clock System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 6.1 6.2 6.3 6.4 6.5 6.6 Clock Subsystems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Clock Sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . System Clock Prescaler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Clock Output Buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Start-Up Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Register Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 28 30 30 30 31 7. Power Management and Sleep Modes . . . . . . . . . . . . . . . . . . . . . . 34 7.1 7.2 7.3 7.4 Sleep Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Power Reduction Register. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Minimizing Power Consumption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Register Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 35 35 37 8. System Control and Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 8.1 8.2 8.3 8.4 8.5 Resetting the AVR. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Reset Sources. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Internal Voltage Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Watchdog Timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Register Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 39 43 43 45 9. Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 9.1 Interrupt Vectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 ATtiny828 [DATASHEET] 8371A-AVR-08/12 1 9.2 9.3 External Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 Register Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 10. I/O Ports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 10.1 10.2 10.3 10.4 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 Ports as General Digital I/O. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 Alternative Port Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 Register Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 11. 8-bit Timer/Counter0 with PWM . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 11.1 11.2 11.3 11.4 11.5 11.6 11.7 11.8 11.9 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 Clock Sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 Counter Unit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 Output Compare Unit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 Compare Match Output Unit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 Modes of Operation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 Timer/Counter Timing Diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 Register Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 12. 16-bit Timer/Counter1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104 12.1 12.2 12.3 12.4 12.5 12.6 12.7 12.8 12.9 12.10 12.11 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104 Timer/Counter Clock Sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 Counter Unit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106 Input Capture Unit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106 Output Compare Units. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108 Compare Match Output Unit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110 Modes of Operation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111 Timer/Counter Timing Diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118 Accessing 16-bit Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120 Register Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 13. Timer/Counter Prescaler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131 13.1 13.2 13.3 Prescaler Reset. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131 External Clock Source. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131 Register Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132 14. Analog Comparator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133 14.1 Register Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134 15. Analog to Digital Converter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137 15.1 15.2 15.3 15.4 15.5 15.6 15.7 15.8 15.9 15.10 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137 Operation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138 Starting a Conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139 Prescaling and Conversion Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140 Changing Channel or Reference Selection . . . . . . . . . . . . . . . . . . . . . . . . . . 143 ADC Noise Canceler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144 Analog Input Circuitry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144 Noise Canceling Techniques. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145 ADC Accuracy Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145 ATtiny828 [DATASHEET] 8371A-AVR-08/12 2 15.11 ADC Conversion Result . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148 15.12 Temperature Measurement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148 15.13 Register Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149 16. SPI - Serial Peripheral Interface . . . . . . . . . . . . . . . . . . . . . . . . . . 155 16.1 16.2 16.3 16.4 16.5 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155 SS Pin Functionality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159 Data Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160 Register Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161 17. USART . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164 17.1 17.2 17.3 17.4 17.5 17.6 17.7 17.8 17.9 17.10 17.11 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164 Clock Generation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165 Frame Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168 USART Initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169 Data Transmission - The USART Transmitter . . . . . . . . . . . . . . . . . . . . . . . 170 Data Reception - The USART Receiver . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173 Asynchronous Data Reception . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177 Multi-processor Communication Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180 Examples of Baud Rate Setting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180 Register Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184 18. USART in SPI Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190 18.1 18.2 18.3 18.4 18.5 18.6 18.7 18.8 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190 Clock Generation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190 SPI Data Modes and Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191 Frame Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191 Data Transfer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193 AVR USART MSPIM vs. AVR SPI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195 Register Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195 19. I2C Compatible, Two-Wire Slave Interface . . . . . . . . . . . . . . . . . . 199 19.1 19.2 19.3 19.4 19.5 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199 General TWI Bus Concepts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199 TWI Slave Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205 Register Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207 20. debugWIRE On-chip Debug System . . . . . . . . . . . . . . . . . . . . . . . 212 20.1 20.2 20.3 20.4 20.5 20.6 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212 Physical Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212 Software Break Points . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213 Limitations of debugWIRE. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213 Register Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213 21. Self-Programming with Boot Loader and Read-While-Write . . . . . 214 21.1 21.2 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214 ATtiny828 [DATASHEET] 8371A-AVR-08/12 3 21.3 21.4 21.5 21.6 21.7 21.8 21.9 21.10 21.11 Application and Boot Loader Flash Sections. . . . . . . . . . . . . . . . . . . . . . . . . 214 Read-While-Write and No Read-While-Write Flash Sections . . . . . . . . . . . . 214 Entering the Boot Loader Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216 Configuring the Boot Loader . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216 Boot Loader Lock Bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218 Self-Programming the Flash . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218 Preventing Flash Corruption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222 Programming Time for Flash when Using SPM . . . . . . . . . . . . . . . . . . . . . . 223 Register Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223 22. Lock Bits, Fuse Bits and Device Signature . . . . . . . . . . . . . . . . . . 225 22.1 22.2 22.3 22.4 Lock Bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225 Fuse Bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226 Device Signature Imprint Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228 Reading Lock, Fuse and Signature Data from Software . . . . . . . . . . . . . . . . 229 23. External Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232 23.1 23.2 23.3 23.4 Memory Parametrics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Parallel Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Serial Programming. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Programming Time for Flash and EEPROM . . . . . . . . . . . . . . . . . . . . . . . . . 232 232 241 245 24. Electrical Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247 24.1 24.2 24.3 24.4 24.5 24.6 24.7 24.8 24.9 24.10 24.11 Absolute Maximum Ratings* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247 DC Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247 Speed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249 Clock Characteristics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249 System and Reset Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250 Temperature Sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251 Two-Wire Serial Interface Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . 252 ADC Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253 Analog Comparator Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254 Parallel Programming Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254 Serial Programming Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257 25. Typical Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258 25.1 25.2 25.3 25.4 25.5 25.6 25.7 25.8 25.9 25.10 25.11 25.12 25.13 25.14 Current Consumption in Active Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258 Current Consumption in Idle Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261 Current Consumption in Power-down Mode . . . . . . . . . . . . . . . . . . . . . . . . . 263 Current Consumption in Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264 Current Consumption of Peripheral Units . . . . . . . . . . . . . . . . . . . . . . . . . . . 266 Pull-up Resistors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268 Input Thresholds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271 Current Source Strength . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277 Current Sink Capability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280 BOD. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286 Bandgap Voltage. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289 Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290 Analog Comparator Offset. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291 Internal Oscillator Speed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293 26. Register Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297 ATtiny828 [DATASHEET] 8371A-AVR-08/12 4 27. Instruction Set Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301 28. Ordering Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303 28.1 ATtiny828 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303 29. Packaging Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 304 29.1 29.2 32A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 304 32M1-A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305 30. Errata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306 30.1 Rev. A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306 31. Revision History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307 ATtiny828 [DATASHEET] 8371A-AVR-08/12 5 Atmel Corporation 1600 Technology Drive Atmel Asia Limited Unit 01-5 & 16, 19F Atmel Munich GmbH Business Campus Atmel Japan G.K. 16F Shin-Osaki Kangyo Bldg San Jose, CA 95110 BEA Tower, Millennium City 5 Parkring 4 1-6-4 Osaki, Shinagawa-ku USA 418 Kwun Tong Roa D-85748 Garching b. Munich Tokyo 141-0032 Tel: (+1) (408) 441-0311 Kwun Tong, Kowloon GERMANY JAPAN Fax: (+1) (408) 487-2600 HONG KONG Tel: (+49) 89-31970-0 Tel: (+81) (3) 6417-0300 www.atmel.com Tel: (+852) 2245-6100 Fax: (+49) 89-3194621 Fax: (+81) (3) 6417-0370 Fax: (+852) 2722-1369 (c) 2012 Atmel Corporation. All rights reserved. / Rev.: 8371A-AVR-08/12 Disclaimer: The information in this document is provided in connection with Atmel products. No license, express or implied, by estoppel or otherwise, to any intellectual property right is granted by this document or in connection with the sale of Atmel products. EXCEPT AS SET FORTH IN THE ATMEL TERMS AND CONDITIONS OF SALES LOCATED ON THE ATMEL WEBSITE, ATMEL ASSUMES NO LIABILITY WHATSOEVER AND DISCLAIMS ANY EXPRESS, IMPLIED OR STATUTORY WARRANTY RELATING TO ITS PRODUCTS INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, CONSEQUENTIAL, PUNITIVE, SPECIAL OR INCIDENTAL DAMAGES (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS AND PROFITS, BUSINESS INTERRUPTION, OR LOSS OF INFORMATION) ARISING OUT OF THE USE OR INABILITY TO USE THIS DOCUMENT, EVEN IF ATMEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. Atmel makes no representations or warranties with respect to the accuracy or completeness of the contents of this document and reserves the right to make changes to specifications and products descriptions at any time without notice. Atmel does not make any commitment to update the information contained herein. Unless specifically provided otherwise, Atmel products are not suitable for, and shall not be used in, automotive applications. Atmel products are not intended, authorized, or warranted for use as components in applications intended to support or sustain life. Mouser Electronics Authorized Distributor Click to View Pricing, Inventory, Delivery & Lifecycle Information: Atmel: ATTINY828-AU ATTINY828R-AU