Error occurred while uploading sketch

Hello....I have an arduino uno. When I upload the program on arduino compiler says error occurred while uploading sketch but the leds flash as usual while uploading. But when I test, the new program does not seem to get uploaded on the board. I tried using reset button and 'L' led blinks normally but other times it is off. How can it be solved?

Hi @qmpz. I'm going to ask you to post the full verbose output from an upload attempt.


:exclamation: This procedure is not intended to solve the problem. The purpose is to gather more information.


Please do this:

  1. Select File > Preferences... from the Arduino IDE menus.
    The "Preferences" dialog will open.
  2. Uncheck the box next to Show verbose output during: compilation in the "Preferences" dialog.
  3. Check the box next to Show verbose output during: ☐ upload.
  4. Click the OK button.
  5. Attempt an upload, as you did before.
  6. Wait for the upload to fail.
  7. You will see a "Upload error: ..." notification at the bottom right corner of the Arduino IDE window. Click the COPY ERROR MESSAGES button on that notification.
  8. Open a forum reply here by clicking the Reply button.
  9. Click the <CODE/> icon on the post composer toolbar.
    This will add the forum's code block markup (```) to your reply to make sure the error messages are correctly formatted.
    Code tags icon on toolbar
  10. Press Ctrl+V.
    This will paste the error output from the upload into the code block.
  11. Move the cursor outside of the code tags before you add any additional text to your reply.
  12. Click the Reply button to post the output.

This is my complete error message

Arduino: 1.8.19 (Windows 10), Board: "Arduino Uno"

Sketch uses 816 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 (x86)\Arduino\hardware\tools\avr/bin/avrdude -CC:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf -v -patmega328p -carduino -PCOM3 -b115200 -D -Uflash:w:C:\Users\Admin\AppData\Local\Temp\arduino_build_803419/sketch_jul17a.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                    : COM3

         Using Programmer              : arduino

         Overriding Baud Rate          : 115200

avrdude: stk500_recv(): programmer is not responding

avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x91

avrdude: stk500_recv(): programmer is not responding

avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x91

avrdude: stk500_recv(): programmer is not responding

avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x91

avrdude: stk500_recv(): programmer is not responding

avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x91

avrdude: stk500_recv(): programmer is not responding

avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x91

avrdude: stk500_recv(): programmer is not responding

avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x91

avrdude: stk500_recv(): programmer is not responding

avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x91

avrdude: stk500_recv(): programmer is not responding

avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x91

avrdude: stk500_recv(): programmer is not responding

avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x91

avrdude: stk500_recv(): programmer is not responding

avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x91



avrdude done.  Thank you.



Problem uploading to board.  See https://support.arduino.cc/hc/en-us/sections/360003198300 for suggestions.



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

Please try this experiment and then report back with the results:


:exclamation: This procedure is not intended to solve the problem. The purpose is to gather more information.


  1. Connect the Arduino board to your computer with a USB cable.
  2. Press and release the button on the Arduino board that is marked "RESET".

Now please reply here on the forum thread with the answer to the following question:

  • Did you see the "L" LED blink multiple times quickly immediately after you released the "RESET" button?

Yes, as mentioned earlier in this conversation L led blinks

Do you have a genuine UNO , bought from Arduino ? some clones need a driver for the CH340 USB chip.
Do you a data USB lead , not a charger lead?

lookie

I haven't brought from Arduino store I bought this from Amazon
I have a proper data USB lead
This problem has been encountered for first time for me
I have a seven segment led display, an HC05 and HCSR04 ultrasound sensor along with a motor driver onboard. Is the problem due to more number of components?

It is possible for a short or external circuitry connected to the Arduino board to interfere with the upload process, causing this type of upload error.

Make sure the board is not sitting on anything conductive that could short the contacts on the bottom of the board. Make sure there isn't any conductive debris (e.g., strands of wire or component leads) on the board or on the surface the board is sitting on.

If you have a shield or any external circuitry or components connected to your Arduino board, try this experiment:

  1. Disconnect the USB cable of the Arduino board from your computer.
  2. Disconnect any shields, modules, external circuitry, etc. from your board.
  3. Connect the Arduino board to your computer with a USB cable.

Now try uploading a sketch to the board again. Does the upload succeed?

This experiment will determine whether the upload error was caused by interference from your external circuitry. If so, you can then focus your attention on identifying the specific problem with the circuit and resolving it.

Yes! I removed the components and re uploaded and now it is working. I have reduced 7 segment display and rest circuitry works well. I think it was power issue.
Thank you @ptillisch
Thank you @hammy

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

Regards,
Per

A post was split to a new topic: Upload to Nano fails: 'avrdude: ser_open(): can't set com-state for ".\COM6"'

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