Extracting binary code and programming Arduino Nano Every with campletely damaged usb port [SOLVED]

Hi everyone,

I need to extract the binary code (hex file) from an arduino nano every board that has a completely damaged (broken as well) usb port. Now while I an not a complete beginner I have never tried to extract the flash memory fro many type of board before. The project if you wanna call it that way was assigned to me at work because an analytical instrument that we have used the Nano every board for its operation and they knew I was the only person that likes electronics as a hobby (just started). Obviously I did not expect that I would need to do something like that when I just started electronics as a hobby but here we are.

From what I looked up online I most likely need a capable programmer that supports UDPI since this is what the nano every board uses. So far I have found:

  1. the Adafruit UDPI Friend programmer and
  2. Tigard-V1 (not sure if it supports udpi but it does support a whole lot of other serial protocols).

Do you have any suggestions regarding the two options I listed above and generally how to undertake this whole project from tools to approaches? Any help is greatly appreciated.

Solution preface

Hi everyone, I finally managed to do what I needed both extract the hex file as well as upload it in another Arduino Nano Every thus cloning the capabilities o the damaged device. I want to thank everyone here for their advice that help steer me the right direction. Below you will find the solution in case someone needs something similar in the future. I need to stress that this will not work if the memory on the board is read/write protected using the lock bit that prevents flash cloning.

Technical part of the solution
The external programmer was not used I just tried and succeeded holding the broken usb connector against the board thus creating a temporary connection. This was done with a small plastic clamp. Obviously you can try soldering the connection back or a usb cable but I do not have the skillset yet for such repair os such tiny pin heads. Once I saw that the board was powering up properly via the usb and that the board was showing up as a ttyACM0 I typed the following command on my terminal to read the firmware using avrdude directly:

stty -F 1200 && ./avrdude -p m4809 -c jtag2updi -P /dev/ttyACM0 -U flash:r:out.hex:r

The above command triggers a serial connection at 1200 baudrate that is needed by the ATSAMD11 usb chip on teh board requires to set itself on a programming mode. The rest of the command involves calling the avrdude program with teh necessary parameters to extract the hex file.

Now to upload the hex file to a functional arduino nano every board I typed the following on my terminal:

stty -F 1200 && ./avrdude -p m4809 -c jtag2updi -P /dev/ttyACM0 -U flash:w:out.hex

This does the same as the above command with the exception that it uploads the hex file to the board. All this was done via the normal usb port on the board.

In the end the analytical equipment with the new arduino nano board works as new. If you have any questions that I can answer let me know.

Find the author or source file or computer used to program the Arduino Every.

Is the Nano Every still operational? The schematic and board layout is available in the documentation, it should be possible to solder the wires from a USB cable onto the board and attempt to extract the data from there. Note that the fuses may have been set to prevent reading the flash memory, making this type of code retrieval impossible.

As mentioned, ask your colleagues at work for the project details.

Then determine whether the board works when powered up. Have you done that?

If it does, connect it to the appropriate programmer and if the memory is not locked, read it out.

Lots of hurdles! Help forum members (and yourself) by posting a close up, focused photo of the damaged board.

Unfortunately that is not possible at this point. I am not expecting to get the source code just clone the hex file and upload to a new identical board.

Unless the author is dead and buried with the computer holding the source code, it is entirely possible to ask where it originated.

Another, more beneficial approach, is to write new code and not bury it with the author.



I have uploaded here two photos of the board. I powered the Nano Every through my Arduino Uno R3 and it looks responsive. Furthemore, with my multimeter I tested the 5 volt pin and the 3V3 volt pin and I got 4.8V and 3.3V respectively. I assume this means the unit is working as expected. At least from a power perspective. In your opinion what is a good programmer to be able to extract the hex file if the memory is not locked?

If you had a programmer to where would you connect it?

The USB connector pads do not look damaged, might be easier to solder a new connector onto the board. A well-equipped cell phone repair place may have equipment for soldering USB connectors if you are unable to do it yourself.

The UPDI pin is available on the back of the board. See this post https://forum.arduino.cc/t/nano-every-as-programmer-and-target/1087534/4

Is this a commercially supplied instrument, or something built/modified by a previous employee? If its something coded by a previous employee then its not unreasonable to expect that the project files exist on a server or backup somewhere and just need locating and pulling off by an admin.

What software will you use to extract the hex file?

Definitely something to think about when choosing a programmer!

Just as a possible option, since the OP already has a UNO to hand, they might be able to use its UART as a UPDI programmer. If they have an FTDI adapter lying around, then that could that be made use of as an alternative. It does require a resistor and probably a diode and there are some caveats, hence a careful read of the information is recommended.

The information here has previously allowed me to program an ATtiny chip using an FTDI as a UPDI programmer. Admittedly I haven't tried it with an AVR board or for accessing/programming the 4809. The MegaCoreX board platform has support for the 4809 and there are several Serial-UPDI options in the Tools -> Programmer menu for that package so it might just be worth a try.

It might at least allow the OP to check whether the Every is locked or not before spending money on another programmer. Hopefully it might also allow him to extract the flash contents.

Any UPDI programmer from a reliable distributor should work, but the first thing to try would be to solder on a USB socket, or the naked wires from a known good data USB cable as already suggested.

To use the programmer, you will need a known good Nano Every to figure out and test the wiring, then learn how the process works, before working on the damaged board.

What does the Nano do on your work/company analytical instrument?

It's unusual, but not unheard of, for instruments to be modified, especially using a development board.

It sounds as though you've been lumbered with the task of getting it going again. Someone wrote the sketch/code and it should be stored somewhere, assuming it hasn't already been deleted.

If you gave some details of what the Nano did, it might be possible to suggest an alternative way of doing things.

You could politely ask them if they want you to do that sort of work, then let them pay for you to learn.

Install the latest version of AVRdudess.
Read the documentation.
Try it out on an uno and see if you can figure out how to read and write a hex file.

See what UPDI programmers will work with AVRdudess. Chose one and buy it. Now try to read and write a hex file from a Nano every.
If you get it to work, then read and write from your damaged board.

You have some secrecy there; just a thought.

If you can't get the source code to compile it yourself somebody might be able to generate the hex / binary file.

I decided that I will try to use the UNO as a programmer with the jtag2updi to see if I can extract the memory if it is not locked. If it is locked then thing get tricky as I would need to try to do a voltage injection to get the board to very low voltage to see if I can trick the fuses that lock the memory if at all possible.

If the memory is not locked I will use the UPDI Friend to try to extract the memory. I already got an identical Nano every that works to try to out the process first.

I will update based on the findings.

Good idea, since you can easily wipe out the flash or brick the board.

Are you working with @john65 ?