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}
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
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:
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.