0

I may have bricked my Arduino Pro Micro by writing a broken code into the setup() function. When I plug my Pro Micro into my PC, I see it register a COM port for a brief moment before it disappears. Grounding and ungrounding the RST pin causes the device to appear in my control panel again for a brief moment. Attempting to upload the blink example from the Arduino IDE fails, since the COM port disappears before the process can complete.

Is there an alternate way of flashing code to the arduino which I could possibly use to fix this? I have a working Pro Nano I could use if needed.

2
  • Try grounding RST twice in quick succession.
    – Majenko
    Dec 17, 2018 at 0:18
  • 1
    When working with any microcontroller it can be good practice to always have a hardware programmer on hand. Bootloaders are all very well, but when they go wrong they leave you stuck. Hit eBay for a USB-ASP (~$2 from China - get the adaptor with it).
    – Majenko
    Dec 17, 2018 at 0:23

2 Answers 2

2

You can try running the code upload command directly using a precompiled hex file.

Here is how.

Go to preferences in Arduino IDE

Set the Show verbose output during: upload option.

Upload the blink sketch. (arduino does not have to be connected)

After the compilation, check the log window at bottom of the IDE.

You will find a line like this:

E:\arduino\hardware\tools\avr/bin/avrdude -CE:\arduino\hardware\tools\avr/etc/avrdude.conf -v -patmega328p -carduino -PCOM3 -b115200 -D -Uflash:w:C:\Users\xxxxxxx\AppData\Local\Temp\build918c1e88f8d0a4c453f8bdfce4cccd30.tmp/Blink.ino.hex:i

That is the actual code upload command.

Copy the command line and paste it into a windows CMD window.

Edit the COM port to match your Arduino.

Reset the Arduino and immediately press Enter to run the command line.

You may get lucky and the upload "squeaks" through.

You can also move the hex file to another folder so that it is always available for doing a quick recovery.

You could also create a BAT file so that double-click on the icon runs the upload.

2

After Majenko's suggestion I tried looking into USB ASPs, and then did research about whether you can use an arduino as an ASP. Sort of. I'm not sure if an ASP is exactly the same thing as an ISP, but I used an Arduino Nano as an ISP to program the Arduino Pro Micro.

To do this, I opened the ArduinoISP example sketch and burned it to the Nano (over USB). Then I connected it to a breadboard, along with the Pro Micro. Connected the following pins:

nano pin          micro pin
13                15 (SCK)
12                14 (MISO)
11                16 (MOSI)
10                RST
5v                5v
GND               GND

It is important to connect a capacitor from Nano RST to GND. I was told to use a 10uF capacitor but I had a 1uF on hand that worked just fine. Then I opened up the Blink example sketch, set up the Arduino IDE for programming the Pro Micro, and set programmer to "Arduino as ISP". Hold shift, click upload, problem solved. Pro Micro is running Blink and I can now recognize it and program it over USB.

So I agree with Majenko; someone faced with this problem should buy a hardware programmer. But only if you don't have a spare Arduino ;)

2
  • The ASP in USBasp is just part of the name. It probably stands for something like USB Atmel/AVR Serial Programmer. It still uses the ISP protocol.
    – Gerben
    Dec 17, 2018 at 16:13
  • It's worth mentioning that my Arduino-Arduino programmer has begun to fail me. I'm not sure exactly why, but I'm no longer able to pull this off. More research required. I'm purchasing a USBasp to see what I can salvage. Jan 17, 2019 at 6:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.