Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nano Every on linux: "avrdude: jtagmkII_getsync(): sign-on command: status -1" when uploading sketches #124

Open
chconnor opened this issue Nov 27, 2022 · 16 comments

Comments

@chconnor
Copy link

chconnor commented Nov 27, 2022

Hello -- with IDE 2.0.2 or 1.8.19 running on Kubuntu Linux 22.04 I am unable to upload sketches to the Nano Every.

It gives many errors like this:

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

...eventually followed by:

Failed uploading: uploading error: exit status 1

The same sketch/board/USB cable/USB port combination works fine in Windows 10 on IDE 2.0.2.

I have found, in Linux, that if I change the Serial monitor to 1200 baud (from the default of 9600), and then upload the sketch, it works. After that I can upload the sketch at any baud rate, including 9600 baud, until the board is power cycled.

I was told this was the place to report this issue. Let me know if I can provide any other information.

Verbose console output, in case it's useful:

/home/savel/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino5/bin/avr-size -A /tmp/arduino-sketch-014E27C2218B86F33F99FEE7D689DAE1/Telemetrix4Arduino.ino.elf
Sketch uses 21797 bytes (44%) of program storage space. Maximum is 49152 bytes.
Global variables use 1630 bytes (26%) of dynamic memory, leaving 4514 bytes for local variables. Maximum is 6144 bytes.
Performing 1200-bps touch reset on serial port /dev/ttyACM0
"/home/savel/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17/bin/avrdude" "-C/home/savel/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17/etc/avrdude.conf" -v -V -patmega4809 -cjtag2updi -P/dev/ttyACM0  -b115200 -e -D "-Uflash:w:/tmp/arduino-sketch-014E27C2218B86F33F99FEE7D689DAE1/Telemetrix4Arduino.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 "/home/savel/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17/etc/avrdude.conf"
         User configuration file is "/home/savel/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/ttyACM0
         Using Programmer              : jtag2updi
         Overriding Baud Rate          : 115200
avrdude: jtagmkII_getsync(): sign-on command: status -1
avrdude: jtagmkII_getsync(): sign-on command: status -1
...
avrdude: jtagmkII_getsync(): sign-on command: status -1
avrdude: jtagmkII_getsync(): timeout/error communicating with programmer (status -1)

avrdude done.  Thank you.

Failed uploading: uploading error: exit status 1

I also tried with MegaCoreX on IDE 1.8.19. Same behavior -- although one difference is that 1.8.19 remembers the last baud rate (2.0.2 reverts to 9600 every time). If I just open the serial monitor window (already at 1200), but don't change baud, that's enough to "fix" it and make it work.

@facchinm
Copy link
Member

Hi @chconnor ,
we found this problem some time ago and it looks like a regression in the linux kernel; basically the "set 1200bps" message and the "open port" were well separated (some milliseconds) while in recent kernels (but not on all distributions) the second is being sent immediately after the first, creating some confusion in the D11 firmware.
Setting the port at 1200bps separately gives the fw some time to properly set its internal state.
We definitely need to allocate some time to fix the issue mainline (or simply add a quirk for the Nano every) beacuse updating the D11 firmware is not viable for most of the users.
@agdl

@tehkillerbee
Copy link

tehkillerbee commented Nov 29, 2022

@chconnor We have the same issue. We made a small python script to be executed before attempting to upgrade firmware. This script performs the baud rate "handshake" and also makes sure to enable hupcl as it is needed for arduino reset. It seems the Arduino IDE is also supposed to do this, but for some reason it does not work properly. Perhaps this is explained by @facchinm .

#!/usr/bin/python3
#   Run this script to reset the Arduino Nano Every
#   eg. sudo python3 mcu_reset.py
#
# Note: You must install pyserial first; i.e. sudo pip3 pyserial

import serial
import os, sys
# total arguments
n = len(sys.argv)
if n >= 2:
    port = sys.argv[1]
else:
    port = '/dev/ttyACM0'

print("Port: {}".format(port))

#re-enable hupcl temporarily (necessary for arduino reset using serial port)
os.system('sudo /bin/stty -F {} hupcl'.format(port))

try:
    #perform Arduino Nano Every reset "handshake"
    ser = serial.Serial()
    ser.baudrate = 1200
    ser.port = port
    ser.open()
    ser.close()

except serial.SerialException:
    print("Error: serial.SerialException")
    exit()

@gratefulfrog
Copy link

Hi,
I am getting this same bug on my Ubuntu system
Distributor ID: Ubuntu
Description: Ubuntu 22.04.4 LTS
Release: 22.04
Codename: jammy
and further:
Operating System: Ubuntu 22.04.4 LTS
Kernel: Linux 6.5.0-18-generic
Architecture: x86-64
Hardware Vendor: Framework
Hardware Model: Laptop 13th Gen Intel Core

Arduion IDE:
Version: 2.3.2
Date: 2024-02-20T09:54:08.669Z
CLI Version: 0.35.3

It is really annoying, is there any solution coming?

Also, when the error message starts appearing:
avrdude: jtagmkII_getsync(): sign-on command: status -1
avrdude: jtagmkII_getsync(): sign-on command: status -1
...
There seems to be no way to abort the upload?

Is there any way to abort the upload without closing the IDE?

Thanks for all the great Arduino stuff - I am a supporter from day 1!

@gratefulfrog
Copy link

Hi,
Here is some more info, now the nano seems to get burning hot as it fails to upload...

Hi,
I have a similar or the same issue with a nano every...
I can sometimes, but not often upload to it...
The board sometimes, often, gets burning hot.

Below is the output from an attempt to upload blink, (attached my conf file).

I am at a loss, and there seems to be no way to abort the uploading process, which is really painful...

Any help would be greatly appreciated, my project is being killed by these delays... And now I fear that the board is burning up...

for blink (my config file is attached)à

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 "/home/bob/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17/etc/avrdude.conf"
         User configuration file is "/home/bob/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/ttyACM0
         Using Programmer              : jtag2updi
         Overriding Baud Rate          : 115200
avrdude: jtagmkII_getsync(): sign-on command: status -1
avrdude: jtagmkII_getsync(): sign-on command: status -1
avrdude: jtagmkII_getsync(): sign-on command: status -1
avrdude: jtagmkII_getsync(): sign-on command: status -1

avrdude.conf.zip

@gratefulfrog
Copy link

This is an ongoing issue and quite painful.

I learned that setting the serial monitor to 1200 baud, BEFORE UPLOADING, will mostly make the upload work.

After the upload works once, the serial monitor can be set to anything and the upload will continue to work, as long as the Nano Every is not powered off. I am not sure what happens if the reset button is pressed, though.

It would be nice if someone were to integrate this workaround into the the Arduino IDE (I am using version 2.3.2 , on Ubuntu 22.04.04)

Cheers,
B

@rph-r
Copy link

rph-r commented Jun 2, 2024

Hello,
I have this issue for years and years, and I'm working a lot with nanos. On 1.8.19 I simply had to click several times on Upload and finally it was working, until I unplugged the Arduino.
Now on 2.3.2, IDE get stuck on uplaoding... and I have to quit.
Painful, as you said...

@anttiryt
Copy link

For me resetting the arduino remotely helped.
I have Nano Everys with sign-on command: status -1 problems.
Suddenly flash worked in a jif ( sorry my stepper is still not moving ).

This short script helped me reset Nano Every ( https://stackoverflow.com/a/55985897/468921 )

sleep 1
while true; do    
    echo -en "\x01\x02"    
    sleep 0.1
 done | socat -T1 -t1 - /dev/ttyACM1,hupcl=1,raw,b1000000,cs8,echo=0

@w-u-2-o
Copy link

w-u-2-o commented Aug 25, 2024

How are people programming their Nano Every boards? How can this not be fixed after 18 months?

I'm a brand new Arduino user, but a highly experienced engineer, so not a "newbie". I'm suffering with the same issues here with my very first Arduino board which, unfortunately, is a Nano Every. I can't go to another board, this is replacing a Nano in an existing project and I need the extra memory of the Every.

Environment is Windows 10 Pro, IDE 2.3.2. I tried IDE 2.0.2 but had the same problem. The IDE automatically detects the board and will read board info.

At this point I'm dead in the water. This seems ridiculous, Arduino development is supposed to be "easy".

Is there no work-around for this issue?

Is there a separate UPDI programmer I can use with the IDE? Perhaps this one?

FWIW, with the verbose option turned on here is the IDE output:

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\Radioserver2\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf"

         Using Port                    : COM6
         Using Programmer              : jtag2updi
         Overriding Baud Rate          : 115200
avrdude: jtagmkII_getsync(): sign-on command: status -1
avrdude: jtagmkII_getsync(): sign-on command: status -1
avrdude: jtagmkII_getsync(): sign-on command: status -1
avrdude: jtagmkII_getsync(): sign-on command: status -1
avrdude: jtagmkII_getsync(): sign-on command: status -1
avrdude: jtagmkII_getsync(): sign-on command: status -1
avrdude: jtagmkII_getsync(): sign-on command: status -1
avrdude: jtagmkII_getsync(): sign-on command: status -1
avrdude: jtagmkII_getsync(): sign-on command: status -1
avrdude: jtagmkII_getsync(): sign-on command: status -1
avrdude: jtagmkII_getsync(): sign-on command: status -1
avrdude: jtagmkII_getsync(): sign-on command: status -1
avrdude: jtagmkII_getsync(): sign-on command: status -1
avrdude: jtagmkII_getsync(): sign-on command: status -1
avrdude: jtagmkII_getsync(): sign-on command: status -1
avrdude: jtagmkII_getsync(): sign-on command: status -1
avrdude: jtagmkII_getsync(): sign-on command: status -1
avrdude: jtagmkII_getsync(): sign-on command: status -1
avrdude: jtagmkII_getsync(): sign-on command: status -1
avrdude: jtagmkII_getsync(): sign-on command: status -1
avrdude: jtagmkII_getsync(): sign-on command: status -1
avrdude: jtagmkII_getsync(): sign-on command: status -1
avrdude: jtagmkII_getsync(): sign-on command: status -1
avrdude: jtagmkII_getsync(): sign-on command: status -1
avrdude: jtagmkII_getsync(): sign-on command: status -1
avrdude: jtagmkII_getsync(): sign-on command: status -1
avrdude: jtagmkII_getsync(): sign-on command: status -1
avrdude: jtagmkII_getsync(): sign-on command: status -1
avrdude: jtagmkII_getsync(): sign-on command: status -1
avrdude: jtagmkII_getsync(): sign-on command: status -1
avrdude: jtagmkII_getsync(): sign-on command: status -1
avrdude: jtagmkII_getsync(): sign-on command: status -1
avrdude: jtagmkII_getsync(): sign-on command: status -1
avrdude: jtagmkII_getsync(): timeout/error communicating with programmer (status -1)

avrdude done.  Thank you.

Failed uploading: uploading error: exit status 1

@anttiryt
Copy link

anttiryt commented Aug 25, 2024

Overriding Baud Rate : 115200
avrdude: jtagmkII_getsync(): sign-on command: status -1
avrdude: jtagmkII_getsync(): sign-on command: status -1
avrdude: jtagmkII_getsync(): sign-on command: status -1
avrdude: jtagmkII_getsync(): sign-on command: status -1

FWIW, all my problems with -1 have been that another program is using the COM port. It seems, atleast on Linux, that only one program can access the special USB com port at a time.

I know you're using windows, but try to look if you can somehow find some other program that's using the COM port. is it possible there's two versions of the software running? Check out also process list and systray. Try uninstalling IDE and going with CLI. Or try uninstalling CLI and going with IDE.

Also, it's not a bad idea to use another computer to program the Arduino. Maybe an old laptop or an rPi? Just install CLI and use RDP.

@w-u-2-o
Copy link

w-u-2-o commented Aug 25, 2024 via email

@w-u-2-o
Copy link

w-u-2-o commented Aug 25, 2024

I just tried using IDE 2.3.2 on a fully up to date Linux Mint build. I got the same exact behavior as on Windows. Board was auto-detected. Board info could be read. Upload fails with same exact error messages.

@gratefulfrog
Copy link

gratefulfrog commented Aug 25, 2024 via email

@gratefulfrog
Copy link

gratefulfrog commented Aug 25, 2024 via email

@w-u-2-o
Copy link

w-u-2-o commented Aug 26, 2024

That work-around does not work for Windows. Apparently that is a Linux work-around only. So I proceeded to try this on the Linux machine I had set up in addition to Windows, as already noted above.

The instructions are not complete. You can't open the serial monitor and set it to 1200 without first connecting the board. So I did that. Then I disconnected and reconnected the board with the serial monitor already open and set to1200.

After that it took 2 tries to upload the sketch. The first try failed about halfway through. The second try appeared to be successful.

@gratefulfrog
Copy link

gratefulfrog commented Aug 26, 2024 via email

@w-u-2-o
Copy link

w-u-2-o commented Aug 28, 2024

Following up on this: right now it appears that there is some issue with my Windows machine. Linux works perfectly on a separate machine. I'm thinking it is some USB hardware limitation rather than a problem with Windows or drivers.

Final update (problem solved): testing on another Win10 machine was successful. Redoubling efforts on the first Win10 machine one of the initially suggested changes (from the Arduino Forum) turned out to be a bad move. Reversing that change, plus whatever else I did prior to doing that, fixed the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants