15 August 2021

ATtiny13a discovery

By Bolukan

ATtiny13a

The ATtiny13a is a 8-bit AVR MCU featuring 1 KB of ISP Flash, 64B EEPROM and 64B SRAM.

To program the ATtiny13a you need to communicate to the device via the SPI interface. Since computers in general don’t support SPI, I used another MCU as an intermediary, called ‘Arduino as ISP’. I flashed the ArduinoISP.ino example code to an ESP8266. This code does not compile on PlatformIO because PlatformIO requires forward defined functions and the example code does not comply.

To support the ATtiny13a board in PlatformIO install the Atmel AVR platform which includes MicroCore. The default upload protocol which works with ArduinoISP.ino is named stk500v1 and is the default protocol for the ATtiny13a.

platformio.ini:
[env:attiny13a]
platform = atmelavr
board = attiny13a
framework = arduino

Example code:
#include <Arduino.h>
#define LED_PIN PB3
void setup() {

  pinMode(LED_PIN, OUTPUT);
}
void loop() {

  PORTB ^= 1 << LED_PIN;
  delay(500);
}