Avrdude confusion

I have a sketch for the Nano Every that I can download in the IDE. I want to use the avrdude command by itself for various reasons (field updates, for example). I turn on the verbose programming option and upload code within Arduino IDE. I copy the avrdude command. The command contains paths to all of the files. I open a command prompt and paste the same command. I get "avrdude: jtagmkII_getsync(): sign-on command: status -1" over and over, which appears to mean it can't connect.

I see that the IDE does a reset just before it executes the avrdude command. I have also seen that some folks say a double manual reset is required. I have tried manually resetting and it doesn't fix the problem. What is the proper reset to get avrdude to program in this case?

Here is my command line:
"C:\Users\rtkee\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude" "-CC:\Users\rtkee\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf" -v -V -patmega4809 -cjtag2updi -PCOM3 -b115200 -e -D "-Uflash:w:C:\Users\rtkee\AppData\Local\arduino\sketches\70D6C609D275F679A9CE15E20FDDDC91/Chladni_sketch.ino.hex:i" "-Ufuse2:w:0x01:m" "-Ufuse5:w:0xC9:m" "-Ufuse8:w:0x00:m" {upload.extra_files}

Forcing reset using 1200bps open/close on port COM3

This "reset" is the 1200 bps touch on the com port which puts the NanoEvery into programming mode.

You need to open and close the port at 1200 baud with a terminal program or something like a python script or windows batch program.

Then when you issue the command line with the file path to upload it will go.

So this should work as a PowerShell script, right? It doesn't. Just opening and closing a COM port does nothing.

$port= new-Object System.IO.Ports.SerialPort COM3,1200,None,8,one
$port.Open()
$port.Close()

I don't know anything about using power shell.

I don't normally load code from the command line, but I did work through the process to verify that I could load from the command line after using a terminal program to open and close the port at 1200 baud.

What is strange is that after the command line upload using the 1.8.19 IDE some sort of error is now persistent when loading through the IDE.

C:\Users\Owner\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude -CC:\Users\Owner\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf -v -patmega328p -carduino -PCOM9 -b115200 -D -Uflash:w:C:\Users\Owner\AppData\Local\Temp\arduino_build_779380/BareMinimum.ino.hex:i 
java.io.IOException: Cannot run program "C:\Users\Owner\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude": CreateProcess error=193, %1 is not a valid Win32 application
	at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
	at processing.app.helpers.ProcessUtils.exec(ProcessUtils.java:26)
	at cc.arduino.packages.Uploader.executeUploadCommand(Uploader.java:129)
	at cc.arduino.packages.uploaders.SerialUploader.runCommand(SerialUploader.java:383)
	at cc.arduino.packages.uploaders.SerialUploader.uploadUsingPreferences(SerialUploader.java:197)
	at cc.arduino.UploaderUtils.upload(UploaderUtils.java:77)
	at processing.app.SketchController.upload(SketchController.java:732)
	at processing.app.SketchController.exportApplet(SketchController.java:703)
	at processing.app.Editor$UploadHandler.run(Editor.java:2061)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.io.IOException: CreateProcess error=193, %1 is not a valid Win32 application
	at java.lang.ProcessImpl.create(Native Method)
	at java.lang.ProcessImpl.<init>(ProcessImpl.java:386)
	at java.lang.ProcessImpl.start(ProcessImpl.java:137)
	at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
	... 9 more
An error occurred while uploading the sketch

Uploads fine with either the command line, or with IDE 2.3.4 but not with 1.8.19

Hi @rtkeen. AVRDUDE now has a built-in capability to provide this "1200 bps touch":

https://avrdudes.github.io/avrdude/8.0/avrdude_4.html#index-_002dr

-r

Opens the serial port at 1200 baud and immediately closes it, waits 400 ms for each -r on the command line and then establishes communication with the programmer. This is commonly known as a "1200bps touch", and is used to trigger programming mode for certain boards like Arduino Leonardo, Arduino Micro/Pro Micro and the Arduino Nano Every. Longer waits, and therefore multiple -r options, are sometimes needed for slower, less powerful hosts.

Unfortunately this feature is not present in the version 6.3.0-arduino17 of AVRDUDE you are currently using, but it is present in newer versions. You can get the latest version (8.0-arduino1) from the download links under the "Assets" section of this page:

https://github.com/arduino/avrdude-packing/releases/latest

@ptillisch

Do you know what is producing the java error with an IDE upload shown in Post #4 which showed up after using the command line to upload a sketch.

I do know that this error occurs when the executable has been corrupted. However, I would expect the same error to also occur when the executable was invoked via command line or Arduino IDE 2.3.4.

Is the same executable being used from the command line and from Arduino IDE 2.3.4? I am referring to the one at the path shown in the error message you shared:

Yes. While investigating the issue I have been trying to load either "Bare Minimum" or "Blink" from the examples. I have been using a Uno as a target.

I have uninstalled and reinstalled 1.8.19 on a Windows 11 computer. Uploads are fine with either the command line, or with IDE 2.3.4 but not with 1.8.19

Upload error message with 1.8.19

Sketch uses 444 bytes (1%) of program storage space. Maximum is 32256 bytes.
Global variables use 9 bytes (0%) of dynamic memory, leaving 2039 bytes for local variables. Maximum is 2048 bytes.
C:\Users\Owner\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude -CC:\Users\Owner\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf -v -patmega328p -carduino -PCOM10 -b115200 -D -Uflash:w:C:\Users\Owner\AppData\Local\Temp\arduino_build_191430/BareMinimum.ino.hex:i 
java.io.IOException: Cannot run program "C:\Users\Owner\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude": CreateProcess error=193, %1 is not a valid Win32 application
	at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
	at processing.app.helpers.ProcessUtils.exec(ProcessUtils.java:26)
	at cc.arduino.packages.Uploader.executeUploadCommand(Uploader.java:129)
	at cc.arduino.packages.uploaders.SerialUploader.runCommand(SerialUploader.java:383)
	at cc.arduino.packages.uploaders.SerialUploader.uploadUsingPreferences(SerialUploader.java:197)
	at cc.arduino.UploaderUtils.upload(UploaderUtils.java:77)
	at processing.app.SketchController.upload(SketchController.java:732)
	at processing.app.SketchController.exportApplet(SketchController.java:703)
	at processing.app.Editor$UploadHandler.run(Editor.java:2061)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.io.IOException: CreateProcess error=193, %1 is not a valid Win32 application
	at java.lang.ProcessImpl.create(Native Method)
	at java.lang.ProcessImpl.<init>(ProcessImpl.java:386)
	at java.lang.ProcessImpl.start(ProcessImpl.java:137)
	at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
	... 9 more
An error occurred while uploading the sketch

Successful upload message with 2.3.4.

Sketch uses 444 bytes (1%) of program storage space. Maximum is 32256 bytes.
Global variables use 9 bytes (0%) of dynamic memory, leaving 2039 bytes for local variables. Maximum is 2048 bytes.
"C:\Users\Owner\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude" "-CC:\Users\Owner\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf" -v -V -patmega328p -carduino "-PCOM10" -b115200 -D "-Uflash:w:C:\Users\Owner\AppData\Local\arduino\sketches\28AD5BE95FFD36CAD7A2DC9024A51607/BareMinimum.ino.hex:i"

avrdude: Version 6.3-20190619

EDIT:
If I remove avrdude version 6.3.0-arduino17 from the folder in tools containing the program and leave only avrdude version 8.0-arduino.1 (which I have from using MegaCoreX) the upload with 1.8.19 is successful.

I was able to get version 8.0 of avrdude to work well for me. Thank you ptillisch for this information. I don't know what the rest of this thread is doing. It looks like somebody hijacked my original thread.

1 Like

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