Uploading to arduinoNanoEvery does not finish

Hello
I'm having trouble uploading to arduino.
The port and board are correct, and Register emulation is “None (ATMEGA4809)”.
Of course, the arduino has also been reinstalled.
Below is the code log

Sketch uses 802 bytes (1%) of program storage space. Maximum is 49152 bytes.
Global variables use 22 bytes (0%) of dynamic memory, leaving 6122 bytes for local variables. Maximum is 6144 bytes.
Forcing reset using 1200bps open/close on port COM5
C:\Users\kazuk\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude -CC:\Users\kazuk\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf -v -patmega4809 -cjtag2updi -PCOM5 -b115200 -e -D -Uflash:w:C:\Users\kazuk\AppData\Local\Temp\arduino_build_232503/sketch_feb13b.ino.hex:i -Ufuse2:w:0x01:m -Ufuse5:w:0xC9:m -Ufuse8:w:0x00:m {upload.extra_files} 

avrdude: Version 6.3-20190619
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Users\kazuk\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf"

         Using Port                    : COM5
         Using Programmer              : jtag2updi
         Overriding Baud Rate          : 115200
An error occurred while uploading the sketch

As an additional note, I have also confirmed that the port is not occupied on the device manager.

Hi @yuyuka. Normally when an upload fails there are some specific error messages that give us some idea about the cause of the failure. Unfortunately in this strange case it is not providing anything other than the generic "An error occurred while uploading the sketch" message.

When you upload a sketch, Arduino IDE actually just runs a command line tool (in this case a tool named "AVRDUDE"). It is that tool that performs the upload, and it is that tool that is failing silently. My suggestion is for you to run the upload command directly from the command line. It is possible this will produce some form of error message that is not displayed when AVRDUDE is invoked by Arduino IDE as a sub-process. I'll provide instructions you can follow to do that:


:exclamation: This procedure is not intended to solve the problem. The purpose is to gather more information.


  1. Attempt an upload, just as you did before.
  2. Wait for the upload to fail.
  3. Examine the contents of the black output panel at the bottom of the Arduino IDE window. There you will see the avrdude command that Arduino IDE ran. It will look something like this:
  4. Click and drag the mouse pointer over the output panel to select the entire line that contains that avrdude command.
  5. Press the Ctrl+C keyboard shortcut.
    This will copy the selected text to the clipboard.
  6. Right click the Windows "Start" button.
    A context menu will open.
  7. Select "Search" from the menu.
    The Windows "Start" menu will open with a search field selected.
  8. Type windows powershell ise in the search field.
  9. Select "Windows PowerShell ISE" from the search results.
    A "Windows PowerShell ISE" window will open.
  10. Type the & character at the PowerShell command prompt.
  11. Press the Ctrl+V keyboard shortcut.
    This will paste the copied command to the PowerShell command prompt.
  12. Delete this part of the command:
    {upload.extra_files} 
    
    • This part of the command is expected and doesn't cause any problems when invoked using the Windows command interpreter as is done by Arduino IDE, but it confuses PowerShell so it is easiest to just remove it for this experiment.
    • The command should now look something like this:
      C:\Users\kazuk\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude -CC:\Users\kazuk\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf -v -patmega4809 -cjtag2updi -PCOM5 -b115200 -e -D -Uflash:w:C:\Users\kazuk\AppData\Local\Temp\arduino_build_232503/sketch_feb13b.ino.hex:i -Ufuse2:w:0x01:m -Ufuse5:w:0xC9:m -Ufuse8:w:0x00:m {upload.extra_files} 
      
  13. Press the Enter key.

The upload process will now run again, and most likely fail. My hope is that you will see a more descriptive error message this time. That might be displayed in a Windows dialog box, or in the PowerShell terminal. If so, please post the full and exact text of the error message here.

Thank you for your quick reply
When I run it, it seems that access to the COM port is denied.
I thought it might be occupied by another process, so I checked with Process Explorer, but it didn't hit.
It has been confirmed that UNO and ESP32 can be written with arduino.

C:\Users\kazuk\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude : 
発生場所 行:1 文字:1
+ C:\Users\kazuk\AppData\Local\Arduino15\packages\arduino\tools\avrdude ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError
 
avrdude.exe: Version 6.3-20190619
             Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
             Copyright (c) 2007-2014 Joerg Wunsch
             System wide configuration file is "C:\Users\kazuk\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino1
7/etc/avrdude.conf"
             Using Port                    : COM5
             Using Programmer              : jtag2updi
             Overriding Baud Rate          : 115200
avrdude.exe: ser_open(): can't open device "\\.\COM5": アクセスが拒否されました。
avrdude.exe done.  Thank you.

It might have been blocked by the port being open in the Arduino IDE Serial Monitor. The Serial Monitor is a view in the bottom panel of the Arduino IDE window and that panel has a tabbed design, so it is easy to not even notice that you have Serial Monitor open if another tab (e.g., the "Output" view) is selected.

You can close Serial monitor by clicking the X icon on the "Serial Monitor" tab in the bottom panel of the Arduino IDE window:

After that, try running the command again through PowerShell.

I should have mentioned that we will expect the upload to fail when you run the command through PowerShell even on a perfectly working system. The reason is that the Nano Every has to be put into a special mode in order to be able to accept an upload. It is put into that mode by momentarily opening the serial port, configured for 1200 baud (this is referred to as the "1200 bps touch"). The firmware on the Nano Every's USB chip sees that as a special signal and goes into the upload mode. Arduino IDE automatically performs the touch when you upload, before it invokes the avrdude command:

However, when the upload fails due to the board not being in the special upload mode, it produces a fairly distinctive error message:

avrdude.exe: jtagmkII_getsync(): sign-on command: status -1

In the failed upload, it doesn't look like the upload even got that far before failing, so my hope is that we might get something useful from the PowerShell experiment even though it is not providing all the conditions required to achieve a successful upload. There is probably some way to produce a "1200 bps touch" using PowerShell, but I'm not very familiar with PowerShell and it is likely to be fairly complex.

In the same way, I dropped the arduino process (I am using an older version of the IDE, and the new version had the same result), but the result did not change.
I tried running it in the same way on a friend's PC and it worked fine, so I decided to initialize Windows once.
Thank you for your response

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