"avrdude: ser_open(): can't open device "\\.\COM9": Access is denied.

Hi Guys,

I have a 5V, 16MHz Pro-Mini that I programmed successfully via my PC’s USB (COM4) with the standard “blink” sketch modified only to pulse D8 (pin 12 on the 32 TQFP ATMEGA) using the Sparkfun FTDI Basic board, I then de-soldered the ATMEGA328P from the Pro Mini and mounted it in a 32 pin TQFP socket attached to a PCB that had been manufactured.

The socket has a 16MHz oscillator, associated caps and an LED wired-up so that I could verify that the ATMEGA328P that I removed from the Pro Mini can still run the aforementioned blink sketch. It blinks correctly … so I figure that based on this, de-soldering the part did not damage it and that my oscillator is working (the power for the socketed ATMEGA is coming from my computer’s USB port via a micro USB connector on the PCB). All good so far.

I then populated FTDI’s FT232RL (the same device that Sparkfun use on their FTDI Basic) onto my PCB and then tried to upload a modified version of the “blink” sketch (same as before, but with twice the standard blink frequency) via my computer’s USB, connected to my PCB via the mini USB and I get the following error;

“avrdude: ser_open(): can’t open device “\.\COM9”: Access is denied.”

I went to my PC’s device manager and checked the driver and the settings for COM9 and COM4, they appear to be the same.

The Sparkfun FTDI basic board always shows-up on COM4 and “my” FT232RL (on the PCB) always shows-up as COM9 (just FYI … I don’t know if this is relevant). I’ve looked over my schematic again and again, I can’t find anything wrong with it.

Any thoughts from the community would be appreciated. I’ve attached the schematic associated with the PCB.

Many thanks,
Tim.

That error has nothing to do with your board :wink: (It doesn't get that far).

That error is common if you have another application already using that COM port. Aka, check if you closed other serial monitors / Putty etc. Or, in case a application didn't close the port correctly, a reboot should fix it.

1 Like

Thank you for the response, Septillion ... Initially, I was scratching my head about your comment, because I thought I only had one peripheral plugged into any external ports on my laptop (of any kind) ... that being the USB from my computer to either the Sparkfun FTDI or my own PCB ... then I realized that I have a Plugable UD-3900 USB 3.0 Universal Docking Station plugged into one of my USB 3.0 ports (driving two displays, keyboard and mouse) ... so I'm wondering if that might be the culprit?

When I get chance I will remove that dock, use my laptop in a standalone mode and try again.

Many thanks,
Tim.

Hi All,

I disconnected the USB docking station so that the only connection to my laptop was that of the USB connection to my PCB, but same result. I have rebooted the Arduino IDE and my laptop ... no dice, same error.

I then used a completely different laptop ... same result, i.e. sketch loads OK to a populated (spare) Pro Mini on COM10 and fails to load with same error message observed on the original laptop, but complains about COM12, instead.

I guess you could say that I'm really stumped, are there any other avenues of investigation that anyone can advise?

Many thanks,
Tim.

Mm, if you really get the same message then there is an application using that COM port. Might be a completely non related program. For example, in the past someone had a driver for a Bluetooth device which took control over his Arduino thinking it was the device to control. You could try to assign it a different COM number in device manager.

Another possibility is that the driver is faulty. In device manager, there is no error with the device? Aka, no ! near it? And "device status: This device is working properly."?

I guess you could say that I'm really stumped, are there any other avenues of investigation that anyone can advise?

Looks like you have no auto reset. Compare this to yours. Should pin 19 reset on the Ft232r be connected to USBVCC?

Hi kprims,

Thank you. I don't think that's it ... according to the FT232R datasheet "reset" can be pulled high (i.e. held inactive) or left unconnected, if not used. I left mine unconnected, as does the Spartkfun FTDI Basic board, which I have used successfully to program my Pro Mini.

Also, "septillion" made the comment that

septillion:
That error has nothing to do with your board :wink: (It doesn't get that far)

... and I think that is borne out by my experience of plugging the Sparkfun FTDI Basic board into my computer's USB port, when I do so, the tx and rx lights flicker for a little while (indicating some sort of handshake?) ... however, when I plug-in my PCB, no activity on the tx or rx lines of the FTDI chip.

I'm resisting the temptation to replace the FTDI chip on my PCB with a new spare FTDI that I have and still resisting the temptation (for now) of exchanging the FTDI chip on my Sparkfun FTDI Basic board with the one on my PCB (to eliminate the FTDI device on my PCB).

I think my next step is to poke around the device manager some more, to see if I can see anything odd (I paraphrase "septillion's" thoughts / recommendations).

Thanks for responding to the thread ... if any further inspiration strikes you, I'd be happy to receive it.
Tim.

Connect up your Sparkfun FTDI Basic board to your test points and see if you can load that way.

Your USB connector pin 4 is shown not connected and no decoupling capacitor across pin 4 and pin 1.

If you are satisfied you have a good connection to your PC, a loopback test would help isolate the problem also.

Hi Septillion,

There doesn’t appear to be anything strange about the drivers, i.e. no error messages and/or warnings. I have the latest FTDI driver installed. I changed the COM port that had been automatically allocated to my PCB (some of them claimed to be “in use”, so I selected one that did not have this demarcation) … the change was picked-up in the Arduino IDE, but same issue during a sketch upload, with the exception that the error made reference to the new port number that I had allocated manually (of course).

Many thanks,
Tim.

Hi kprims,

Great idea.

I removed the FTDI chip from my PCB and soldered four flying leads to my test pads, power, ground, TX and RX, attached flying leads to power, ground, TX and RX on the Sparkfun FTDI and powered-up my PCB via the computer's USB port, LED still flashing. Attempted to load sketch, same issue.

Disconnected flying leads from Sparkfun FTDI, removed ATMEG328P from socket and checked continuity between flying lead TX and pin 30 on IC socket and between flying lead RX and pin 31 on IC socket, it checked out.

Pushed on the socket lid ... lifted the socket lid and manually pushed the IC onto the socket's spring fingers ... LED still flashes, but same issue upon upload.

I'm drawn to "Once you eliminate the impossible, whatever remains, no matter how improbable, must be the truth" ... alas, what remains? (I ask myself).

Many thanks,
Tim.

The design of my PCB was taken from the “Building an Arduino on a Breadboard” article posted at the following URL;

https://www.arduino.cc/en/Main/Standalone

About half way down the page, there’s an image of the finished breadboard (I’ve attached it to this post) … it shows a Sparkfun FTDI board with its TX and RX pins connected to the RX and TX pins of the Arduino, respectively … and that’s it ! (in terms of the comms).

My next experiment will be to build this set-up myself using my existing Sparkfun FTDI board … but first I need to order some through-hole parts. I’ll post again once I’ve tried that.

Many thanks,
Tim.

Through-hole parts arrived, ATmega328P (pre-bootloaded by Adafruit) and through hole crystal and caps. Instead of using the Adafruit ATmega, I removed the ATmega from my R3 UNO, built-up the breadboard, added power/gnd and the LED flashed, as expected ... it was the same Blink sketch that was loaded on the R3 UNO before I pulled the ATmega from it. I then connected Sparkfun's FTDI Basic board to the breadboard, power, ground, tx and rx and attempted to program;

"avrdude: ser_open(): can't open device "\.\COM4": Access is denied"

Removed the flying leads from the Sparkfun FTDI basic board and connected the FTDI Basic board to ProMini ... programmed the same Blink sketch just fine (on COM4) ... then went back to the breadboard (changed the target, of course) ... same error;

"avrdude: ser_open(): can't open device "\.\COM4": Access is denied"

.... went back to the ProMini ... sketch programmed just fine, on COM4.

Although I seem not that much closer to getting to root cause, I think this experiment is telling me that I don't have an issue on COM4, in particular (septillion, would you agree with that assessment?).

I have just ordered the version of the Sparkfun FTDI board that the Arduino breadboard uses in its tutorial (SparkFun USB to Serial Breakout - FT232RL - BOB-12731 - SparkFun Electronics) ... it has a ferrite bead (I think, but the symbol looks weird) on the USB power line, but apart from that I cannot see any difference between it and the FTDI board that I'm using currently.

I'll post again once I've tested with the new FTDI board.

You try to use the same serial adapter (FTDI) for the stand alone chip and the Pro Mini?

TimHo:
I then connected Sparkfun's FTDI Basic board to the breadboard, power, ground, tx and rx

Don't forget DTR via a cap to RST. :wink:

Thanks septillion ... that was it, it was necessary to connect DTR via a cap to the reset of the ATMEGA. Frustratingly, the documentation that I have read either explicitly states that is it not necessary (Sparkfun's website) or implies it (the ATMEGA breadboard tutorial ... which shows only an RX and TX connection). Still, you knew better.

Many thanks,
Tim.

Is there a way to mark as “solved”?

Mm, yeah, not all tutorials are great... And strictly you don't need it. But then you have to push reset yourself and release it the moment the IDE tries to upload. Did that in the past (adapter I was using did not break out DTR) but you get annoyed pretty quick :smiley:

To mark it as solved, just edit the title of your first post :slight_smile:

Subject updated "[Solved]"