ATtiny Flasher

by Sonocotta

Open-hardware flashing tool for the Atmel ATtiny

View all updates Jun 29, 2021

The Benefits of an Open Source Flasher

by Andriy

While I’m still working on adding high-voltage flashing support to the latest firmware revision, I wanted to share how everyone can benefit from the open source nature of the ATtiny Flasher firmware.

Every ATtiny Flasher owner will be able to update their firmware to the latest version or run their own firmware. There are two ways to install firmware on the Flasher: via SPI or using the Arduino protocol. But essentially, the first step is to get the source code and build it on your machine.

$ git clone https://github.com/anabolyc/attiny-flasher
$ cd attiny-flasher/firmware/flasher/attiny-flasher
$ code .
$ pio run

To make things easier, I’ve delivered the firmware as a Platformio project, which is essentially regular C/C++ code with the important addition of a platformio.ini file that allows one-click deployment for multiple tool configurations.

Initial Flashing

When a board arrives from the production line, there is only one way to flash it: using its SPI pins together with the RESET pin and any ISP programmer (an older revision of ATtiny Flasher in my case).

Self programming port and switch on the board

Why wouldn’t it work like other Arduinos with USB input? Because it can only work with a proper bootloader that will wait for programming commands upon each restart.

Therefore, on first flash, Platformio needs to be informed that flashing was done by another flasher.

; when programmed first time using another Flasher
upload_protocol = stk500v1
upload_flags =
    -P$UPLOAD_PORT
    -b$UPLOAD_SPEED
upload_port = /dev/ttyUSB0
upload_speed = 115200

Flashing bootloader using another ATtiny Flasher

When a Bootloader Is There To Help

Using another flashing tool is not the most convenient solution, however, and most users are accustomed to doing it with one-click. With the SPI method, you’ll only need to flash the bootloader one time. Once it is flashed (with the proper fuse settings), you can use the onboard USB-UART bridge and any Arduino-like IDE to flash it subsequently.

Every ATtiny Flasher will be delivered to the customer with both the bootloader and the latest firmware installed, so updating firmware is as easy as plugging it into USB and running a task in the IDE.

You might be wondering, how can the tool distinguish if the user wishes to flash the target or the host? Since the same USB port is used? It depends on the programming protocol: whatever is communicated with the Arduino upload protocol will be interpreted by Optiboot and flashed to the host. If the protocol is STK or similar, that content will be captured by firmware and interpreted as target-flashing commands. On the hardware level, however, there is a switch (visible in the first photo above) that switches circuitry to self-programming mode and vice versa.

About the Author

Andriy

anabolyc  ·   Poland


$4,555 raised

of $3,000 goal

151% Funded! Order Below

Product Choices

$25

ATtiny Flasher

ATtiny Flasher with OLED screen.


$19

Educational Project Kit 1: Traffic Light

ATtiny85-driven "traffic light"


$19

Educational Project Kit 2: Rubber Ducky

ATtiny85-driven "USB rubber ducky" tool capable of emulating keyboard & mouse devices


$19

Educational Project Kit 3: IR Messenger

ATtiny85-driven IR remote transmitter & receiver


$19

Educational Project Kit 4: Rainbow LEDs

ATtiny85-driven circle of addressable LEDs


$39

Educational Project Kit 5: Digital Clock

ATtiny85-driven digital clock


$5

Half-size Breadboard

From the Crowd Supply Basics project.

A half-size (3.25 x 2.125 in ~ 8.3 x 5.4 cm) breadboard with a self-adhesive backing


$1

ATtiny13

From the Crowd Supply Basics project.

A 20 MHz, 8-bit, 8-pin DIP AVR MCU with 6 I/O, 1 KiB flash, 64 B SRAM, 64 B EEPROM, a SPI interface, and an input voltage range of 1.8 - 5.5 V.


$2

ATtiny85

From the Crowd Supply Basics project.

A 20 MHz, 8-bit, 8-pin DIP AVR MCU with 6 I/O, 8 KiB flash, 512 B SRAM, 512 B EEPROM, a USI interface, and an input voltage range of 2.7 - 5.5 V.

Credits

Sonocotta

Electronic components and kits


Andriy Malyshenko

See Also

Subscribe to the Crowd Supply newsletter, highlighting the latest creators and projects: