We start this blog series with the reviewed of the ATTiny 0-series then 1-series en at least the 2 series range of chips from Microchip. An impressive matrix of parts with a consistent set of peripherals, and covering a wide range of application requirements from 8 to 24 pins and 2K to 32K of flash memory.
Part numbering
The new 2-series parts use the same numbering scheme as the 0-series and 1-series parts, with the series number in the middle:
ATTINY1614
Flash | Series | Pins |
---|---|---|
2 = 2K | 0 = 0-series | 2 = 8 pins |
4 = 4K | 1 = 1-series | 4 = 14 pins |
8 = 8K | 2 = 2-series | 6 = 20 pins |
16 = 16K | 7 = 24 pins | |
32 = 32K |
Although this naming scheme makes it difficult to locate parts in an alphabetical list, the fact that it’s systematic does make it relatively easy to select a part you want with a particular combination of capabilities.
ATTiny 0-series, 1-series, and 2-series summary
I’ve merged the new 2-series chips into the tables I created in my original article to summarize the 0-series and 1-series devices:
FLASH (RAM) | Part number | Part number | Part number | Part number |
Package | 8 pins SOIC 5 I/O lines | 14 pins SOIC/SSOP 11 I/O lines | 20 pins SOIC/SSOP/QFN 17 I/O lines | 24 pins QFN 21 I/O lines |
32K (2K/*3K) | ATtiny3224* | ATtiny3226* | ATtiny3227* | |
ATtiny3216 | ATtiny3217 | |||
16K (1K/*2K) | ATtiny1624* | ATtiny1626* | ATtiny1627* | |
ATtiny1614* | ATtiny1616* | ATtiny1617* | ||
ATtiny1604 | ATtiny1606 | ATtiny1607 | ||
8K (512/*1K) | ATtiny824* | ATtiny826* | ATtiny827* | |
ATtiny814 | ATtiny816 | ATtiny817 | ||
ATtiny804 | ATtiny806 | ATtiny807 | ||
4K (256/*512) | ATtiny424* | ATtiny426* | ATtiny427* | |
ATtiny412 | ATtiny414 | ATtiny416 | ATtiny417 | |
ATtiny402 | ATtiny404 | ATtiny406 | ||
2K (128) | ATtiny212 | ATtiny214 | ||
ATtiny202 | ATtiny204 | |||
SOIC Package | ||||
SSOP Package | ||||
QFN Package |
Each cell in the above table shows the part number, classified by flash (and RAM) size, number of pins and package size.
Peripherals
The background colours in the above table identify the set of peripherals in each part. The 0-series parts (yellow) have a basic set of peripherals. The smaller 1-series parts (light and dark orange) have some additional peripherals (TCD and DAC), and the 16K and 32K 1-series parts (red) have multiple instances of some of the peripherals.
ATTiny 202/204/402/404/406/804/806/807/1604/1606/1607
3 X Event System channels
1 X 16-bit Timer/Counter Type A with dedicated period register, 3 compare channels
1 X 16-bit Timer/Counter Type B with input capture
1 X 16-bit Real-Time Counter running from internal RC oscillator (‡ or external crystal or clock)
1 X USART with fractional baud rate generator, auto-baud, and start-of-frame detection
1 X Master/slave Serial Peripheral Interface
1 X Master/slave TWI with Dual Address Match, Standard mode, Fast mode, and Fast mode plusx X Configurable Custom Logic programmable Look-Up Tables
2 X Analogue Comparator
1 X 10-bit 115 ksps Analogue-to-Digital Converter (§ 12-bit differential 375 ksps Analogue-to-Digital Converter with Programmable Gain Amplifier)
1 X 8-bit Digital-to-Analogue Converter
1 X Automated CRC memory scan
1 X Watchdog Timer with window mode, with separate on-chip oscillator
ATTiny 212/412
6 X Event System channels
1 X 16-bit Timer/Counter Type A with dedicated period register, 3 compare channels
1 X 16-bit Timer/Counter Type B with input capture
1 X 12-bit Timer/Counter Type D optimized for control applications
1 X 16-bit Real-Time Counter running from internal RC oscillator (‡ or external crystal or clock)
1 X USART with fractional baud rate generator, auto-baud, and start-of-frame detection
1 X Master/slave Serial Peripheral Interface
1 X Master/slave TWI with Dual Address Match, Standard mode, Fast mode, and Fast mode plusx X Configurable Custom Logic programmable Look-Up Tables
2 X Analogue Comparator
1 X 10-bit 115 ksps Analogue-to-Digital Converter (§ 12-bit differential 375 ksps Analogue-to-Digital Converter with Programmable Gain Amplifier)
1 X 8-bit Digital-to-Analogue Converter
1 X Automated CRC memory scan
1 X Automated CRC memory scan
1 X Watchdog Timer with window mode, with separate on-chip oscillator
ATTiny 214/414/416/417/814/816/817
6 X Event System channels
1 X 16-bit Timer/Counter Type A with dedicated period register, 3 compare channels
1 X 16-bit Timer/Counter Type B with input capture
1 X 12-bit Timer/Counter Type D optimized for control applications
1 X 16-bit Real-Time Counter running from internal RC oscillator (‡ or external crystal or clock)
1 X USART with fractional baud rate generator, auto-baud, and start-of-frame detection
1 X Master/slave Serial Peripheral Interface
1 X Master/slave TWI with Dual Address Match, Standard mode, Fast mode, and Fast mode plusx X Configurable Custom Logic programmable Look-Up Tables
2 X Analogue Comparator
1 X 10-bit 115 ksps Analogue-to-Digital Converter (§ 12-bit differential 375 ksps Analogue-to-Digital Converter with Programmable Gain Amplifier)
1 X 8-bit Digital-to-Analogue Converter
1 X Automated CRC memory scan
1 X Automated CRC memory scan
1 X Watchdog Timer with window mode, with separate on-chip oscillator
1 X Peripheral Touch Controller for use with the QTouch Library (only in parts with at least 8K flash)
ATTiny 1614/1616/1617/3216/3217
6 X Event System channels
1 X 16-bit Timer/Counter Type A with dedicated period register, 3 compare channels
2 X 16-bit Timer/Counter Type B with input capture
1 X 12-bit Timer/Counter Type D optimized for control applications
1 X 16-bit Real-Time Counter running from internal RC oscillator (‡ or external crystal or clock)
1 X USART with fractional baud rate generator, auto-baud, and start-of-frame detection
1 X Master/slave Serial Peripheral Interface
1 X Master/slave TWI with Dual Address Match, Standard mode, Fast mode, and Fast mode plusx X Configurable Custom Logic programmable Look-Up Tables
2 X Analogue Comparator
3 X 10-bit 115 ksps Analogue-to-Digital Converter (§ 12-bit differential 375 ksps Analogue-to-Digital Converter with Programmable Gain Amplifier)
2 X 8-bit Digital-to-Analogue Converter
3 X Automated CRC memory scan
1 X Automated CRC memory scan
1 X Watchdog Timer with window mode, with separate on-chip oscillator
1 X Peripheral Touch Controller for use with the QTouch Library (only in parts with at least 8K flash)
ATTiny 424/426/427/824/826/827/1624/1626/1627/3224/3226/2327
6 X Event System channels
1 X 16-bit Timer/Counter Type A with dedicated period register, 3 compare channels
2 X 16-bit Timer/Counter Type B with input capture
1 X 16-bit Real-Time Counter running from internal RC oscillator (‡ or external crystal or clock)
2 X USART with fractional baud rate generator, auto-baud, and start-of-frame detection
1 X Master/slave Serial Peripheral Interface
1 X Master/slave TWI with Dual Address Match, Standard mode, Fast mode, and Fast mode plusx X Configurable Custom Logic programmable Look-Up Tables
4 X Analogue Comparator
1 X 10-bit 115 ksps Analogue-to-Digital Converter (§ 12-bit differential 375 ksps Analogue-to-Digital Converter with Programmable Gain Amplifier)
1 X 8-bit Digital-to-Analogue Converter
1 X Automated CRC memory scan
1 X Watchdog Timer with window mode, with separate on-chip oscillator
Which chip should I buy?
The higher-memory parts in each series are generally completely compatible with the lower-memory parts, and given the tiny difference in price, it’s probably sensible to buy the highest-memory part you can find in stock. As of writing, these chips seem especially badly hit by the global chip shortage.
Features new to the ATtiny 2-series
Here are some of the most important differences introduced with the new 2-series parts:
Packages
The 14-pin and 20-pin parts are now also available in an SSOP package, which is about half the size of the SOIC package.
Memory
Many of the 2-series parts have more RAM than their 0-series and 1-series counterparts with the same flash size. For example, the ATtiny824, ATtiny826, and ATtiny827 bump up the RAM from 512 bytes to 1Kbytes, and the ATtiny3224, ATtiny3226, and ATtiny3227 have 3 Kbytes of RAM.
Analogue-to-digital converter
The following table highlights the differences between the analogue-to-digital converters in the ATtiny 2-series, ATtiny 0/1-series, and the AVR DA/DB/DD series:
Bits | Rate | Mode | Gain | Input pin range | |
ATtiny 2-series | 12 | 375 ksps | Single-ended | N/A | 0 to VREF |
Differential | 1x to 16x | -0.1 to VDD+0.1 | |||
ATtiny 0/1-series | 10 | 115 ksps | Single-ended | 0 to VREF | |
AVR DA/DB/DD | 12 | 130 ksps | Single-ended | N/A | 0 to VREF |
Differential | No | 0 to VREF |
Although the AVR DA/DB/DD series offers a differential ADC, there are some applications it’s not suitable for because the inputs are limited to VREF. So, for example, if VREF is 1.024V and VDD is 5V, you can’t measure the voltage difference across a high-side current-sense resistor. The ATtiny 2-series removes this limitation, and gives you the added benefit of a choice of gain from 1X to 16X.
Other peripherals
All the parts provide double the number of Configurable Custom Logic Look-Up Tables; four rather than two. All the parts have two USART peripherals, allowing you to have two hardware serial ports. The Type B Timer/Counters have been upgraded to the versions in the AVR DA/DB/DD series; they are small improvements, but may require code changes. The Event System has been upgraded to the version in the AVR DA/DB/DD series which is more logical, but again may require code changes. The voltage references are now the same as the AVR DA/DB/DD series: 1.024V, 2.048V, 2.500V, 4.096V, and VDD rather than the 0/1-series 0.55V, 1.1V, 1.5V, 2.5V, and 4.3V.
Reset
On the 0-series and 1-series parts, there is no dedicated RESET pin. The 20 and 24-pin 2-series parts have an alternative location for the RESET pin, on PB4, which lets you have both UPDI and RESET accessible at the same time. This makes it convenient to use the Optiboot bootloader with these parts, to upload programs via serial, because it relies on a connection between DTR and RESET to initiate the upload.
Disadvantages of the ATtiny 2-series
Some features have been dropped compared to the 0-series and 1-series:
- There are no 8-pin parts.
- None of the parts have the 12-bit Timer/Counter Type D.
- None of the parts have a DAC.
- None of the parts have a Peripheral Touch Controller
Programming the ATtiny X-series devices from the Arduino IDE
Spence Konde has updated his excellent megaTinyCore to add support for all the ATtiny 2-series parts, so you can use the Arduino functions with the new ATtiny chips, and program them from the Arduino IDE without needing Atmel Studio.
To program these chips, you need to use the UPDI protocol. The recommended way to do this from the Arduino IDE is now as shown below.
More information about the UPDI programmer can be found here: https://www.studiopieters.nl/updi
References
[1] Microchip, “Microcontrollers and Microprocessors / 8-bit MCUs / AVR® MCUs” https://ww1.microchip.com/downloads/aemDocuments/documents/MCU08/ProductDocuments/DataSheets/ATtiny202-204-402-404-406-DataSheet-DS40002318A.pdf
[2] Microchip, “Microcontrollers and Microprocessors / 8-bit MCUs / AVR® MCUs” https://ww1.microchip.com/downloads/aemDocuments/documents/MCU08/ProductDocuments/DataSheets/ATtiny202-204-402-404-406-DataSheet-DS40002318A.pdf
[3] Microchip, “Microcontrollers and Microprocessors / 8-bit MCUs / AVR® MCUs” https://ww1.microchip.com/downloads/en/DeviceDoc/ATtiny424-426-427-824-826-827-DataSheet-DS40002311A.pdf
[4] Daumemo, “introduction into simple yet powerful tinyavr” https://daumemo.com/introduction-into-simple-yet-powerful-tinyavr-0-series-attiny-microcontrollers/
[5] Technoblogy “The ATtiny 2-Series” http://www.technoblogy.com/show?3UKF