Uploading to Arduino Nano Every - avrdude can't open config file

Hi there,

I’m trying to upload a simple LED blink file to a Nano Every AT4809. When I try to upload to the Arduino, I get the following error.

avrdude: can't open config file "C:\Users\Jordan": No such file or directory
avrdude: error reading system wide configuration file "C:\Users\Jordan"

I think this has to do with avrdude being configured incorrectly, but I’m not sure. I’ve unzipped the latest avrdude files into my program files, and added that directory to the path, but the issue persists.

Any ideas on what I’m doing wrong?

Thanks.

Edit: Figured out the issue. avrdude was not accepting spaces in my file path. I used this thread with this fix as a guide.

Essentially, in .\platformio\platforms\atmelmegaavr\builder\main.py, starting from line 75, change from:

 UPLOADERFLAGS=[
        "-p", "$BOARD_MCU", "-C",
        '"%s"' % join(env.PioPlatform().get_package_dir(
            "tool-avrdude-megaavr") or "", "avrdude.conf"),
        "-c", "$UPLOAD_PROTOCOL"
    ],

To:

UPLOADERFLAGS=[
        "-p", "$BOARD_MCU", "-C",
        join(env.PioPlatform().get_package_dir(
            "tool-avrdude-megaavr") or "", "avrdude.conf"),
        "-c", "$UPLOAD_PROTOCOL"
    ],

And that seemed to fix it.

Interesting that platform-atmelavr gets it right

but platform-atmelmegaavr doesn’t…

Fix proposed in Fix path escaping for AVRDude config file by maxgerhardt · Pull Request #14 · platformio/platform-atmelmegaavr · GitHub

Fix has been accepted into platform as per Fix path escaping for AVRDude config file by maxgerhardt · Pull Request #14 · platformio/platform-atmelmegaavr · GitHub.

To use it, remove your old \.platformio\platforms\atmelmegaavr\ folder again and then, in each project’s platformio.ini that uses the Nano Every AT4809, change from

platform = atmelmegaavr

to

platform = https://github.com/platformio/platform-atmelmegaavr.git

Once a new version of platform-atmelmegaavr will be released, you can just do a pio platform update (or the equivalent in the VSCode GUI) and keep using the normal platform = atmelmegaavr from then.