PlatformIO Community

Cannot upload to ATtiny85 using bootloader

I have flashed the Optiboot bootloader to an ATTiny85 using the Arduino IDE. Through this IDE I can also upload sketches. Everything works as expected (besides the “tuning of the bootloader”).

Now that I have the bootloader working I wanted to switch to Platformio (via VSCode). However, flashing doesn’t work.


platform = atmelavr
board = attiny85
board_build.f_cpu = 1000000L ;8MHz
framework = arduino
upload_protocol = stk500v1
; each flag in a new line
upload_flags =
board_bootloader.file = ./bootloader/optiboot_attiny85_8000000L.hex
board_bootloader.lfuse = 0xE2
board_bootloader.hfuse = 0xD5
board_bootloader.efuse = 0xFE
board_bootloader.lock_bits = 0xFF
board_bootloader.unlock_bits = 0xFF
board_fuses.lfuse = 0xE2
board_fuses.hfuse = 0xD5
board_fuses.efuse = 0xFE

; edit these lines
upload_port = COM3
upload_speed = 19200

Now Pio doesn’t seem to be able to connect to the chip:

avrdude -PCOM3 -b19200 -v -p attiny85 -C path\to\avrdude.conf -c stk500v1 -b 19200 -e -D -U flash:w:.pio\build\attiny85\firmware.hex:i

avrdude: Version 6.3, compiled on Sep 12 2016 at 17:24:16
         Copyright (c) 2000-2005 Brian Dean,
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "path\to\tool-avrdude\avrdude.conf"

         Using Port                    : COM3
         Using Programmer              : stk500v1
         Overriding Baud Rate          : 19200
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x03

FYI: Arduino IDE’s avrdude’s command is

C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avrdude -CPATH\TO\avrdude.conf -v -pattiny85 -carduino -PCOM3 -b19200 -D -Uflash:w:PATH\TO\attiny85.ino.hex:i 

Anyone has an idea?

So the working command uses

and the nonworking uses

Then change your


upload_protocol = arduino


Or what programmer device have you attached to your ATTiny for ISP programming?


After burning the bootloader I connect the ATtiny85 via a CH340 usb-to-serial chip.

Changing the upload_protocol did the trick. An extra pair of eyes… as often.

The timing seems to be off however, gotta look into the fuses.

1 Like

You can burn the new fuse settings via pio run -t fuses -v. Does that invoke avrdude with the right fuse parameters? (You might have to change the upload_protocol again after burning your UART bootloader)

Again a stupid mistake. Fuses were allright, it was the platformio.ini file that had an error:

board_build.f_cpu = 1000000L

changed to

board_build.f_cpu = 8000000L

All is working now. FYI: my goal was to be able to update my 3.3V target without removing the battery. As my only ISP-device, the Arduino Uno works on 5V, it was too complicated to go via the ICSP route. Now I only have to attach a my 3.3V USB-to-serial without connecting the adapter’s Vcc.

1 Like