Flashing micro controllers with Arduino IDE or Platform.io are fairly simple when you have the source code of your sketch but there are times where all you have is the HEX file and you need a simple way to program your Pro Micro or other micro controllers quickly.

Both Arduino and Platform.io use a program called AVRDude in the background for flash but figuring our all the parameters and what come ports to use with AVRDude can also get quite complex standalone.

So, I found a much easier way to to use a minimal version of AVRDude and I created a simple command you can run at the command prompt to flash your Pro Micro.

All you have to do is:

  1. Download this zip file and unzip it to a folder on your drive
  2. Copy your HEX file to the same folder
  3. Open a command prompt and go to the same folder
  4. Attach your Pro Micro to your PC USB port.
  5. Type PROG followed by your Hex file name and hit enter.

That’s it. You will see something like below and you are DONE!

 

 

How it Works

If you are wondering how this works or if you have trouble, here is a step by step details of what the PROG command does. PROG is a batch file PROG.BAT in the same folder that runs a series of commands. In short:

PROG looks for the Pro Micro attached to your PC by searching for a device called “USB Serial Device” to see what COM port it is.   If you open up your device manager, you will see something like this. As you can see mine is on COM8.

If it was a Blank one, it would instead say “Arduino Leonardo” and why you need to use PROGB instead as it searches for Arduino Leonardo instead of USB Serial Device.

Now that it knows which COM port the device is on, it resets that port with command:   mode COM8: baud=12 > nul

This causes the Pro Micro to go into bootloader mode for about 8 seconds. If you have device manager open, you will see the device change to something like this:

As you can see, it now in boot loader mode and its on COM4.

If for some reason it does not go to bootloader mode, you can manually force the Pro micro into this mode by shorting RST and GND pins for a quick second while its plugged in.

Force Update without Bootloader using PROG

In some cases, the bootloader may not be present and this means we cant reset the device with com ports. 

To manually force the update:  

  1. Type PROG followed by your Hex file name and hit enter.
  2. Type 0 and hit enter to Skip
  3.  It will ask you to reset the device manually.  Press Reset/Firmware update button on the device or Short the RST and GND pins and then 1 second later type 1 and press enter. this will list the COM port for the device.
  4. Type the COM port number, press reset again, and press enter.

Force Update without PROG – Command Line Only

When it all fails, you can just directly force the firmware update as follows.

  1. Use this command to find and list all come ports:
    • wmic path Win32_SerialPort Where “Caption LIKE ‘%%COM%%'” Get Description, DeviceID
  2. Now, Reset the device using the firmware update button or shorting RST and GND pins, and run the command again:
  3. Notice for me COM5 is the new item that showed up so i know the device is on COM5
  4. if your find your port, skip to step 6
  5. Another way to find the port is Go to device manager, manually reset the device with RST/GND  or firmware update button, and quickly locate the Ports (COM & LPT) section.  you will see it appear there for about 8 seconds. It will then disappear.    
  6.  Now type the following command replacing the COM5 port with your number and replacing the hex file name with the one you want to flash.
    • avrdude.exe -pm32u4 -cavr109 -D -PCOM5 -b57600 -Uflash:w:DuoPlusH11V907.hex