In stockView Purchasing Options
Project update 3 of 7
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.
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
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.