The ATtiny 2-Series
6th October 2022
This article looks at Microchip's latest addition to the ATtiny range, the 2-series, which offers some key advantages over the earlier ATtiny 0-series and 1-series, including: an advanced 12-bit differential 375 ksps analogue-to-digital converter with a 16x programmable gain amplifier, two USARTS, increased RAM, and the option of a smaller SSOP package for the 14-pin and 20-pin parts.
The ATtiny424 in both the SOIC and new SSOP packages, and the ATtiny3224, ATtiny3226, and ATtiny3227 with 32Kbytes of flash and 3Kbytes of RAM.
A couple of years ago I reviewed the ATtiny 0-series and 1-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 (see Getting Started with the New ATtiny Chips).
Since then, starting with the ATtiny1624, ATtiny1626, and ATtiny1627 released in Q1 2021, Microchip have been extending the range with a new 2-series. As the full set of parts have now been released I thought it would be useful to update my original article to add information about the new 2-series.
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:
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 summarise the 0-series and 1-series devices:
5 I/O lines
11 I/O lines
|20 pins SOIC/SSOP/QFN
17 I/O lines
21 I/O lines
Each cell in the above table shows the part number, classified by flash (and RAM) size and number of pins. As before, I've linked each part number to the appropriate Microchip datasheet (note that some datasheets cover multiple parts).
For each part the current 1-off price is shown for each of the packages shown at the bottom of the column, where NA means the part is not available in that package.
Since my previous article the prices for the 0-series and 1-series parts have increased by about 10%, so I've also updated those .
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.
The 2-series parts (purple) don't follow this trend, but drop some of the peripherals (TCD and DAC), and add an enhanced ADC:
These peripherals are explained in the following table:
|EV||Event System channels|
|TCA||16-bit Timer/Counter Type A with dedicated period register, 3 compare channels|
|TCB||16-bit Timer/Counter Type B with input capture|
|TCD||12-bit Timer/Counter Type D optimised for control applications|
|RTC||16-bit Real-Time Counter running from internal RC oscillator (‡ or external crystal or clock)|
|USART||USART with fractional baud rate generator, auto-baud, and start-of-frame detection|
|SPI||Master/slave Serial Peripheral Interface|
|I2C||Master/slave TWI with Dual Address Match, Standard mode, Fast mode, and Fast mode plus|
|CCL||Configurable Custom Logic programmable Look-Up Tables|
|ADC||10-bit 115 ksps Analogue-to-Digital Converter (§ 12-bit differential 375 ksps Analogue-to-Digital Converter with Programmable Gain Amplifier)|
|DAC||8-bit Digital-to-Analogue Converter|
|CRC||Automated CRC memory scan|
|WDT||Watchdog Timer with window mode, with separate on-chip oscillator|
|PTC||Peripheral Touch Controller for use with the QTouch Library (only in parts with at least 8K flash)|
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.
The 1-series parts are also generally downward compatible with the corresponding 0-series parts. So, if your project needs an ATtiny202 you'll be able to use any part in that column of the above table, up to the ATtiny412.
As of writing, these chips seem especially badly hit by the global chip shortage. When I was checking the prices on Digikey fewer than half of the parts are in stock at the moment. Hopefully things will get back to normal next year.
Features new to the ATtiny 2-series
Here are some of the most important differences introduced with the new 2-series parts:
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.
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 3Kbytes of RAM.
There's also now a 14-pin part with 32Kbytes of flash: the ATtiny3224; see On Bytes and Pins.
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.
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.
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
Prototyping with the ATtiny 2-series
As with the 0-series and 1-series parts, none of the 2-series parts are available in DIP packages, so if you want to build a project on a prototyping board you'll first need to mount them on a breakout board; Adafruit supplies suitable 8-pin SOIC , 14-pin SOIC , and 20-pin SOIC  breakouts, and I found 24-pin VQFN boards on Amazon .
Programming the ATtiny 2-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 follows:
- Use a USB to Serial board, such as the SparkFun FTDI Basic board , or a USB to Serial cable , connected with a 4.7kΩ resistor as follows:
- In the Arduino IDE select the appropriate family from the megaTinyCore section of the Boards menu, and the appropriate device from the Chip menu.
- Set the Programmer option to "SerialUPDI with 4.7k resistor or diode (230400 baud)".
- Select the USB port corresponding to the USB to Serial board in the Port menu, and select Upload.
- ^ Prices from www.digikey.com October 2022.
- ^ SMT Breakout PCB for SOIC-8 on Adafruit.
- ^ SMT Breakout PCB for SOIC-14 on Adafruit.
- ^ SMT Breakout PCB for SOIC-20 on Adafruit.
- ^ QFN24 DIP Adapter PCB on Amazon.
- ^ megaTinyCore on GitHub.
- ^ SparkFun FTDI Basic Breakout - 5V on Sparkfun.
- ^ FTDI Serial TTL-232 USB Cable on Adafruit.
blog comments powered by Disqus