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.
Platformio.ini:
[env:attiny85]
platform = atmelavr
board = attiny85
board_build.f_cpu = 1000000L ;8MHz
framework = arduino
upload_protocol = stk500v1
; each flag in a new line
upload_flags =
-P$UPLOAD_PORT
-b$UPLOAD_SPEED
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, http://www.bdmicro.com/
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?