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.
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  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.
The new parts are numbered in a slightly eccentric way, with the series number in the middle:
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:
|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 .
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:
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|
|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 .
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 , and GitHub user ElTangas has written a UPDI programmer that you can run on an Arduino Uno or equivalent board . 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 , 14-pin SOIC , and 20-pin SOIC  breakouts, and I found 24-pin VQFN boards on Amazon .
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:
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.
- ^ megaTinyCore on GitHub.
- ^ Prices from www.digikey.com on 22nd August 2019.
- ^ ATtiny1627 on Microchip.
- ^ megaTinyCore on GitHub.
- ^ Making a UPDI programmer on GitHub.
- ^ 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.
blog comments powered by Disqus