Skip to content

Backup Arduino Nano Every #1961

@mladenb

Description

@mladenb

Hi,

I've recently encountered an issue, trying to send the reset/touch signal (using 1200 baud) to my Arduino Nano Every in order to backup the binary version of the currently running sketch. After running this command:

/usr/local/bin/avrdude -vv -p atmega4809 -c jtag2updi -r -b 115200 -P /dev/ttyACM0 -U flash:r:board.hex:i

I got the following response:

Avrdude version 8.0-20250311 (8c4b69ac)
Copyright see https://github.com/avrdudes/avrdude/blob/main/AUTHORS

System wide configuration file is /usr/local/etc/avrdude.conf
User configuration file /root/.avrduderc does not exist

Touching serial port /dev/ttyACM0 at 1200 baud
Waiting for new port... using same port /dev/ttyACM0
Using port            : /dev/ttyACM0
Using programmer      : jtag2updi
Programmer baud rate  : 115200
JtagmkII_open_pdi()
JtagmkII_getsync() attempt 1 of 10: sending sign-on command: 
Error jtagmkII_recv_frame() jtagmkII.c 575: timeout
Warning jtagmkII_getsync() jtagmkII.c 650: attempt 1 of 10: sign-on command: status -1
JtagmkII_getsync() attempt 2 of 10: sending sign-on command: 
Error jtagmkII_recv_frame() jtagmkII.c 575: timeout
Warning jtagmkII_getsync() jtagmkII.c 650: attempt 2 of 10: sign-on command: status -1
JtagmkII_getsync() attempt 3 of 10: sending sign-on command: 
Error jtagmkII_recv_frame() jtagmkII.c 575: timeout
Warning jtagmkII_getsync() jtagmkII.c 650: attempt 3 of 10: sign-on command: status -1
JtagmkII_getsync() attempt 4 of 10: sending sign-on command: 
Error jtagmkII_recv_frame() jtagmkII.c 575: timeout
Warning jtagmkII_getsync() jtagmkII.c 650: attempt 4 of 10: sign-on command: status -1
JtagmkII_getsync() attempt 5 of 10: sending sign-on command: 
Error jtagmkII_recv_frame() jtagmkII.c 575: timeout
Warning jtagmkII_getsync() jtagmkII.c 650: attempt 5 of 10: sign-on command: status -1
JtagmkII_getsync() attempt 6 of 10: sending sign-on command: 
Error jtagmkII_recv_frame() jtagmkII.c 575: timeout
Warning jtagmkII_getsync() jtagmkII.c 650: attempt 6 of 10: sign-on command: status -1
JtagmkII_getsync() attempt 7 of 10: sending sign-on command: 
Error jtagmkII_recv_frame() jtagmkII.c 575: timeout
Warning jtagmkII_getsync() jtagmkII.c 650: attempt 7 of 10: sign-on command: status -1
JtagmkII_getsync() attempt 8 of 10: sending sign-on command: 
Error jtagmkII_recv_frame() jtagmkII.c 575: timeout
Warning jtagmkII_getsync() jtagmkII.c 650: attempt 8 of 10: sign-on command: status -1
JtagmkII_getsync() attempt 9 of 10: sending sign-on command: ^[[A^[[A^C

with a little help from Arduino forum, I've managed to successfully download the hex file to my local computer, using a python script that does that 1200 baud reset a bit different, using a small delay between opening and closing the com channel.

Here's the script, so you can see what helped to put my Arduino Nano Every into UPDI mode properly:

#!/usr/bin/python3
# Based on https://github.com/arduino/ArduinoCore-megaavr/issues/124#issuecomment-1330763422
#   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, time
# 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()
    time.sleep(0.5)
    ser.close()

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

I've posted this message in hope it could help you perhaps understand what could be improved with the "-r" option of the avrdude (great product btw, thank you a lot for creating it!).

Cheers

Metadata

Metadata

Assignees

No one assigned

    Labels

    unconfirmedMaybe a bug, needs to be reproduced by someone else

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy