I feel like you haven’t shown your full platformio.ini. When I use your platformio.ini and comment out the build_flags and lib_deps (because they refer to a not-shown [common] section) and try to upload fuses, I instead get
>pio run -t fuses -v
Processing attiny84_usbasp (board_build.f_cpu: 16000000L; board_fuses.lfuse: 0xFF; board_fuses.hfuse: 0xDF; board_fuses.efuse: 0xFE; platform: atmelavr; board: attiny84; framework: arduino; board_bootloader.file: optiboot_attiny84.hex; upload_protocol: custom; upload_port: usb; upload_flags: -C, C:\Users\Max\.platformio\packages/tool-avrdude/avrdude.conf, -p, $BOARD_MCU, -P, $UPLOAD_PORT, -c, usbasp; upload_command: avrdude $UPLOAD_FLAGS -U flash:w:$SOURCE:i)
----------------------------------------------------------------------------------------------------
CONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/attiny84.html
PLATFORM: Atmel AVR (4.2.0) > Generic ATtiny84
HARDWARE: ATTINY84 16MHz, 512B RAM, 8KB Flash
DEBUG: Current (simavr) External (simavr)
PACKAGES:
- framework-arduino-avr-attiny @ 1.5.2
- tool-avrdude @ 1.60300.200527 (6.3.0)
- toolchain-atmelavr @ 1.70300.191015 (7.3.0)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 9 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Warning: The `custom` upload protocol is used! The upload and fuse flags may conflict!
More information: https://docs.platformio.org/en/latest/platforms/atmelavr.html#overriding-default-fuses-command
Selected fuses: [lfuse = 0xFF, hfuse = 0xDF, efuse = 0xFE]
avrdude -p attiny84 -C "C:\Users\Max\.platformio\packages\tool-avrdude@1.60300.200527\avrdude.conf" -C C:\Users\Max\.platformio\packages/tool-avrdude/avrdude.conf -p attiny84 -P usb -c usbasp -Ulock:w:0xff:m -Uhfuse:w:0xDF:m -Ulfuse:w:0xFF:m -Uefuse:w:0xFE:m
avrdude: error at C:\Users\Max\.platformio\packages/tool-avrdude/avrdude.conf:402: syntax error
avrdude: error reading system wide configuration file "C:\Users\Max\.platformio\packages/tool-avrdude/avrdude.conf"
*** [fuses] Error 1
==================================== [FAILED] Took 1.78 seconds ====================================
So it totally tries to burn the fuses but the double -C option in upload_flags screws with it. Remoiving that gives me
Selected fuses: [lfuse = 0xFF, hfuse = 0xDF, efuse = 0xFE]
avrdude -p attiny84 -C "C:\Users\Max\.platformio\packages\tool-avrdude@1.60300.200527\avrdude.conf" -p attiny84 -P usb -c usbasp -Ulock:w:0xff:m -Uhfuse:w:0xDF:m -Ulfuse:w:0xFF:m -Uefuse:w:0xFE:m
avrdude: error: could not find USB device with vid=0x16c0 pid=0x5dc vendor='www.fischl.de' product='USBasp'
avrdude done. Thank you.
So that should wourk when you have the actual programmer connected.
In short, make sure you run the “Set Fuses” project task in the right environtment. If you are using the commandline, use the -e <environment name> section ot specify it. If in the GUI, make sure you are selecting the Set Fuses task for the attiny84_usbasp environment.
That said, I forgot to mention, that it will program the fuses with platformio run -t fuses no problem, this error only occurs when running platformio run -t bootloader.
Thank you… I had no idea there was a separate specification for board_bootloader.{l,h,e}fuse. I read the same documentation, and my eyes missed this subtle difference, not expecting there to be multiple definitions for the fuses.
Which doesn’t really make too much sense, right? You are likely to have the same fuses for whatever code you’re running or flashing on the same MCU, i would imagine…