Sparkfun Pro Micro wont upload after first sketch

I bought Pro Micro clones which seemed to have no bootloader installed, so I burned it usign an UNO as ISP.
After that I was able to upload a sketch to the Pro Micro.
But from that point on there is no way to upload a new sketch.
If I just try to upload it gives an error Caused by: jssc.SerialPortException: Port name - COM17; Method name - openPort(); Exception type - Port busy.
I guess this is due to the nature of the ATmega32U4 processor so it tried resetting it by connecting RST and GND twice. It then enters bootloader for 8 seconds indicated by RX and TX Leds flashing a few times.
But when I try uploading a new sketch in that time period the arduino IDE just waits till after the 8 seconds and then gives an error avrdude: ser_open(): can't open device "\\.\COM17": Access denied
When reburning the bootloader I'm once again able to upload one sketch.

Has anyone an idea how I reset the pro micro using the rst pin in the same way it resets when burning the bootloader.

You do the double reset trick when the IDE reports the memory usage, not before you start compiling because by the time that the upload starts the bootloader has probably timed out.

1 Like

I haven't thought about time being the problem but you might be right!
When uploading after reburning the bootloader it takes more than 9 seconds to upload even though its just the basic blink sketch.
I can't manage to upload within the 8 seconds even if I time the double click perfectly.

Is there a way to increase the 8 seconds or a good way to speed up the upload process?
I already turned off "Verify code after upload"

You don't have to finish the upload within 8 seconds, you just have to START the upload within 8 seconds.

That does not have any affect; as @westfw indicated, it's the start of the upload that needs to happen within time.

There is one point that I overlooked. If you don't have access to the port, the double tap reset does not (directly) work as the upload bails out at the moment that the port is not there or not accessible. So you will have to pick another port in the IDE. It can be any port.

  1. If your IDE shows other COM ports, you can pick any (e.g. COM1).
  2. If your IDE only shows the port for the ProMicro, do a double tap reset. Within the timeout period, you select the new port that should show in the IDE under tools -> port; note that the ports list in the IDE is only updated when you open the menu so don't leave it open and expect to see the change. My ProMicro is on COM14 and after the double tap it changes to COM16.

Next perform the upload. When the IDE reports the memory usage, do the double tap reset.

I've simulated your problem by opening COM14 in another application so avrdude can't access it; I selected COM1.

You can get the below output by enabling Show verbose output during upload in File -> Preferences in the IDE.

Sketch uses 3618 bytes (12%) of program storage space. Maximum is 28672 bytes.
Global variables use 175 bytes (6%) of dynamic memory, leaving 2385 bytes for local variables. Maximum is 2560 bytes.
Forcing reset using 1200bps open/close on port COM1
PORTS {COM1, COM8, COM13, COM14, } / {COM1, COM8, COM13, COM14, } => {}
PORTS {COM1, COM8, COM13, COM14, } / {COM1, COM8, COM13, COM14, } => {}
PORTS {COM1, COM8, COM13, COM14, } / {COM1, COM8, COM13, COM14, } => {}
PORTS {COM1, COM8, COM13, COM14, } / {COM1, COM8, COM13, COM14, } => {}
PORTS {COM1, COM8, COM13, COM14, } / {COM1, COM8, COM13, COM14, } => {}
PORTS {COM1, COM8, COM13, COM14, } / {COM1, COM8, COM13, COM14, } => {}
PORTS {COM1, COM8, COM13, COM14, } / {COM1, COM8, COM13, COM14, COM16, } => {COM16, }
Found upload port: COM16
...
...

And after that the upload succeeded. Once the upload has succeeded, you can switch the COM port in the IDE back to the original.

I will post some additional information in a next post.

Note:
COM ports can change; it might have worked with COM17 initially and later changed to COMxx.

The expected output in the IDE if you have verbose output enables looks like

Sketch uses 3618 bytes (12%) of program storage space. Maximum is 28672 bytes.
Global variables use 175 bytes (6%) of dynamic memory, leaving 2385 bytes for local variables. Maximum is 2560 bytes.
Forcing reset using 1200bps open/close on port COM14
PORTS {COM1, COM8, COM13, COM14, } / {COM1, COM8, COM13, } => {}
PORTS {COM1, COM8, COM13, } / {COM1, COM8, COM13, COM16, } => {COM16, }
Found upload port: COM16

I have a couple of Arduinos connected (COM8 and COM13 are Nanos, COM14 is a ProMicro, COM1 is a standard Windows port.

Note the line Forcing reset using 1200bps open/close on port COM14. This will reset the ProMicro on the given port. The lines following is where the IDE tries to determine the COM port of the boot loader.
In the first PORTS line, you can see COM14 disappear. In the second PORTS you can see COM16 appear. And you can see at the end of the line that it detected that COM16 is the upload port.

If a normal upload does not work (e.g. because you selected the wrong (but existing) port), you will see something as in the previous post

Sketch uses 3618 bytes (12%) of program storage space. Maximum is 28672 bytes.
Global variables use 175 bytes (6%) of dynamic memory, leaving 2385 bytes for local variables. Maximum is 2560 bytes.
Forcing reset using 1200bps open/close on port COM14
PORTS {COM1, COM8, COM13, COM14, } / {COM1, COM8, COM13, COM14, } => {}
PORTS {COM1, COM8, COM13, COM14, } / {COM1, COM8, COM13, COM14, } => {}
PORTS {COM1, COM8, COM13, COM14, } / {COM1, COM8, COM13, COM14, } => {}
PORTS {COM1, COM8, COM13, COM14, } / {COM1, COM8, COM13, COM14, } => {}
PORTS {COM1, COM8, COM13, COM14, } / {COM1, COM8, COM13, COM14, } => {}
PORTS {COM1, COM8, COM13, COM14, } / {COM1, COM8, COM13, COM14, } => {}

The double tap reset achieves the same as Forcing reset using 1200bps open/close on port COM14 but it is guaranteed to reset the correct device ;).

You can also follow what happens in Windows device manager

Normal operation
image

Upload mode
image

I think that that is all that there is to say.

Enabling verbose inputs helped me understand the process but I still cant get it working:

Sketch uses 3954 bytes (13%) of program storage space. Maximum is 28672 bytes.
Global variables use 149 bytes (5%) of dynamic memory, leaving 2411 bytes for local variables. Maximum is 2560 bytes.
Forcing reset using 1200bps open/close on port COM3
PORTS {COM3, COM4, COM19, } / {COM3, COM4, COM19, } => {}
PORTS {COM3, COM4, COM19, } / {COM3, COM4, COM19, } => {}
PORTS {COM3, COM4, COM19, } / {COM3, COM4, COM19, } => {}
PORTS {COM3, COM4, COM19, } / {COM3, COM4, COM19, } => {}
PORTS {COM3, COM4, COM19, } / {COM3, COM4, COM19, } => {}
PORTS {COM3, COM4, COM19, } / {COM3, COM4, COM19, } => {}
PORTS {COM3, COM4, COM19, } / {COM3, COM4, } => {}
PORTS {COM3, COM4, } / {COM3, COM4, } => {}
PORTS {COM3, COM4, } / {COM3, COM4, } => {}
PORTS {COM3, COM4, } / {COM3, COM4, } => {}
PORTS {COM3, COM4, } / {COM3, COM4, COM18, } => {COM18, }
Found upload port: COM18
C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avrdude -CC:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf -v -patmega32u4 -cavr109 -PCOM18 -b57600 -D -Uflash:w:C:\Users\peter\AppData\Local\Temp\arduino_build_320717/Blink.ino.hex:i 

avrdude: Version 6.3-20190619
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf"

         Using Port                    : COM18
         Using Programmer              : avr109
         Overriding Baud Rate          : 57600
An error occurred while uploading the sketch
avrdude: ser_open(): can't open device "\\.\COM18": Access denied



avrdude done.  Thank you.

The usual Pro Micro is on COM19 the bootloader always on COM18.

But the upload still fails

You will have to sort the "access denied" out. Not sure how. It might be your antivirus; you can temporarily disable it and see if it works after that.

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