"Error uploading, check if the selected board is currently available"

I've read all I could find about this problem, but no luck. Hope somebody can point me in right direction.
I use the Windows IDE and an UNO, rev.3 open-source clone. I installed the Arduino agent version 1.2.4 and the CH340 driver 3.5 from wch.cn
When I plug-in the board, Windows plays a sound, COM3 is 'created' and in the IDE a temporary message is displayed that the board is available. Worrying is that the Agent's icon in the taskbar is light grey and not blue/green as the documentation says. Uploading a sketch gives the above error and opening the monitor gives "serial port unavailable". This is the present situation, I cannot get out. Directly after installing the IDE and agent, I was able to upload a sketch a couple of times. But not anaymore. What could be wrong?

The documentation that indicates the Arduino Create Agent's icon should be blue/green is outdated. The color was changed to white last year but they didn't bother to update the documentation at the same time:

The color is white (black on MacOS in light mode) on all systems.

This is how the icon looks on Windows when the agent is running:

This is how it looks on Windows when the agent is paused:

So as long as it is white rather than gray, everything is well.

In order to gather more information that might help us to troubleshoot your problem, I'm going to ask you to post the full output from the upload when in verbose mode.

Please do this:

  1. Attempt an upload.
  2. Wait for the upload to fail.
  3. Hover the mouse over the red bar at the bottom of the Arduino Web Editor that shows the error message. Click and drag it up so you can see the black console window.
  4. Click the icon in the top right corner of the console that looks like two pieces of paper.
  5. In a forum reply here, click on the reply field.
  6. Click the </> button on the forum toolbar. This will add the forum's code tags markup to your reply.
  7. Press Ctrl+V. This will paste the upload output between the code tags.
  8. Move the cursor outside of the code tags before you add any additional text to your reply.
/usr/local/bin/arduino-cli compile --fqbn arduino:avr:uno --libraries /home/builder/opt/libraries/latest --build-cache-path /tmp --output-dir /tmp/064885056/build --build-path /tmp/arduino-build-DF39D73952768AC6BCA3454AA9FD13E5 /tmp/064885056/sketch_nov5b

Sketch uses 1908 bytes (5%) of program storage space. Maximum is 32256 bytes.

Global variables use 202 bytes (9%) of dynamic memory, leaving 1846 bytes for local variables. Maximum is 2048 bytes.

Upload started

Programming with: Serial

Flashing with command:C:/Users/brand/.arduino-create/arduino/avrdude/6.3.0-arduino17/bin/avrdude.exe -CC:/Users/brand/.arduino-create/arduino/avrdude/6.3.0-arduino17/etc/avrdude.conf -v -patmega328p -carduino -PCOM3 -b115200 -D -Uflash:w:C:/Users/brand/AppData/Local/Temp/arduino-create-agent846350899/sketch_nov5b.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:/Users/brand/.arduino-create/arduino/avrdude/6.3.0-arduino17/etc/avrdude.conf"

Using Port : COM3

Using Programmer : arduino

Overriding Baud Rate : 115200

AVR Part : ATmega328P

Chip Erase delay : 9000 us


BS2 : PC2

RESET disposition : dedicated

RETRY pulse : SCK

serial program mode : yes

parallel program mode : yes

Timeout : 200

StabDelay : 100

CmdexeDelay : 25

SyncLoops : 32

ByteDelay : 0

PollIndex : 3

PollValue : 0x53

Memory Detail :

Block Poll Page Polled

Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack

----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------

eeprom 65 20 4 0 no 1024 4 0 3600 3600 0xff 0xff

flash 65 6 128 0 yes 32768 128 256 4500 4500 0xff 0xff

lfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00

hfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00

efuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00

lock 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00

calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00

signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00

Programmer Type : Arduino

Description : Arduino

Hardware Version: 3

Firmware Version: 4.4

Vtarget : 0.3 V

Varef : 0.3 V

Oscillator : 28.800 kHz

SCK period : 3.3 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e950f (probably m328p)

avrdude: safemode: lfuse reads as 0

avrdude: safemode: hfuse reads as 0

avrdude: safemode: efuse reads as 0

avrdude: reading input file "C:/Users/brand/AppData/Local/Temp/arduino-create-agent846350899/sketch_nov5b.hex"

avrdude: writing flash (1908 bytes):

Writing | ################################################## | 100% 0.34s

avrdude: 1908 bytes of flash written

avrdude: verifying flash memory against C:/Users/brand/AppData/Local/Temp/arduino-create-agent846350899/sketch_nov5b.hex:

avrdude: load data flash data from input file C:/Users/brand/AppData/Local/Temp/arduino-create-agent846350899/sketch_nov5b.hex:

avrdude: input file C:/Users/brand/AppData/Local/Temp/arduino-create-agent846350899/sketch_nov5b.hex contains 1908 bytes

avrdude: reading on-chip flash data:

Reading |

avrdude: stk500_paged_load(): (a) protocol error, expect=0x10, resp=0x00

###avrdude: stk500_cmd(): programmer is out of sync

avr_read(): error reading address 0x0000

read operation not supported for memory "flash"

avrdude: failed to read all of flash memory, rc=-2

avrdude: stk500_cmd(): programmer is out of sync

avrdude: stk500_cmd(): programmer is out of sync

avrdude: stk500_cmd(): programmer is out of sync

avrdude: stk500_cmd(): programmer is out of sync

avrdude: safemode: Sorry, reading back fuses was unreliable. I have given up and exited programming mode

avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x00

avrdude done. Thank you.

Do you have any wiring, shields, modules, etc. connected to the Uno? If so, try disconnecting everything and uploading to the Uno alone as an experiment. Also, make sure that the Uno is not sitting on a conductive surface (e.g., metal table) or any conductive object (e.g., bits of wire).

I don't think this problem is related to Arduino Create Agent.

Thanks! Disconnecting all external connections solved the problem. I can now reliably upload sketches.

Yay! I'm very glad to hear that.

Upload problems that result from connections on the Arduino board are usually caused by connections to pins 0 and 1. Those pins are also used to communicate with the computer. If possible, it is best to avoid connecting anything to those pins.

It is possible for other circuitry to cause problems, but that the pins 0 and 1 are the first thing I would check as you investigate this problem. If that wasn't it and you would like the forum members to offer some advice, then you can provide more details about your external circuits.

The thing is that I only use pins 12 (for input_pullup) and 13 (output) to drive a relais. But I also had to disconnect the 5V power to the relais board to be able to upload again. When resetting or powering-up the board, the relais sometimes switches a couple of times in quick succession. I find that odd and suspect there's something not quite OK.

Had to update my sketch on the Arduino and got again the error on COMx not available, even with all external connections to the board removed. When reading the serial port using power shell, I got the output from the current sketch - COM was functioning fine! Next step was to do a $port.Close(). Upload of the sketch after that, went OK! So solution seems to be, do an explcit port.close from PowerShell before attempting an upload.

$COM = [System.IO.Ports.SerialPort]::getportnames()
$port= new-Object System.IO.Ports.SerialPort $COM,9600,None,8,one
do {
} while($port.IsOpen)

I thought I had it all figured out; how wrong I was. I've tried everything, but all I get is message that access to the port is denied. Not only from the Arduino Web IDE, but also from PowerShell.

PS C:\Users\brand> $port

BaseStream             :
BaudRate               : 9600
BreakState             :
BytesToWrite           :
BytesToRead            :
CDHolding              :
CtsHolding             :
DataBits               : 8
DiscardNull            : False
DsrHolding             :
DtrEnable              : False
Encoding               : System.Text.ASCIIEncoding
Handshake              : None
IsOpen                 : False
NewLine                :

Parity                 : None
ParityReplace          : 63
PortName               : COM3
ReadBufferSize         : 4096
ReadTimeout            : -1
ReceivedBytesThreshold : 1
RtsEnable              : False
StopBits               : One
WriteBufferSize        : 2048
WriteTimeout           : -1
Site                   :
Container              :

PS C:\Users\brand> $port.Open()
Exception calling "Open" with "0" argument(s): "Access to the port 'COM3' is denied."
At line:1 char:1
+ $port.Open()
+ ~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : UnauthorizedAccessException

Any help would be much appreciated.

This type of error might be caused by the port already being open in another application. Only one application can have a port open at a time. That could even be a different browser tab of Arduino Web Editor with the port open in Serial Monitor.

If you can't find the application using the port, try restarting your computer. In rare cases, the port can get stuck open and restarting fixes that.

That seems to indicate that you need to give an argument. Not behind a PC at the moment to check the port command and play with it.

Thanks, restarting with the Arduino connected did the trick.

You are welcome. I'm glad to hear it is working now.

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