Bricked Pro Micro: Uploaded clone hex via avrdude in terminal

Hello, First time post. Thanks for any help in advance.

I had a little midi controller based around a Pro Micro, the Pro Micro was broken (usb port) and so I was able to order a new Pro Micro and get it installed.

Once I had done this, I needed the code from the old controller, which I was able to download via avrdude using the readfile.hex command.

I then uploaded this hex file to the free Pro Micro. Okay, so here’s the issue. The new Pro Micro works fine, but refuses to boot into the bootloader when reset. It just shows a single green light and refuses to show up anymore.

I’m assuming this is becase the hex file I uploaded perhaps didn’t include a bootloader? I have no also tried hooking up my Mega2560 and using it as an ISP to load a fresh bootloader on the Pro Micro, but whenever I do this I get “avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00”.

I’ve quadruple checked my wiring and it seems correct. The only thing I can think is that the script that’s on the Pro Micro makes it use port “/dev/cu.usbmodemMIDI1”. This makes it impossible to contact when in normal mode via the Mega2506 as ISP, and because it has no bootloader, impossible to reset.

So I guess my question is… do I have to trash this Pro Micro? Is there a way to wipe it entirely clean using avrdude. Am I missing something?

I suspect your new micro has wrong fuse values. How were you able to load hex to the new micro, with what setup?

With your MEGA2560, you should be able to connect to your micro regardless what it’s doing because MEGS2560 will pull low the reset line of the micro. My suggestion is to get this MEGA2560/Micro working, then use it to read out the fuse values of your old Micro, and set to your new Micro. It is possible that your new Micro was never loaded with a bootloader and fuse never set properly to the size of the bootloader. With the read on your old micro, you should have read both the code and bootloader, the entire FLASH because there is no way to just read the code without the bootloader.

Thanks so much for this. You may be right about the fuses, but because I can’t access anything on this new Pro Micro, I’m not able to either hook up the Mega effectively or reset it into bootloader.

Here is a detailed description of my journey if it helps, and thank you again.

To begin, I installed “Blinkies” on the Pro Micro and all was good and working.

Then I took the old Pro Micro (that I needed the code off of), reset it into bootloader, and ran this in terminal:
/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avrdude -C/Applications/Arduino.app/Contents/Java/hardware/tools/avr/etc/avrdude.conf -v -patmega32u4 -cavr109 -P/dev/cu.usbmodem14201 -b57600 -D -Uflash:r:readfile.hex

Then I took the new Pro Micro, reset it into bootloader, and ran this in terminal:
/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avrdude -C/Applications/Arduino.app/Contents/Java/hardware/tools/avr/etc/avrdude.conf -v -patmega32u4 -cavr109 -P/dev/cu.usbmodem14201 -b57600 -D -Uflash:w:readfile.hex

Once I did that, the new Pro Micro will run it’s hex code fine, but anytime I try to reset it into bootloader, it turns all lights off but a solid green light and won’t reset anymore. And the computer won’t recognize it.

At this point, I connected the MEGA2560 to try and burn a fresh bootloader. I opened the ArduinoISP sketch and edited the pin numbers to the values below and flashed it onto the MEGA:

#ifdef USE_OLD_STYLE_WIRING

#define PIN_MOSI 51
#define PIN_MISO 50
#define PIN_SCK 52

The sketch already had Reset defined for 10, so I didn’t touch it…

I then connected the MEGA2560 to the Pro Micro via a breadboard as follows:

50 → 14
51 → 16
52 → 15
5v → VVC
GND → GND
10 → RST

I then set all the preferences in the Arduino app as follows:
Board: “Sparkfun Pro Micro”
Processor: “ATmega32u4 (5v, 16mhz)”
Port: “/dev/cu.usbmodem14401”
Programmer: “Arduino as ISP (ATMEGA32U4)”

Finally, I select “Burn Bootloader”, and I continuously get the following error:

“avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00”

This is the same error I get when I try and reset the new Pro Micro and do anything to it going direct via usb.

I think that’s the wrong selection. Your ‘Arduino as ISP’ ist the Mega, and there is no ATMEGA32U4 processor on it. Select plain ‘Arduino as ISP’ as programmer.
The selection “Arduino as ISP (ATMEGA32U4)” would be correct if your pro Micro would be the programmer and not the device to be programmed.

1 Like

Thank you for the response! I made this adjustment and am still getting the “not in sync” error.

You’ve got to make your mega2560 work with your micros. There’s no secret in making it work. Just follow the official tutorial. Did you have a capacitor on your mega as instructed?

My suspicion: you used the bootloader to load your flash image but the bootloader can’t write onto itself so the bootloader is lost. The process is to first erase entire flash (code and bootloader both lost) and then write to flash. Because you didn’t use the ICSP header but relied on bootloader to write flash, the chip erase succeeded but because it is unable to write to bootloader region, your new chip only had program on and not bootloader. You can only fix your mistake if you manage to get mega to talk to micros and then redo what you did with that command, directed at mega’s port. Then micro will be in reset and communicates via the ICSP header, which can write to any flash region.

So get the tutorial working, first maybe with mega and another arduino, such as mega or uno. Then get it working with micro, and redo your flashing. Don’t flash with bootloader because bootloader is a program, and unable to write to bootloader region. That’s my guess.

1 Like

Thank you so much. You’ve solved it!

Let me recap for anyone who may find this one day with a similar issue.

Here is how I was able to unbrick the Pro Micro using a Mega2560 as an ISP Programmer.

To begin, make sure you’ve downloaded the SparkFun libraries for the Pro Micro in the “Manage Libraries” area.

  1. In the Arduino app, open File>Examples>ArduinioISP.

  2. Now make your settings in the Arduino app as follows:

Board: “Arduino Mega or Mega 2560”
Processor: “ATmega2560”
Port: “/dev/cu.usbmodem14401” (or wherever the Mega is showing up)
Programmer: “Arduino as ISP”

  1. Now upload the edited sketch to the Mega.

  2. Make sure all power is disconnected and connect the Mega2560 and the Pro Micro as follows:

MEGA: 51 → PRO MICRO: 16
MEGA: 50 → PRO MICRO: 14
MEGA: 52 → PRO MICRO: 15
MEGA: 10 → PRO MICRO: RST
MEGA: GND → PRO MICRO: GND
MEGA: 5v → PRO MICRO: VCC
(* I used the 5v and GND from that end digital pin area where I’m connecting everything else, in following with the graphic example Arduino provides.)

Finally, AND THIS IS CRITICAL, add a 10uf capacitor connecting the RESET and GND on the Mega2560. The long leg should sit in the reset pin.

  1. In the Arduino app, you’ll now select the preferences for the target board, in this case a Pro Micro. Those will be:

Board: “Sparkfun Pro Micro”
Processor: “ATmega32u4 (5v, 16mhz)”
Port: “/dev/cu.usbmodem14401”
Programmer: “Arduino as ISP”

  1. Now go to Tools and select “Burn Bootloader”.

Glad we solved one mystery today (night)! If you retrace your step that caused your board to brick, and just re-brick it, read back its flash using your now-working mega2560 setup, compare with the original read out from your old micro, you will notice that the original had content at the end (last 512 bytes or more), but the new one you re-bricked and read back had all FFFF. That kind of tells you you can’t write to bootloader region or change fuse values unless you’re are in the ICSP mode.

The “Boards” in that sentence is referring to the board used as the programmer, not the target of the programming.

By default, the USE_OLD_STYLE_WIRING macro is not defined, meaning the compiler completely ignores those lines:

The numbers you set are also the default when USE_OLD_STYLE_WIRING is not defined:

As liuzengqiang already explained, this is the wrong programmer setting when using the Mega as a programmer. This programmer should only be used when the programmer board uses the ATmega32U4 microcontroller. This is not referring to the target board.

The reason there are two flavors of “Arduino as ISP” programmer is because a specific protocol is needed when using the ATmega32U4-based Arduino boards as a programmer. As you discovered, that protocol will also work with Arduino boards that use other microcontroller models, so there’s no problem with you using it. However, it makes it so that the reset disabling capacitor is always necessary. Most people find that when they use the “Arduino as ISP” programmer selection with a board that uses a microcontroller other than ATmega32U4, the capacitor is not necessary. The requirement to use the capacitor makes what many people find to be an extremely challenging procedure just a little bit more complex.

1 Like

Thanks again, this is all super helpful. Makes perfect sense 20/20 when you’re not troubleshooting each little thing one by one haha.

Editing my original post to reflect for clarity.

Thanks for taking the time to share the solution you found! I’m sure that others who have similar problems will be glad to find it.