Hex file is not written to the Nano Every with avrdude from the command line

When I use Platformio with the VS Code IDE, the code is uploaded without errors. However, when I use the command line I get the following message:

./avrdude -v -pATmega4809 -C avrdude.conf -c jtag2updi -Ufuse2:w:0x01:m -Ufuse5:w:0xC9:m -Ulock:w:0xC5:m -b 115200 -V -e -D -P "COM8" -U flash:w:firmware.hex:i

avrdude: Version 7.1
Copyright the AVRDUDE authors;
see https://github.com/avrdudes/avrdude/blob/main/AUTHORS

     System wide configuration file is D:\bin\avrdude7.1\avrdude.conf

     Using Port                    : COM8
     Using Programmer              : jtag2updi
     Overriding Baud Rate          : 115200

avrdude: Found device at port 'COM8'
avrdude jtagmkII_getsync() warning: attempt 1 of 10: sign-on command: status -1
avrdude jtagmkII_getsync() warning: attempt 2 of 10: sign-on command: status -1
avrdude jtagmkII_getsync() warning: attempt 3 of 10: sign-on command: status -1
avrdude jtagmkII_getsync() warning: attempt 4 of 10: sign-on command: status -1
avrdude jtagmkII_getsync() warning: attempt 5 of 10: sign-on command: status -1
avrdude jtagmkII_getsync() warning: attempt 6 of 10: sign-on command: status -1
avrdude jtagmkII_getsync() warning: attempt 7 of 10: sign-on command: status -1
avrdude jtagmkII_getsync() warning: attempt 8 of 10: sign-on command: status -1
avrdude jtagmkII_getsync() warning: attempt 9 of 10: sign-on command: status -1
avrdude jtagmkII_getsync() warning: attempt 10 of 10: sign-on command: status -1
avrdude jtagmkII_getsync() error: timeout/error communicating with programmer (status -1)
avrdude main() error: unable to open programmer jtag2updi on port COM8

avrdude done. Thank you.

Is there a solution?

Hi @funkelbach. You must do what is known as a "1200 bps touch" on the serial port of the Nano Every before starting the upload.

Opening the CDC serial port of the Every is used as a signal to the "MuxTO" firmware on the ATSAMD11 USB interface chip that it should switch to the flashing mode. The Arduino development software and Platformio do that "touch" automatically before running the AVRDUDE command, but when you run the AVRDUDE command directly you must do it yourself.

Since it is such a common requirement, the AVRDUDE developers actually added a "touch" capability to the tool itself just last week:

But such a capability is not present in the AVRDUDE 7.1 version you are using.

Thank you! It is working now by using the from Git.

You are welcome. I'm glad the timing was so perfect with the feature you needed having been added only days before!

I normally use Arduino IDE or Arduino CLI for all my uploads, but have had some occasions in the past where I needed to upload to the Nano Every using AVRDUDE directly and found the need to improvise a "touch" quite inconvenient. I didn't find a good solution for doing it on Windows (though I didn't spend much time looking). I actually ended up resorting to using the arduino-cli monitor command, which was silly but did the job in the end.

Regards,
Per

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.