Programming an ATtiny 1614 using UPDI

The ATtiny 1614 is an 8-Bit microcontroller available in a SOIC-16 form factor. It has 13 available GPIO pins (Not using Reset/UPDI on Pin 10 as a GPIO). This means that it only requires a three-pin header to power and program it. In a previous post, I wrote up how to make a cheap programmer with a small number of external components.

The new ATtiny processors use a system called Unified Program and Debug Interface (UPDI). This interface uses the RESET pin to program and/or debug the device. I don’t yet know how to use it to debug, but if I find out, I will probably move on to that rather than sending data out on the serial port.

I am using the Arduino IDE to manage the programming of the processor, the same as I do with the ATmega328, known as the Arduino Uno R3

ATtiny1614 vs ATtiny1616 vs ATtiny85 vs ATmega328

ATtiny85ATmega328ATtiny1614ATtiny1616
FormfactorDIP-8
SOIC-8
DIP-28
TQFP-32
14-SOIC20-SOIC
20-QFN
20-SSOP
Maximum clock frequency20 MHz20 MHz20 MHz20 MHz
Voltage2.7 – 5.5 V (5 V nominal)1.8 – 5.5 V (5 V nominal)1.8 – 5.5 V (5 V nominal)1.8 – 5.5 V (5 V nominal)
Pin Count828 / 321420
GPIOs6231218
ADC channels4 (10 bit)8 (10 bit)12 (10 bit)18 (10 bit)
Flash8 kB32 kB16 kB16 kB
SRAM512 bytes2 kB2 kB2 kB
EPROM512 bytes1 kB256 bytes256 bytes
InterfacesUSI (SPI/I²C), no UARTUART, SPI, I²CUSART, SPI, TWI, UPDIUSART, SPI, TWI, UPDI

The megaTinyCore that I am using for the ATtiny1614 also supports the following processors: ATtiny3224/1624/1614/1604/824/814/804/414/404/214/204, these are all part of Microchip’s modern tinyAVR 0 and 1 series.

They are all 20 MHz, 1.8 – 5 V devices, the differnces come from The differences come from: Number of peripherals exposed (ADC channels, timers, USART count), Flash size (2 kB – 32 kB) and Pin count (14 – 24 pins). with the Attiny3224 being the largest, and the ATtiny204 the smallest.

Installing the megaTinyCore in the Arduino IDE

This board package can be installed via the board manager. The board’s manager URL is: https://drazzy.com/package_drazzy.com_index.json

  1. File -> Preferences, enter the above URL in “Additional Boards Manager URLs”
  2. Restart the Arduino IDE
  3. Tools -> Boards -> Boards Manager
  4. Search for “megaTinyCore”
  5. Select “megaTinyCore by Spence Konde” and click “Install”. megaTinyCore.png

Select the Programmer

Once the board has been installed in the IDE, select it from the Tools menu.

Make sure you select the Chip that you are about to program. In my case, the Attiny 1614 is on the list under the line “ATtiny3224/1624/1614/1604/824/814/804/414/404/214/204”

  • Tools > Board: “ATtiny3224/1624/1614/1604/824/814/804/414/404/214/204”
  • Tools > Port: “/dev/cu.usbmodem5AEC0039471”
  • Tools > Chip: “ATtiny1614”
  • Tools > Programmer: “SerialUPDI – SLOW: 57600 baud”

Also, note that some libraries, such as the Adafruit Neopixel Library, won’t work with a 20 MHz clock, so you may need to reduce the clock speed back to 16 MHz if you’re running at 5 VDC, or 8 MHz if you’re running the chip from a 3V3 supply.

SOIC to DIP

ATtiny 1614 SOIC to DIP
ATtiny 1614 SOIC to DIP

You can’t naturally put the ATtiny into a solderless breadboard; the SOIC footprint has a 1.27 mm pitch, compared to the breadboard’s 2.45 pitch. The Pi Hut sells several different size conveter PCBs. I think I got these from eBay. I have previously written about the LEDs.

On top of the ATtiny 1614, you can see some tinned copper wire taken to a pin header; this is to allow me to program the chip at a later date without having to take it off of anything I mount it to.

Wiring up the ATtiny 1614 for programming

Wiring up the ATtiny 1614 for UPDI programming, there are two LEDs: A green LED between +5 VDC and GND, and a red LED between pin 8 and GND
Wiring up the ATtiny 1614 for UPDI programming, there are two LEDs: A green LED between +5 VDC and GND, and a red LED between pin 8 and GND

The above picture is from the previous post, where I made the UPDI programming converter. There are two LEDs: A green LED between +5 VDC and GND, and a red LED between Pin 8 (PA7, Arduino Pin 6) and GND. +5 VDC is applied to Pin 1, GND is applied to Pin 14, and UPDI to Pin 10. The 16-pin SOIC is on a SOIC to DIP converter to allow it to be used with solderless breadboards.

The following program was uploaded to the ATtiny1614 as a test to check that it was working.

// Blink Without Delay for ATtiny1614
// LED connected to pin 8 (PA7)

const int ledPin = 6;                // physical pin 8 (PA7)
unsigned long previousMillis = 0;
const unsigned long interval = 500;  // Blink interval in ms

void setup() {
  pinMode(ledPin, OUTPUT);
}

void loop() {
  unsigned long currentMillis = millis();

  if (currentMillis - previousMillis >= interval) {
    previousMillis = currentMillis;

    // Toggle LED
    digitalWrite(ledPin, !digitalRead(ledPin));
  }
}

Conclusion on programming the ATtiny 1614

After programming, the results are this: a red LED flashing at 1 Hz.

Leave a Reply

Your email address will not be published. Required fields are marked *

The maximum upload file size: 20 MB. You can upload: image, audio, video, document, spreadsheet, interactive, text, archive, code, other. Links to YouTube, Facebook, Twitter and other services inserted in the comment text will be automatically embedded. Drop files here