Download Firmware from Micro Pro MEGA32U4

I have joystick controller board that is using the Mico Pro and the USB port is loose. I bought another one but need the firmware (program) off of the bad one. I have been doing research but have not been successful trying to use the ARVDUDE program. It seems it should work and while the board is functional I want to get the program off. I understand it will be in hex, just want to transfer it to new one.

Thanks!

First, we’re going to do a dummy upload in the Arduino IDE in order to get it to help us generate the avrdude command used to read the program from the Arduino board:

Plug your Arduino board into your computer.

Select your board from the Arduino IDE’s Tools > Board menu.

Select your board’s port from the Tools > Port menu.

VERY IMPORTANT: Unplug your board from your computer.

File > Preferences

Check the box next to “Show verbose output during > upload”.

Click “OK”.

Sketch > Upload

Wait for the upload to fail.

Scroll up the black console window at the bottom of the Arduino IDE window until you see the avrdude command that was generated for the upload. It will look something like this:

E:\Arduino\hardware\tools\avr\avrdude -CE:\Arduino\hardware\tools\avr/etc/avrdude.conf -v -patmega328p -carduino -PCOM17 -b115200 -D -Uflash:w:C:\Users\per\AppData\Local\Temp\arduino_build_91864/sketch_jan22b.ino.hex:i

Select the full text of the upload command.

Press Ctrl + C. This will copy the upload command to the clipboard.

Next, you need to modify the upload command to read the hex file out of your Arduino board:

Start a text editor program.

In the text editor window, press Ctrl + V. This will paste the command into the text editor. The end of the command will look something like this:

-D -Uflash:w:C:\Users\per\AppData\Local\Temp\arduino_build_91864/sketch_jan22b.ino.hex:i

That is the part of the command that tells it to write.

Replace that part of the command with the command that tells AVRDUDE to read:

-Uflash:r:readfile.hex:i

That will cause the read file to be named “readfile.hex”, which will be saved to whichever folder you run the command from. So now the full command looks something like this:

E:\Arduino\hardware\tools\avr\avrdude -CE:\Arduino\hardware\tools\avr/etc/avrdude.conf -v -patmega328p -carduino -PCOM17 -b115200 -D -Uflash:r:readfile.hex:i

If the paths in the command contain spaces, wrap the paths in quotes.

Plug your Arduino board into your computer.

Copy and paste the command from the text editor to the command line

If you are using to an ATmega32U4-based board (e.g., Leonardo, Micro, Yun), you’ll need to press and release the reset button on the board immediately after running the command. If you are using a Pro Micro, use a wire to momentarily connect the RST and GND pins. If you are using a Yun, press and release the “32U4 RST” button quickly twice. Wait about a second after resetting the board before running the command.

Run the command.

Wait for the command to finish successfully.


You can follow a similar procedure to write the file to another Arduino board. Remember that this file was compiled specifically for the Arduino board you read it from. You can’t use it with an Arduino board that has a different configuration. For example, if you read it from an Uno, it is compiled for an ATmega328P running at 16 MHz with a boot section of 0.5 kB.

First, we’re going to do a dummy upload in the Arduino IDE in order to get it to help us generate the avrdude command used to write the program to the Arduino board:

Plug the Arduino board you want to write to into your computer.

Select your board from the Arduino IDE’s Tools > Board menu.

Select your board’s port from the Tools > Port menu.

File > Preferences

Check the box next to “Show verbose output during > upload”.

Click “OK”.

Sketch > Upload

Wait for the upload to finish.

Scroll up the black console window at the bottom of the Arduino IDE window until you see the avrdude command that was generated for the upload. It will look something like this:

E:\Arduino\hardware\tools\avr\avrdude -CE:\Arduino\hardware\tools\avr/etc/avrdude.conf -v -patmega328p -carduino -PCOM17 -b115200 -D -Uflash:w:C:\Users\per\AppData\Local\Temp\arduino_build_91864/sketch_jan22b.ino.hex:i

Select the full text of the upload command.

Press Ctrl + C. This will copy the upload command to the clipboard.

Next, you need to modify the upload command to write the hex file you read from your other Arduino board:

Start a text editor program.

In the text editor window, press Ctrl + V. This will paste the command into the text editor. The end of the command will look something like this:

-D -Uflash:w:C:\Users\per\AppData\Local\Temp\arduino_build_91864/sketch_jan22b.ino.hex:i

That is the part of the command that tells it to write.

Replace the filename in that part of the command with the name of the file you read:

-Uflash:w:readfile.hex:i

So now the full command looks something like this:

E:\Arduino\hardware\tools\avr\avrdude -CE:\Arduino\hardware\tools\avr/etc/avrdude.conf -v -patmega328p -carduino -PCOM17 -b115200 -D -Uflash:w:readfile.hex:i

If the paths in the command contain spaces, wrap the paths in quotes.

Plug your Arduino board into your computer.

Copy and paste the command from the text editor to the command line

If you are uploading to an ATmega32U4-based board (e.g., Leonardo, Micro, Yun), you’ll need to press and release the reset button on the board before running the command. If you are using a Pro Micro, use a wire to momentarily connect the RST and GND pins. If you are using a Yun, press and release the “32U4 RST” button quickly twice. Wait about one second before running the command.

Run the command.

Wait for the writing process to finish successfully.

Thanks you for detailed instructions. The board is the Mico Pro so as you said I will have to short the pins.

I am waiting for the new board to come in since I do not want to upload any code to the existing one. Once the new board comes in I can try to download and wipe it out and upload the code.

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