"Upload and set fuses" not working - but separate steps work?

As described in the topic, when i press “Upload and set fuses” is it not working, failing with the below log. If i do it in two separate steps, everything works?

platformio.exe run --target fuses --target upload <

> Executing task: C:\Users\XX\.platformio\penv\Scripts\platformio.exe run --target fuses --target upload <


Processing attiny85 (platform: atmelavr; board: attiny85; framework: arduino)
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

CONFIGURATION: h11ttps://docs.platformio.org/page/boards/atmelavr/attiny85.html
PLATFORM: Atmel AVR 2.0.0 > Generic ATtiny85
HARDWARE: ATTINY85 8MHz, 512B RAM, 8KB Flash
PACKAGES:
 - framework-arduino-avr-attiny 1.3.2       
 - tool-avrdude 1.60300.190424 (6.3.0)      
 - toolchain-atmelavr 1.50400.190710 (5.4.0)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 10 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <Bounce2> 2.53 (Z:\Projekter\PCB Projekter\MT-AUTORELAY\SOFTWARE\.pio\libdeps\attiny85\Bounce2_ID1106)
Building in release mode
Selected fuses: [lfuse = 0xe2, hfuse = 0xdf, efuse = 0xff]
avrdude -p attiny85 -C C:\Users\XX\.platformio\packages\tool-avrdude\avrdude.conf -c stk500v2 -PCOM4 -Ulock:w:0xff:m -Uhfuse:w:0xdf:m -Ulfuse:w:0xe2:m -Uefuse:w:0xff:m
MethodWrapper(["checkprogsize"], [".pio\build\attiny85\firmware.elf"])
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [=         ]   8.0% (used 41 bytes from 512 bytes)
Flash: [==        ]  16.3% (used 1334 bytes from 8192 bytes)
.pio\build\attiny85\firmware.elf  :

section                    size      addr

.text                      1326         0

.data                         8   8388704

.bss                         33   8388712

.comment                     48         0

.note.gnu.avr.deviceinfo     60         0

.debug_info                1056         0

.debug_abbrev              1000         0

.debug_line                  26         0

.debug_str                  361         0

Total                      3918
<lambda>(["upload"], [".pio\build\attiny85\firmware.hex"])
AVAILABLE: stk500v2
CURRENT: upload_protocol = stk500v2
BeforeUpload(["upload"], [".pio\build\attiny85\firmware.hex"])
avrdude -PCOM4 -v -p attiny85 -C C:\Users\XX\.platformio\packages\tool-avrdude\avrdude.conf -c stk500v2 -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 "C:\Users\XX\.platformio\packages\tool-avrdude\avrdude.conf"

         Using Port                    : COM4
         Using Programmer              : stk500v2
avrdude: ser_open(): can't open device "\\.\COM4": Adgang nægtet.(Access denied)

avrdude done.  Thank you.

*** [upload] Error 1

avrdude: stk500v2_command(): warning: Command timed out
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.


avrdude done.  Thank you.

*** [fuses] Error 1

I tried adding a delay using extra_script (env.AddPostAction and env.AddPreAction), but regardless of length nothing changes

I tried cascading the commands in the powershell terminal, and this of course also worked fine.

C:\Users\XX.platformio\penv\Scripts\platformio.exe run --target upload; C:\Users\XX.platformio\penv\Scripts\platformio.exe run --target fuses

Bug reports for Atmel AVR platform to Issues · platformio/platform-atmelavr · GitHub please with

  • full platformio.ini and minimal code
  • hardware description
  • reproduction steps
  • used PlatformIO and atmel-avr version (pio --version, pio platform show atmelavr, should be Version: 2.1.0)

so developers can track it directly.