AVR upload suddenly stopped working

For months my platformio.ini file was providing me with consistently reliable build and upload on my custom ATmega38PB PCB with Arduino as ISP. Then suddenly yesterday morning when I started VSCode, PlatformIO updated itself to 3.6.0a10 and my uploads stopped working due to some extraneous double-quotes being inserted into the command stream. Can anyone help fix this?

This is my build/upload command:

pio run -t program --verbose

I now get:

avrdude: ser_open(): can't open device "\\.\com7 -b115200 -u -Ulock:w:0xCF:m -Uhfuse:w:0xD7:m -Uefuse:w:0xF6:m -Ulfuse:w:0xE2:m": The system cannot find the file specified.

because the avrdude.exe command line is this:

avrdude ""-Pcom7" "-b115200" -u -Ulock:w:0xCF:m -Uhfuse:w:0xD7:m -Uefuse:w:0xF6:m -Ulfuse:w:0xE2:m" -v -p atmega328pb -C C:\Users\jon\.platformio\packages\tool-avrdude\avrdude.conf -c stk500v1 -U flash:w:.pioenvs\atmega328pb\firmware.hex:i

The relevant part of my platformio.ini is this:

platform = atmelavr
board = atmega328pb
framework = arduino
monitor_port = com6
monitor_speed = 115200
upload_port = com7
upload_speed = 19200
upload_protocol = stk500v1
; upload_protocol=usbtiny
upload_flags = -P$UPLOAD_PORT -b$UPLOAD_SPEED -u -Ulock:w:0xCF:m -Uhfuse:w:0xD7:m -Uefuse:w:0xF6:m -Ulfuse:w:0xE2:m

Could you split upload_flags to 1 option per 1 line? it will force PlatformIO to use flags as an array:

upload_flags = 

That worked. Thank you very much Ivan. Hopefully the documentation can be updated to reflect this advice soon.

Thanks! Fixed in Redirecting...

1 Like