The ATtiny1624/1626/1627 microcontrollers of the tinyAVR® 2 family are using the AVR® CPU with hardware
multiplier, running at up to 20 MHz, with 16 KB Flash, 2 KB of SRAM, and 256B of EEPROM available in a 14-, 20-,
and 24-pin package. The family uses the latest technologies from Microchip with a flexible and low-power
architecture, including Event System, advanced digital peripherals, and accurate analog features such as a 12-bit
differential ADC with Programmable Gain Amplifier (PGA).
tinyAVR® 2 Family Overview
The figure below shows the tinyAVR® 2 family devices, laying out pin count variants and memory sizes.
• Vertical migration is possible without code modification, as these devices are fully pin and feature compatible
• Horizontal migration to the left reduces the pin count and, therefore, the available features
Figure 1. tinyAVR® 2 Family Overview
Devices with different flash memory sizes typically also have different SRAM and EEPROM.
The name of a device in the tinyAVR® 2 family is decoded as follows:
Note: Tape and Reel identifier only appears in the catalog part number description. This identifier is used for
ordering purposes. Check with your Microchip Sales Office for package availability with the Tape and Reel option.
Note: The VAO variants have been designed, manufactured, tested, and qualified in accordance with AEC-Q100
requirements for automotive applications. These products may use a different package than non-VAO parts and can
have additional specifications in their Electrical Characteristics.
Memory Overview
The following table shows the memory overview of the entire family, but further documentation describes only the
ATtiny1624/1626/1627 devices.
Analog Comparators (inputs)1 (4p/3n)1 (4p/3n)1 (4p/3n)
Peripheral Touch Controller (PTC) (self cap/mutual cap
channels)
Unified Program and Debug Interface (UPDI) activated by
shared pin using high-voltage signal or fuse override
---
111
Features
• High-Performance Low-Power AVR® CPU
– Running at up to 20 MHz
– Single-cycle I/O access
– Two-level interrupt controller with vectored interrupts
– Two-cycle hardware multiplier
– Supply voltage range: 1.8V to 5.5V
• Memories
– 16 KB In-System self-programmable Flash memory
– 2 KB SRAM
– 256B EEPROM
– 32B of user row in nonvolatile memory that can keep data during chip-erase and be programmed while the
• Idle with all peripherals running and immediate wake-up time
• Standby with configurable operation of selected peripherals
• Power-Down with full data retention
• Peripherals
– One 16-bit Timer/Counter type A (TCA) with a dedicated period register and three PWM channels
– Two 16-bit Timer/Counter type B (TCB) with input capture and simple PWM functionality
– One 16-bit Real-Time Counter (RTC) running from external 32.768 kHz crystal or internal 32.768 kHz ULP
oscillator
– Two Universal Synchronous Asynchronous Receiver Transmitter (USART) with fractional baud rate
generator, auto-baud, and start-of-frame detection
– Master/Slave Serial Peripheral Interface (SPI)
– Master/Slave Two-Wire Interface (TWI) with dual address match
• Standard mode (Sm, 100 kHz)
• Fast mode (Fm, 400 kHz)
• Fast mode plus (Fm+, 1 MHz)
– Event System for CPU independent and predictable inter-peripheral signaling
– Configurable Custom Logic (CCL) with four programmable Look-Up Tables (LUT)
– One Analog Comparator (AC) with scalable reference input
– One 12-bit differential 375 ksps Analog-to-Digital Converter (ADC) with Programmable Gain Amplifier
(PGA) and up to 15 input channels
– Multiple internal voltage references
• 1.024V
• 2.048V
• 2.500V
• 4.096V
• VDD
– Automated Cyclic Redundancy Check (CRC) flash memory scan
– Watchdog Timer (WDT) with Window Mode, with a separate on-chip oscillator
– External interrupt on all general purpose pins
• I/O and Packages
– Up to 22 programmable I/O pins
– 14-pin
• SOIC
• TSSOP
– 20-pin
• SOIC
• SSOP
• VQFN 3x3 mm
– 24-pin
• VQFN 4x4 mm
• Temperature Ranges
– -40°C to 85°C (standard)
– -40°C to 125°C (extended)
The Microchip Website...............................................................................................................................519
1.Pin names are of type Pxn with x being the PORT instance (A, B) and n the pin number. Notation for signals is
PORTx_PINn.
2.All pins can be used for external interrupt where pins Px2 and Px6 of each port have full asynchronous
detection. All pins can be used as event input.
3.AIN[15:8] can not be used as negative ADC input for differential measurements.
4.Alternative pin location. For selecting an alternative pin location, refer to the PORTMUX section.
This section contains guidelines for designing or reviewing electrical schematics using AVR 8-bit microcontrollers.
The information presented here is a brief overview of the most common topics. More detailed information can be
found in application notes, listed in this section where applicable.
This section covers the following topics:
• General guidelines
• Connection for power supply
• Connection for
• Connection for UPDI (Unified Program and Debug Interface)
• Connection for external crystal oscillators
• Connection for VREF (external voltage reference)
4.1 General Guidelines
Unused pins must be soldered to their respective soldering pads. The soldering pads must not be connected to the
circuit.
The PORT pins are in their default state after Reset. Follow the recommendations in the PORT section to reduce
power consumption.
All values are given as typical values and serve only as a starting point for circuit design.
Refer to the following application notes for further information:
• AVR040 - EMC Design Considerations
• AVR042 - AVR Hardware Design Considerations
RESET
ATtiny1624/1626/1627
Hardware Guidelines
4.1.1 Special Consideration for Packages with Center Pad
Flat packages often come with an exposed pad located on the bottom, often referred to as the center pad or the
thermal pad. This pad is not electrically connected to the internal circuit of the chip, but it is mechanically bonded to
the internal substrate and serves as a thermal heat sink as well as providing added mechanical stability. This pad
must be connected to GND since the ground plane is the best heat sink (largest copper area) of the printed circuit
board (PCB).
4.2 Connection for Power Supply
The basics and details regarding the design of the power supply itself lie beyond the scope of these guidelines. For
more detailed information about this subject, see the application notes mentioned at the beginning of this section.
A decoupling capacitor must be placed close to the microcontroller for each supply pin pair (VDD, AVDD, or other
power supply pin and its corresponding GND pin). If the decoupling capacitor is placed too far from the
microcontroller, a high-current loop might form that will result in increased noise and increased radiated emission.
Each supply pin pair (power input pin and ground pin) must have separate decoupling capacitors.
It is recommended to place the decoupling capacitor on the same side of the PCB as the microcontroller. If space
does not allow it, the decoupling capacitor may be placed on the other side through a via, but make sure the distance
to the supply pin is kept as short as possible.
If the board is experiencing high-frequency noise (upward of tens of MHz), add a second ceramic type capacitor in
parallel to the decoupling capacitor described above. Place this second capacitor next to the primary decoupling
capacitor.
On the board layout from the power supply circuit, run the power and return traces to the decoupling capacitors first,
and then to the device pins. This ensures that the decoupling capacitors are first in the power chain. Equally
important is to keep the trace length between the capacitor and the power pins to a minimum, thereby reducing PCB
trace inductance.
For larger pin count package types, there are several VDD and corresponding GND pins. All the VDD pins in the
microcontroller are internally connected. The same voltage must be applied to each of the VDD pins.
The following figure shows the recommendation for connecting a power supply to the VDD pin(s) of the device.
A resistor in series with the switch can safely discharge the filtering capacitor. This prevents a current surge when
shorting the filtering capacitor, as this may cause a noise spike that can harm the system.
The standard connection for UPDI programming is a 100-mil 6-pin 2x3 header. Even though three pins are sufficient
for programming most AVR devices, it is recommended to use a 2x3 header since most programming tools are
delivered with 100-mil 6-pin 2x3 connectors.
The following figure shows the recommendation for connecting a UPDI connector to the device.
The decoupling capacitor between VDD and GND must be placed as close to the pin pair as possible. The
decoupling capacitor must be included even if the UPDI connector is not included in the circuit.
4.5 Connecting External Crystal Oscillators
The use of external oscillators and the design of oscillator circuits are not trivial. This is because there are many
variables: VDD, operating temperature range, crystal type and manufacture, loading capacitors, circuit layout, and
PCB material. Presented here are some typical guidelines to help with the basic oscillator circuit design.
• Even the best performing oscillator circuits and high-quality crystals will not perform well if the layout and
materials used during the assembly are not carefully considered
• The crystal circuit must be placed on the same side of the board as the device. Place the crystal circuit as close
to the respective oscillator pins as possible and avoid long traces. This will reduce parasitic capacitance and
increase immunity against noise and crosstalk. The load capacitors must be placed next to the crystal itself, on
the same side of the board. Any kind of sockets must be avoided.
• Place a grounded copper area around the crystal circuit to isolate it from surrounding circuits. If the circuit board
has two sides, the copper area on the bottom layer must be a solid area covering the crystal circuit. The copper
area on the top layer must surround the crystal circuit and tie to the bottom layer area using via(s).
• Do not run any signal traces or power traces inside the grounded copper area. Avoid routing digital lines,
especially clock lines, close to the crystal lines.
• If using a two-sided PCB, avoid any traces beneath the crystal. For a multilayer PCB, avoid routing signals
below the crystal lines.
• Dust and humidity will increase parasitic capacitance and reduce signal isolation. A protective coating is
recommended.
• Successful oscillator design requires good specifications of operating conditions, a component selection phase
with initial testing, and testing in actual operating conditions to ensure that the oscillator performs as desired
For more detailed information about oscillators and oscillator circuit design, read the following application notes:
• AN2648 - Selecting and Testing 32 KHz Crystal Oscillators for AVR® Microcontrollers
4.5.1 Connection for XOSC32K (External 32.768 kHz Crystal Oscillator)
Ultra low-power 32.768 kHz oscillators typically dissipate significantly below 1 μW, and the current flowing in the
circuit is, therefore, extremely small. The crystal frequency is highly dependent on the capacitive load.
The following figure shows how to connect an external 32.768 kHz crystal oscillator.
If the design includes the use of an external voltage reference, the general recommendation is to use a suitable
capacitor connected in parallel with the reference. The value of the capacitor depends on the nature of the reference
and the type of electrical noise that needs to be filtered out.
Additional filtering components may be needed. This depends on the type of external voltage reference used.
Figure 4-5. Recommended External Voltage Reference Connection
R/WRead/Write accessible register bit. The user can read from and write to this bit.
RRead-only accessible register bit. The user can only read this bit. Writes will be ignored.
WWrite-only accessible register bit. The user can only write this bit. Reading this bit will return an
undefined value.
BITFIELDBitfield names are shown in uppercase. Example: INTMODE.
BITFIELD[n:m]A set of bits from bit n down to m. Example: PINA[3:0] = {PINA3, PINA2, PINA1, PINA0}.
ReservedReserved bits, bit fields, and bit field values are unused and reserved for future use. For
compatibility with future devices, always write reserved bits to ‘0’ when the register is written.
Reserved bits will always return zero when read.
PERIPHERALnIf several instances of the peripheral exist, the peripheral name is followed by a single number to
identify one instance. Example: USARTn is the collection of all instances of the USART module,
while USART3 is one specific instance of the USART module.
ATtiny1624/1626/1627
Conventions
PERIPHERALxIf several instances of the peripheral exist, the peripheral name is followed by a single capital
letter (A-Z) to identify one instance. Example: PORTx is the collection of all instances of the
PORT module, while PORTB is one specific instance of the PORT module.
ResetValue of a register after a Power-on Reset. This is also the value of registers in a peripheral after
performing a software Reset of the peripheral, except for the Debug Control registers.
SET/CLR/TGLRegisters with SET/CLR/TGL suffix allow the user to clear and set bits in a register without doing
a read-modify-write operation.
Each SET/CLR/TGL register is paired with the register it is affecting. Both registers in a register
pair return the same value when read.
Example: In the PORT peripheral, the OUT and OUTSET registers form such a register pair. The
contents of OUT will be modified by a write to OUTSET. Reading OUT and OUTSET will return
the same value.
Writing a ‘1’ to a bit in the CLR register will clear the corresponding bit in both registers.
Writing a ‘1’ to a bit in the SET register will set the corresponding bit in both registers.
Writing a ‘1’ to a bit in the TGL register will toggle the corresponding bit in both registers.
5.4.1 Addressing Registers from Header Files
In order to address registers in the supplied C header files, the following rules apply:
1.A register is identified by <peripheral_instance_name>.<register_name>, e.g., CPU.SREG, USART2.CTRLA,
or PORTB.DIR.
2.The peripheral name is given in the “Peripheral Address Map” in the “Peripherals and Architecture” section.
3.<peripheral_instance_name> is obtained by substituting any n or x in the peripheral name with the correct
instance identifier.
4.When assigning a predefined value to a peripheral register, the value is constructed following the rule:
<peripheral_name>_<bit_field_name>_<bit_field_value>_gc
<peripheral_name> is <peripheral_instance_name>, but remove any instance identifier.
<bit_field_value> can be found in the “Name” column in the tables in the Register Description sections
describing the bit fields of the peripheral registers.
Note: For peripherals with different register sets in different modes, <peripheral_instance_name> and
<peripheral_name> must be followed by a mode name, for example:
// TCA0 in Normal Mode (SINGLE) uses waveform generator in frequency mode
TCA0.SINGLE.CTRL=TCA_SINGLE_WGMODE_FRQ_gc;
5.5 ADC Parameter Definitions
An ideal n-bit single-ended ADC converts a voltage linearly between GND and V
code is read as ‘0’, and the highest code is read as ‘2n-1’. Several parameters describe the deviation from the ideal
behavior:
Offset ErrorThe deviation of the first transition (0x000 to 0x001) compared to the ideal transition (at 0.5
LSb). Ideal value: 0 LSb.
Figure 5-1. Offset Error
ATtiny1624/1626/1627
Conventions
in 2n steps (LSb). The lowest
REF
Gain ErrorAfter adjusting for offset, the gain error is found as the deviation of the last transition (e.g.,
0x3FE to 0x3FF for a 10-bit ADC) compared to the ideal transition (at 1.5 LSb below
maximum). Ideal value: 0 LSb.
DS40002234A-page 24
Preliminary Datasheet
Figure 5-2. Gain Error
V
REF
Input Voltage
Ideal ADC
Actual ADC
Gain
Error
V
Input Voltage
Ideal ADC
Actual ADC
INL
0x3FF
0x000
0
V
Input Voltage
DNL
1 LSb
ATtiny1624/1626/1627
Conventions
Integral
Nonlinearity (INL)
Differential
Nonlinearity (DNL)
After adjusting for offset and gain error, the INL is the maximum deviation of an actual
transition compared to an ideal transition for any code. Ideal value: 0 LSb.
Figure 5-3. Integral Nonlinearity
The maximum deviation of the actual code width (the interval between two adjacent
transitions) from the ideal code width (1 LSb). Ideal value: 0 LSb.
• 32 8-bit Registers Directly Connected to the ALU
• Stack in RAM
• Stack Pointer Accessible in I/O Memory Space
• Direct Addressing of up to 64 KB of Unified Memory
• Efficient Support for 8-, 16-, and 32-bit Arithmetic
• Configuration Change Protection for System-Critical Features
• Native On-Chip Debugging (OCD) Support:
– Two hardware breakpoints
– Change of flow, interrupt, and software breakpoints
– Run-time read-out of Stack Pointer (SP) register, Program Counter (PC), and Status Register (SREG)
– Register file read- and writable in Stopped mode
ATtiny1624/1626/1627
AVR® CPU
6.2 Overview
All AVR devices use the AVR 8-bit CPU. The CPU is able to access memories, perform calculations, control
peripherals, and execute instructions in the program memory. Interrupt handling is described in a separate section.
6.3 Architecture
To maximize performance and parallelism, the AVR CPU uses a Harvard architecture with separate buses for
program and data. Instructions in the program memory are executed with a single-level pipeline. While one
instruction is being executed, the next instruction is pre-fetched from the program memory. This enables instructions
to be executed on every clock cycle.
Refer to the Instruction Set Summary section for a summary of all AVR instructions.
The Arithmetic Logic Unit (ALU) supports arithmetic and logic operations between working registers, or between a
constant and a working register. Also, single-register operations can be executed.
The ALU operates in a direct connection with all the 32 general purpose working registers in the register file.
Arithmetic operations between working registers or between a working register and an immediate operand are
executed in a single clock cycle, and the result is stored in the register file. After an arithmetic or logic operation, the
Status Register (CPU.SREG) is updated to reflect information about the result of the operation.
ALU operations are divided into three main categories – arithmetic, logical, and bit functions. Both 8- and 16-bit
arithmetic are supported, and the instruction set allows for efficient implementation of the 32-bit arithmetic. The
hardware multiplier supports signed and unsigned multiplication and fractional formats.
6.4.1 Hardware Multiplier
The multiplier is capable of multiplying two 8-bit numbers into a 16-bit result. The hardware multiplier supports
different variations of signed and unsigned integer and fractional numbers:
• Multiplication of signed/unsigned integers
• Multiplication of signed/unsigned fractional numbers
• Multiplication of a signed integer with an unsigned integer
• Multiplication of a signed fractional number with an unsigned fractional number
A multiplication takes two CPU clock cycles.
ATtiny1624/1626/1627
AVR® CPU
6.5 Functional Description
6.5.1 Program Flow
After being reset, the CPU will execute instructions from the lowest address in the Flash program memory, 0x0000.
The Program Counter (PC) addresses the next instruction to be fetched.
The program flow is supported by conditional and unconditional change of flow instructions, capable of addressing
the whole address space directly. Most AVR instructions use a 16-bit word format, and a limited number use a 32-bit
format.
During interrupts and subroutine calls, the return address PC is stored on the stack as a word pointer. The stack is
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. After the Stack Pointer (SP) is reset, it points to the highest address in the internal SRAM. The
SP is read/write accessible in the I/O memory space, enabling easy implementation of multiple stacks or stack areas.
The data SRAM can easily be accessed through the five different Addressing modes supported by the AVR CPU.
6.5.2 Instruction Execution Timing
The AVR CPU is clocked by the CPU clock, CLK_CPU. No internal clock division is applied. The figure below shows
the parallel instruction fetches and executions enabled by the Harvard architecture and the fast-access register file
concept. This is the basic pipelining concept enabling up to 1 MIPS/MHz performance with high efficiency.
Figure 6-2. The Parallel Instruction Fetches and Executions
The following figure 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 in the destination register.
The Status Register (CPU.SREG) contains information about the result of the most recently executed arithmetic or
logic instructions. This information can be used for altering the program flow to perform conditional operations.
CPU.SREG is updated after all ALU operations, as specified in the Instruction Set Summary section. This will, in
many cases, remove the need for using the dedicated compare instructions, resulting in a faster and more compact
code. CPU.SREG is not automatically stored or restored when entering or returning from an Interrupt Service Routine
(ISR). Therefore, maintaining the Status Register between context switches must be handled by user-defined
software. CPU.SREG is accessible in the I/O memory space.
6.5.4 Stack and Stack Pointer
The stack is used for storing return addresses after interrupts and subroutine calls. Also, it can be used for storing
temporary data. The Stack Pointer (SP) always points to the top of the stack. The SP is defined by the Stack Pointer
bits in the Stack Pointer register (CPU.SP). The CPU.SP is implemented as two 8-bit registers that are accessible in
the I/O memory space.
Data are pushed and popped from the stack using the PUSH and POP instructions. The stack grows from higher to
lower memory locations. This means that pushing data onto the stack decreases the SP, and popping data off the
stack increases the SP. The SP is automatically set to the highest address of the internal SRAM after being reset. If
the stack is changed, it must be set to point above the SRAM start address (see the SRAM Data Memory section in
the Memories chapter for the SRAM start address), and it must be defined before any subroutine calls are executed
and before interrupts are enabled. See the table below for SP details.
Table 6-1. Stack Pointer Instructions
ATtiny1624/1626/1627
AVR® CPU
InstructionStack PointerDescription
PUSH
Decremented by 1 Data are pushed onto the stack
CALL
ICALL
Decremented by 2 A return address is pushed onto the stack with a subroutine call or interrupt
RCALL
POP
RET RETI
Incremented by 1Data are popped from the stack
Incremented by 2
A return address is popped from the stack with a return from subroutine or return
from interrupt
During interrupts or subroutine calls, the return address is automatically pushed on the stack as a word pointer, and
the SP is decremented by two. The return address consists of two bytes and the Least Significant Byte (LSB) is
pushed on the stack first (at the higher address). As an example, a byte pointer return address of 0x0006 is saved on
the stack as 0x0003 (shifted one bit to the right), pointing to the fourth 16-bit instruction word in the program memory.
The return address is popped off the stack with RETI (when returning from interrupts) and RET (when returning from
subroutine calls), and the SP is incremented by two.
The SP is decremented by ‘1’ when data are pushed on the stack with the PUSH instruction, and incremented by ‘1’
when data are popped off the stack using the POP instruction.
To prevent corruption when updating the SP from software, a write to SPL will automatically disable interrupts for up
to four instructions or until the next I/O memory write, whichever comes first.