Go Down

Topic: An error occurred while uploading the sketch. (Read 158386 times) previous topic - next topic

pert

avrdude: ser_open(): can't open device "\\.\COM4": The system cannot find the file specified.
Select the COM port of your Nano from the Arduino IDE's Tools > Port menu.

If you don't know which port is your Arduino, you can find it like this:
  • Unplug your Arduino board from the computer.
  • Tools > Port
  • Note the ports, if any, listed in the menu.
  • Close the Tools menu
  • Plug your Arduino board into the computer.
  • Tools > Port - The new port listed in the menu is your Arduino board.

ScienceMax

Hi, guys, I have an error :Re: An error occurred while uploading the sketch. can you please help me!!!!
I tried opening IDE by itself but I get the same error! can you please help me!!!!

ScienceMax

#62
Aug 19, 2019, 03:45 pm Last Edit: Aug 19, 2019, 03:50 pm by ScienceMax
I've gotten error :Re: An error occurred while uploading the sketch.
here is my code:


#include <Servo.h>
int pot1 = A0;
Servo myservo;
void setup() {
 // put your setup code here, to run once:
myservo.attach(0);
Serial.begin(6900);
}

void loop() {
 // put your main code here, to run repeatedly:
Serial.println(pot1);
myservo.write(90);
Serial.println(myservo.read());
delay(1000);
myservo.write(0);
Serial.println(myservo.read());
}


please help me!!

port: COM7
programmer: arduinoISP
board: uno
message: help!

pert

I've gotten error :Re: An error occurred while uploading the sketch
Please do this:
  • (In the Arduino IDE) File > Preferences
  • Uncheck the checkbox next to "Show verbose output during: compilation"
  • Check the checkbox next to "Show verbose output during: upload
  • Click "OK"
  • Sketch > Upload
  • After the upload fails, you'll see a button on the right side of the orange bar "Copy error messages" (or the icon that looks like two pieces of paper at the top right corner of the black console window in the Arduino Web Editor). Click that button.
  • In a forum reply here, click on the reply field.
  • Click the </> button on the forum toolbar. This will add the forum's code tags markup to your reply.
  • Press "Ctrl + V". This will paste the upload output between the code tags.
  • Move the cursor outside of the code tags before you add any additional text to your reply.

ScienceMax


pert

My instructions above were only intended to get the necessary information to troubleshoot your problem. There is nothing about them that should have solved the problem. However, I'm glad to hear it's working now. Enjoy!
Per


Sriman_singaravelan

Some one help me I have the same problem even though I used it many times but now I have that problem and it showing the message after a long time of uploading

pert

Some one help me I have the same problem even though I used it many times but now I have that problem and it showing the message after a long time of uploading
Please do this:
  • (In the Arduino IDE) File > Preferences
  • Uncheck the checkbox next to "Show verbose output during: compilation"
  • Check the checkbox next to "Show verbose output during: upload
  • Click "OK"
  • Sketch > Upload
  • After the upload fails, you'll see a button on the right side of the orange bar "Copy error messages" (or the icon that looks like two pieces of paper at the top right corner of the black console window in the Arduino Web Editor). Click that button.
  • In a forum reply here, click on the reply field.
  • Click the </> button on the forum toolbar. This will add the forum's code tags markup to your reply.
  • Press "Ctrl + V". This will paste the upload output between the code tags.
  • Move the cursor outside of the code tags before you add any additional text to your reply.

ck81

Hi,
I have the same problem. The output is the following:

Arduino: 1.6.11 (Windows 8.1), Board: "Arduino/Genuino Micro"

Sketch uses 4,136 bytes (14%) of program storage space. Maximum is 28,672 bytes.
Global variables use 148 bytes (5%) of dynamic memory, leaving 2,412 bytes for local variables. Maximum is 2,560 bytes.
Forcing reset using 1200bps open/close on port COM7
PORTS {COM1, COM7, } / {COM1, COM7, } => {}
PORTS {COM1, COM7, } / {COM1, COM7, } => {}
PORTS {COM1, COM7, } / {COM1, COM7, } => {}
PORTS {COM1, COM7, } / {COM1, COM7, } => {}
PORTS {COM1, COM7, } / {COM1, COM7, } => {}
PORTS {COM1, COM7, } / {COM1, COM7, } => {}
PORTS {COM1, COM7, } / {COM1, COM7, } => {}
PORTS {COM1, COM7, } / {COM1, COM7, } => {}
PORTS {COM1, COM7, } / {COM1, COM7, } => {}
PORTS {COM1, COM7, } / {COM1, COM7, } => {}
PORTS {COM1, COM7, } / {COM1, COM7, } => {}
PORTS {COM1, COM7, } / {COM1, COM7, } => {}
PORTS {COM1, COM7, } / {COM1, COM7, } => {}
PORTS {COM1, COM7, } / {COM1, COM7, } => {}
PORTS {COM1, COM7, } / {COM1, COM7, } => {}
PORTS {COM1, COM7, } / {COM1, COM7, } => {}
PORTS {COM1, COM7, } / {COM1, COM7, } => {}
PORTS {COM1, COM7, } / {COM1, COM7, } => {}
PORTS {COM1, COM7, } / {COM1, COM7, } => {}
PORTS {COM1, COM7, } / {COM1, COM7, } => {}
Uploading using selected port: COM7
C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avrdude -CC:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf -v -patmega32u4 -cavr109 -PCOM7 -b57600 -D -Uflash:w:C:\Users\CONSTA~1\AppData\Local\Temp\build9c9ef3bdfe2fccb480bc6e4bac749e41.tmp/Blink.ino.hex:i

avrdude: Version 6.0.1, compiled on Apr 15 2015 at 19:59:58
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

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

         Using Port                    : COM7
         Using Programmer              : avr109
         Overriding Baud Rate          : 57600
         AVR Part                      : ATmega32U4
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PA0
         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  9000  9000 0x00 0x00
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0x00 0x00
           lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           lock           0     0     0    0 no          1    0      0  9000  9000 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 : butterfly
         Description     : Atmel AppNote AVR109 Boot Loader

Connecting to programmer: .An error occurred while uploading the sketch

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.


Thanks.

pert

Hi,
I have the same problem. The output is the following:
Make sure you have the correct board selected from the Tools > Board menu.

Make sure you have selected the port of your Arduino board from the Tools > Port menu.

Sometimes the port will be labeled with the board name in the menu. Other times it will not. If you don't know which port is your Arduino, you can find it like this:
  • Unplug your Arduino board from the computer.
  • Tools > Port
  • Note the ports, if any, listed in the menu.
  • Close the Tools menu
  • Plug your Arduino board into the computer.
  • Tools > Port - The new port listed in the menu is your Arduino board.

jptrol

My case may be interesting in that the error output is somewhat different.
I use an official AtMEGA 2560 board with IDE 1.8.9. Everything worked fine until yesterday ( meaning successful uploads for several days)

Of course I still use the good port : COM6 for me (the only one that appears when I connect the board !)

Now I get that same message with windows 10, Linux Debian, two different machines and two different cables :

Code: [Select]
C:\Users\JP\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude -CC:\Users\JP\AppData\Local

\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf -v -patmega2560 -cstk500v2 -Pusb -Uflash:w:C:\Users\JP\AppData

\Local\Temp\arduino_build_978917/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:\Users\JP\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-

arduino17/etc/avrdude.conf"

         Using Port     : usb             
An error occurred while uploading the sketch
 
         Using Programmer              : stk500v2
avrdude: usbdev_open(): did not find any USB device "usb" (0x03eb:0x2104)

avrdude done.  Thank you.



I am trying with the blink sketch here.  I must add that since yesterday I succeeded uploading twice but failed innunmerable times.  May it have some connection with recent avrdude updates ?

ABRobert

Arduino: 1.8.9 (Windows Store 1.8.21.0) (Windows 10), Board: "Arduino/Genuino Uno"

Sketch uses 930 bytes (2%) of program storage space. Maximum is 32256 bytes.
Global variables use 9 bytes (0%) of dynamic memory, leaving 2039 bytes for local variables. Maximum is 2048 bytes.
C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.21.0_x86__mdqgnx93n4wtt\hardware\tools\avr/bin/avrdude -CC:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.21.0_x86__mdqgnx93n4wtt\hardware\tools\avr/etc/avrdude.conf -v -patmega328p -carduino -PCOM9 -b115200 -D -Uflash:w:C:\Users\Robert\AppData\Local\Temp\arduino_build_615160/Blink.ino.hex:i

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

         System wide configuration file is "C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.21.0_x86__mdqgnx93n4wtt\hardware\tools\avr/etc/avrdude.conf"

An error occurred while uploading the sketch
         Using Port                    : COM9
         Using Programmer              : arduino
         Overriding Baud Rate          : 115200
avrdude: ser_open(): can't open device "\\.\COM9": The system cannot find the file specified.



avrdude done.  Thank you.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

pert

Code: [Select]
avrdude: ser_open(): can't open device "\\.\COM9": The system cannot find the file specified.
You need to select the port of your Arduino board from the Tools > Port menu. If you find multiple ports in the menu and don't know which is the Arduino, Try this:
  • With the Arduino board unplugged from the USB open the Tools > Port menu and note the listed ports. If the Port menu is gray and disabled then that means there are no ports available.
  • Close the Tools > Port menu.
  • Plug in the USB cable on the Arduino board
  • Wait a little while for the Arduino board to connect
  • Open Tools > Port, the new port on the list is your Arduino board. In some cases it will have the name of the board next to the port name but this doesn't happen with all boards. If the Port menu is gray and disabled then that means your Arduino board didn't install correctly. You may need to install a driver.
  • Select your Arduino's port from the menu.

jptrol

#74
Sep 30, 2019, 10:07 am Last Edit: Sep 30, 2019, 10:11 am by jptrol
Too bad that the only suggested solution is to select the right port. Obviously my problem is very different with my config :

avrdude: usbdev_open(): did not find any USB device "usb" (0x03eb:0x2104)

Maybe a faulty board ?  Strange, since I get the informations from the board through the USB connection.

Go Up