Topics

► Games

► Sound & Music

► Watches & Clocks

► GPS

► Power Supplies

► Computers

► Graphics

► Thermometers

► Wearables

► Test Equipment

► Tutorials

► Libraries

► PCB-Based Projects

By processor

AVR ATtiny

► ATtiny10

► ATtiny2313

► ATtiny84

► ATtiny841

► ATtiny85

► ATtiny861

► ATtiny88

AVR ATmega

► ATmega328

► ATmega1284

AVR 0-series and 1-series

► ATmega4809

► ATtiny1604

► ATtiny1614

► ATtiny3216

► ATtiny402

► ATtiny404

► ATtiny414

► ATtiny814

AVR DA/DB-series

► AVR128DA28

► AVR128DA48

► AVR128DB28

ARM

► ATSAMD21

► RP2040

About me

  • About me

Feeds

RSS feed

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.

ATtiny2series.jpg

The ATtiny424 in both the SOIC and new SSOP packages, and the ATtiny3224, ATtiny3226, and ATtiny3227 with 32Kbytes of flash and 3Kbytes of RAM.

Introduction

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.

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:

ATtinyNumbering2.gif

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:

32K
(2K/*3K)
  ATtiny3224*
$1.10/$1.13
ATtiny3226*
$1.41/$1.00/$1.30
ATtiny3227*
$1.40
  ATtiny3216
$1.44/NA/NA
ATtiny3217
$1.37
16K
(1K/*2K)
  ATtiny1624*
$1.01/$1.15
ATtiny1626*
$1.36/$1.13/$1.09
ATtiny1627*
$1.29
ATtiny1614*
$0.99/NA
ATtiny1616*
$1.27/NA/$1.08
ATtiny1617*
$1.27
ATtiny1604
$0.89/NA
ATtiny1606
$1.24/NA/$0.93
ATtiny1607
$1.18
8K
(512/*1K)
  ATtiny824*
$0.92/$1.05
ATtiny826*
$1.24/$1.02/$0.99
ATtiny827*
$1.24
ATtiny814
$0.89/NA
ATtiny816
$1.23/NA/$0.99
ATtiny817
$1.24
ATtiny804
$0.84/NA
ATtiny806
$1.15/NA/$0.93
ATtiny807
$1.13
4K
(256/*512)
  ATtiny424*
$0.78/$0.81
ATtiny426*
$1.15/$0.91/$0.98
ATtiny427*
$1.24
ATtiny412
$0.61
ATtiny414
$0.75/NA
ATtiny416
$1.13/NA/$0.85
ATtiny417
$1.10
ATtiny402
$0.55
ATtiny404
$0.70/NA
ATtiny406
$1.05/NA/$0.84
 
2K
(128)
ATtiny212
£0.59
ATtiny214
$0.71/NA
   
ATtiny202
$0.55
ATtiny204
$0.70/NA
FLASH
(RAM)
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

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 [1].

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.

The 2-series parts (purple) don't follow this trend, but drop some of the peripherals (TCD and DAC), but add an enhanced ADC:

  EV TCA TCB TCD RTC USART SPI I2C CCL AC ADC DAC CRC WDT PTC
  3 1 1   1 1 1 1 2 1 1   1 1  
     6 1 1 1 1 1 1 1 2 1 1 1 1 1  
  6 1 1 1 1‡ 1 1 1 2 1 1 1 1 1 1
  6 1 2 1 1‡ 1 1 1 2 3 2 3 1 1 1
  6 1 2   1‡ 2 1 1 4 1   1 1  

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
AC Analogue Comparator
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.

The same is not necessarily true of the 2-series parts; see Features new to the ATtiny 2-series and Disadvantages of the ATtiny 2-series below.

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:

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 3Kbytes of RAM.

There's also now a 14-pin part with 32Kbytes of flash: the ATtiny3224; see On Bytes and Pins.

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

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 [2], 14-pin SOIC [3], and 20-pin SOIC [4] breakouts, and I found 24-pin VQFN boards on Amazon [5].

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 [6], 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 [7], or a USB to Serial cable [8], connected with a 4.7kΩ resistor as follows:

SerialUPDIProgrammer.gif

  • 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.

  1. ^ Prices from www.digikey.com October 2022.
  2. ^ SMT Breakout PCB for SOIC-8 on Adafruit.
  3. ^ SMT Breakout PCB for SOIC-14 on Adafruit.
  4. ^ SMT Breakout PCB for SOIC-20 on Adafruit.
  5. ^ QFN24 DIP Adapter PCB on Amazon.
  6. ^ megaTinyCore on GitHub.
  7. ^ SparkFun FTDI Basic Breakout - 5V on Sparkfun.
  8. ^ FTDI Serial TTL-232 USB Cable on Adafruit.

blog comments powered by Disqus