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

► ATtiny3227

► ATtiny402

► ATtiny404

► ATtiny414

► ATtiny814

AVR DA/DB-series

► AVR128DA28

► AVR128DA32

► AVR128DA48

► AVR128DB28

ARM

► ATSAMD21

► RP2040

► RA4M1

About me

  • About me
  • Twitter
  • Mastodon

Feeds

RSS feed

Getting Started with the New ATtiny Chips

26th August 2019

In 2016 Microchip/Atmel announced a completely new range of chips designed to replace their older ATmega and ATtiny ranges. The new ATtiny chips started with the 1-series ATtiny417 and ATtiny817, followed in 2018 by a lower cost series called the 0-series. The range now consists of a total of 25 parts.

ATtinys.jpg

A selection of the new ATtiny chips: SOIC ATtiny412, ATTiny1614, and ATtiny3216;
QFN ATtiny1616 and ATtiny3217.

Until recently these new chips were not accessible to users of the Arduino IDE, because no Arduino core existed for them, and you couldn't program them using the existing ISP programmers. That changed a couple of months ago when Spence Konde released a megaTinyCore [1] for the new range, taking advantage of the work that Arduino have done to support their new ATmega4809-based boards.

This article gives an introduction to the new ATtiny parts, and explains how you can now program them from the Arduino IDE.

For an update to this article that incorporates information about the ATtiny 2-series see The ATtiny 2-Series.

Part numbering

The new parts are numbered in a slightly eccentric way, with the series number in the middle:

ATtinyNumbering.gif

This makes looking them up in an alphabetical list of parts rather problematic, because they are mixed up with the old ATtiny range. However, apart from this gripe the systematic naming convention does make it easy to select a part you want with a particular combination of capabilities.

ATtiny 0-series and 1-series summary

The new ATtiny chips mark a departure from the philosophy of the earlier ATtinys; although they still use the AVR processor core, their peripherals are quite different, based on the peripherals from Atmel's XMEGA range.

Although the new ATtiny chips form a consistent matrix of devices, they are described in several separate datasheets, which makes for a lot of reading if you want to get an overview of their capabilities and differences. I've therefore tried to summarise the key features and differences in the following tables:

32K
(2K)
          ATtiny3216
$1.03/NA
  ATtiny3217
$1.01
16K
(1K/*2K)
    ATtiny1604
$0.66
ATtiny1614*
$0.75
ATtiny1606
$0.90/NA
ATtiny1616*
$0.94/$0.77
ATtiny1607
$0.88
ATtiny1617*
$0.97
8K
(512)
    ATtiny804
$0.64
ATtiny814
$0.66
ATtiny806
$0.83/NA
ATtiny816
$0.90/$0.71
ATtiny807
$0.83
ATtiny817
$0.92
4K
(256)
ATtiny402
$0.41
ATtiny412
$0.46
ATtiny404
$0.52
ATtiny414
$0.56
ATtiny406
$0.77/$0.62
ATtiny416
$0.85/$0.63
  ATtiny417
$0.81
2K
(128)
ATtiny202
$0.41
ATtiny212
£0.43
ATtiny204
$0.52
ATtiny214
$0.54
       
FLASH
(RAM)
8 pins SOIC
5 I/O lines
14 pins SOIC
11 I/O lines
20 pins SOIC/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 size and number of pins. 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 both the SOIC and QFN packages, as appropriate [2].

All the parts have the same basic set of peripherals. In addition, the 1-series parts have a few extra peripherals, and the 16K and 32K 1-series parts have multiple instances of some of the peripherals, as shown by the background colours in the above table:

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

These peripherals are explained in the following table:

EV Event System with 3 († 6) channels, 2 († 4) asynchronous and 1 († 2) synchronous
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 with 2 programmable Look-Up Tables
AC Analogue Comparator
ADC 10-bit 115 ksps Analogue-to-Digital Converter
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)

Advantages of the ATtiny 0-series and 1-series

As a fan of the old ATtiny range I was initially a bit concerned about the complete overhaul of my favourite range of microcontrollers, but I've come to recognise that this new range definitely has several benefits over the old ATtinys.

First of all, it's a great plus that there's a base set of identical peripherals across the entire range. The peripherals in the old ATtiny range vary from part to part; for example, the ATtiny85 has two 8-bit timers, whereas the ATtiny84 has one 8-bit and one 16-bit. Every part now has at least two 16-bit timers, a USART, I2C, SPI, and ADC. There are also several peripherals that weren't available in the old ATtinys at all, such as an RTC, DACs, custom logic, the event system, and the peripheral touch controller.

Secondly, the new chips offer flash sizes up to 32K; the old ATtinys generally offered up to 8K, the largest being 16K on the ATtiny167 and ATtiny1634.

Finally, the new chips are over twice as cheap as the old ATtiny chips. For example, comparing roughly equivalent 4K flash 8-pin devices: old ATtiny45, $1.06; new ATtiny402, $0.41.

Disadvantages of the ATtiny 0-series and 1-series

Compared to the old ATtiny chips that we know and love, the new 0-series and 1-series ATtiny chips do have a few minor omissions.

None of the parts are available in a breadboard-friendly DIP package, and none of the parts can be clocked from an external crystal, although this is partly compensated for by the fact that the internal oscillator has better than 2% accuracy.

Programming the peripherals directly tends to be more complicated than in the old ATtiny range, although if you're using Arduino functions this won't affect you.

The maximum number of I/O lines in the new chips is 21, whereas the older ATtiny48, ATtiny88, and ATtiny828 provided 27 I/O lines. For more pins you now need to go to the new ATmega 0-series.

And features available in some of the old ATtiny chips are not available at all, such as the differential ADC with gain in the ATtiny85 and ATtiny861. This will be remedied by the forthcoming 2-series ATtiny chips [3]

Programming the new ATtiny devices from the Arduino IDE

Thanks to work by Spence Konde and his collaborators there is now an Arduino core for the 0-series and 1-series parts [4], and GitHub user ElTangas has written a UPDI programmer that you can run on an Arduino Uno or equivalent board [5]. So you can use the Arduino functions with the new ATtiny chips, and program them from the Arduino IDE without needing Atmel Studio.

None of the new ATtiny devices 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 [6], 14-pin SOIC [7], and 20-pin SOIC [8] breakouts, and I found 24-pin VQFN boards on Amazon [9].

The procedure to program a device is as follows:

  • Make a UPDI programmer by installing ElTangas's jtag2updi program on an Arduino Uno, or other ATmega328P-based board, as described in Make UPDI Programmer.
  • Install Spence Konde's megaTinyCore in the Arduino IDE, as described in megaTinyCore Installation.
  • In the Arduino IDE select the appropriate family from the megaTinyCore section of the Boards menu, and the appropriate part from the Chip menu.
  • Select jtag2updi (megaTinyCore) from the Programmer menu.
  • Connect the Arduino Uno (or equivalent) to the chip you're programming, select its USB port from the Port menu, and select Upload.

For example, here I'm using an Arduino Nano as a UPDI programmer to program an ATtiny412 on a mini breadboard with the Arduino Blink example program:

ProgramATtiny.jpg

Programming an ATtiny412 with the Blink example program using an Arduino Nano as a UPDI programmer.

I'm planning to describe some projects based on the new ATtiny chips in future articles.


  1. ^ megaTinyCore on GitHub.
  2. ^ Prices from www.digikey.com on 22nd August 2019.
  3. ^ ATtiny1627 on Microchip.
  4. ^ megaTinyCore on GitHub.
  5. ^ Making a UPDI programmer on GitHub.
  6. ^ SMT Breakout PCB for SOIC-8 on Adafruit.
  7. ^ SMT Breakout PCB for SOIC-14 on Adafruit.
  8. ^ SMT Breakout PCB for SOIC-20 on Adafruit.
  9. ^ QFN24 DIP Adapter PCB on Amazon.

blog comments powered by Disqus