Problem with script starting after upload

I do not know if this is problem with upload of script or something else. I wrote easy script that counts to 10 then starts over.

int startNumber=0;
void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
}
void loop() {
  // put your main code here, to run repeatedly:
   Serial.println(startNumber);
  delay(1000);
  startNumber++;
  if(startNumber>9)
    startNumber=0;
}

I am using arduino nano v3.0 with new bootloader. When i upload script rx led lights up but after i finish uploading only pwr led is lit.I can not see anything on serial monitor
Does anyone know what is the problem?

Welcome to the forum

Your sketch works for me, noting that it actually prints from 0 to 9, not 0 to 10

All I changed was the baud rate to match my standard rate. What baud rate is the Serial monitor set to on your system ?

Please turn on verbose output for compile and uploading in the IDE Preferences dialogue, upload the code and post the full output from the bottom window of the IDE, using code tags when you do

1 Like

My baud rate is set to 9600 in Serial monitor.

Using board 'nano' from platform in folder: C:\Users\user\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6
Using core 'arduino' from platform in folder: C:\Users\user\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6

Detecting libraries used...
C:\Users\user\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR -IC:\Users\user\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino -IC:\Users\user\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\variants\eightanaloginputs C:\Users\user\AppData\Local\arduino\sketches\BEA42240372CB363616ABAC2E32B1116\sketch\sketch_feb21a.ino.cpp -o nul
Generating function prototypes...
C:\Users\user\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR -IC:\Users\user\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino -IC:\Users\user\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\variants\eightanaloginputs C:\Users\user\AppData\Local\arduino\sketches\BEA42240372CB363616ABAC2E32B1116\sketch\sketch_feb21a.ino.cpp -o C:\Users\user\AppData\Local\Temp\2737679583\sketch_merged.cpp
C:\Users\user\AppData\Local\Arduino15\packages\builtin\tools\ctags\5.8-arduino11/ctags -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives C:\Users\user\AppData\Local\Temp\2737679583\sketch_merged.cpp
Compiling sketch...
"C:\\Users\\user\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR "-IC:\\Users\\user\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\cores\\arduino" "-IC:\\Users\\user\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\variants\\eightanaloginputs" "C:\\Users\\user\\AppData\\Local\\arduino\\sketches\\BEA42240372CB363616ABAC2E32B1116\\sketch\\sketch_feb21a.ino.cpp" -o "C:\\Users\\user\\AppData\\Local\\arduino\\sketches\\BEA42240372CB363616ABAC2E32B1116\\sketch\\sketch_feb21a.ino.cpp.o"
Compiling libraries...
Compiling core...
Using precompiled core: C:\Users\user\AppData\Local\arduino\cores\arduino_avr_nano_cpu_atmega328_dd72fbfee32d61057c6f123c402e8c36\core.a
Linking everything together...
"C:\\Users\\user\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-gcc" -w -Os -g -flto -fuse-linker-plugin -Wl,--gc-sections -mmcu=atmega328p -o "C:\\Users\\user\\AppData\\Local\\arduino\\sketches\\BEA42240372CB363616ABAC2E32B1116/sketch_feb21a.ino.elf" "C:\\Users\\user\\AppData\\Local\\arduino\\sketches\\BEA42240372CB363616ABAC2E32B1116\\sketch\\sketch_feb21a.ino.cpp.o" "C:\\Users\\user\\AppData\\Local\\arduino\\sketches\\BEA42240372CB363616ABAC2E32B1116/..\\..\\cores\\arduino_avr_nano_cpu_atmega328_dd72fbfee32d61057c6f123c402e8c36\\core.a" "-LC:\\Users\\user\\AppData\\Local\\arduino\\sketches\\BEA42240372CB363616ABAC2E32B1116" -lm
"C:\\Users\\user\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-objcopy" -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 "C:\\Users\\user\\AppData\\Local\\arduino\\sketches\\BEA42240372CB363616ABAC2E32B1116/sketch_feb21a.ino.elf" "C:\\Users\\user\\AppData\\Local\\arduino\\sketches\\BEA42240372CB363616ABAC2E32B1116/sketch_feb21a.ino.eep"
"C:\\Users\\user\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-objcopy" -O ihex -R .eeprom "C:\\Users\\user\\AppData\\Local\\arduino\\sketches\\BEA42240372CB363616ABAC2E32B1116/sketch_feb21a.ino.elf" "C:\\Users\\user\\AppData\\Local\\arduino\\sketches\\BEA42240372CB363616ABAC2E32B1116/sketch_feb21a.ino.hex"

"C:\\Users\\user\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-size" -A "C:\\Users\\user\\AppData\\Local\\arduino\\sketches\\BEA42240372CB363616ABAC2E32B1116/sketch_feb21a.ino.elf"
Sketch uses 1900 bytes (6%) of program storage space. Maximum is 30720 bytes.
Global variables use 190 bytes (9%) of dynamic memory, leaving 1858 bytes for local variables. Maximum is 2048 bytes.
"C:\Users\user\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude" "-CC:\Users\user\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf" -v -V -patmega328p -carduino "-PCOM3" -b115200 -D "-Uflash:w:C:\Users\user\AppData\Local\arduino\sketches\BEA42240372CB363616ABAC2E32B1116/sketch_feb21a.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\user\AppData\Local\Arduino15\packages\arduino\tools\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
         PAGEL                         : PD7
         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: reading input file "C:\Users\user\AppData\Local\arduino\sketches\BEA42240372CB363616ABAC2E32B1116/sketch_feb21a.ino.hex"
avrdude: writing flash (1900 bytes):

Writing | ################################################## | 100% 0.23s

avrdude: 1900 bytes of flash written

avrdude done.  Thank you.

Please enable Verify after upload in file → preferences.

Original or clone?

1 Like

I am pretty sure it is clone.

FQBN: arduino:avr:nano
Using board 'nano' from platform in folder: C:\Users\user\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6
Using core 'arduino' from platform in folder: C:\Users\user\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6

Detecting libraries used...
C:\Users\user\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR -IC:\Users\user\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino -IC:\Users\user\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\variants\eightanaloginputs C:\Users\user\AppData\Local\arduino\sketches\BEA42240372CB363616ABAC2E32B1116\sketch\sketch_feb21a.ino.cpp -o nul
Generating function prototypes...
C:\Users\user\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR -IC:\Users\user\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino -IC:\Users\user\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\variants\eightanaloginputs C:\Users\user\AppData\Local\arduino\sketches\BEA42240372CB363616ABAC2E32B1116\sketch\sketch_feb21a.ino.cpp -o C:\Users\user\AppData\Local\Temp\2978748867\sketch_merged.cpp
C:\Users\user\AppData\Local\Arduino15\packages\builtin\tools\ctags\5.8-arduino11/ctags -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives C:\Users\user\AppData\Local\Temp\2978748867\sketch_merged.cpp
Compiling sketch...
"C:\\Users\\user\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR "-IC:\\Users\\user\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\cores\\arduino" "-IC:\\Users\\user\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.6\\variants\\eightanaloginputs" "C:\\Users\\user\\AppData\\Local\\arduino\\sketches\\BEA42240372CB363616ABAC2E32B1116\\sketch\\sketch_feb21a.ino.cpp" -o "C:\\Users\\user\\AppData\\Local\\arduino\\sketches\\BEA42240372CB363616ABAC2E32B1116\\sketch\\sketch_feb21a.ino.cpp.o"
Compiling libraries...
Compiling core...
Using precompiled core: C:\Users\user\AppData\Local\arduino\cores\arduino_avr_nano_cpu_atmega328_dd72fbfee32d61057c6f123c402e8c36\core.a
Linking everything together...
"C:\\Users\\user\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-gcc" -w -Os -g -flto -fuse-linker-plugin -Wl,--gc-sections -mmcu=atmega328p -o "C:\\Users\\user\\AppData\\Local\\arduino\\sketches\\BEA42240372CB363616ABAC2E32B1116/sketch_feb21a.ino.elf" "C:\\Users\\user\\AppData\\Local\\arduino\\sketches\\BEA42240372CB363616ABAC2E32B1116\\sketch\\sketch_feb21a.ino.cpp.o" "C:\\Users\\user\\AppData\\Local\\arduino\\sketches\\BEA42240372CB363616ABAC2E32B1116/..\\..\\cores\\arduino_avr_nano_cpu_atmega328_dd72fbfee32d61057c6f123c402e8c36\\core.a" "-LC:\\Users\\user\\AppData\\Local\\arduino\\sketches\\BEA42240372CB363616ABAC2E32B1116" -lm
"C:\\Users\\user\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-objcopy" -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 "C:\\Users\\user\\AppData\\Local\\arduino\\sketches\\BEA42240372CB363616ABAC2E32B1116/sketch_feb21a.ino.elf" "C:\\Users\\user\\AppData\\Local\\arduino\\sketches\\BEA42240372CB363616ABAC2E32B1116/sketch_feb21a.ino.eep"
"C:\\Users\\user\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-objcopy" -O ihex -R .eeprom "C:\\Users\\user\\AppData\\Local\\arduino\\sketches\\BEA42240372CB363616ABAC2E32B1116/sketch_feb21a.ino.elf" "C:\\Users\\user\\AppData\\Local\\arduino\\sketches\\BEA42240372CB363616ABAC2E32B1116/sketch_feb21a.ino.hex"

"C:\\Users\\user\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-size" -A "C:\\Users\\user\\AppData\\Local\\arduino\\sketches\\BEA42240372CB363616ABAC2E32B1116/sketch_feb21a.ino.elf"
Sketch uses 1900 bytes (6%) of program storage space. Maximum is 30720 bytes.
Global variables use 190 bytes (9%) of dynamic memory, leaving 1858 bytes for local variables. Maximum is 2048 bytes.
"C:\Users\user\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude" "-CC:\Users\user\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf" -v  -patmega328p -carduino "-PCOM3" -b115200 -D "-Uflash:w:C:\Users\user\AppData\Local\arduino\sketches\BEA42240372CB363616ABAC2E32B1116/sketch_feb21a.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\user\AppData\Local\Arduino15\packages\arduino\tools\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
         PAGEL                         : PD7
         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: reading input file "C:\Users\user\AppData\Local\arduino\sketches\BEA42240372CB363616ABAC2E32B1116/sketch_feb21a.ino.hex"
avrdude: writing flash (1900 bytes):

Writing | ################################################## | 100% 0.22s

avrdude: 1900 bytes of flash written
avrdude: verifying flash memory against C:\Users\user\AppData\Local\arduino\sketches\BEA42240372CB363616ABAC2E32B1116/sketch_feb21a.ino.hex:
avrdude: load data flash data from input file C:\Users\user\AppData\Local\arduino\sketches\BEA42240372CB363616ABAC2E32B1116/sketch_feb21a.ino.hex:
avrdude: input file C:\Users\user\AppData\Local\arduino\sketches\BEA42240372CB363616ABAC2E32B1116/sketch_feb21a.ino.hex contains 1900 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.22s

avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0000
         0x62 != 0x0c
avrdude: verification error; content mismatch

avrdude done.  Thank you.

Failed uploading: uploading error: exit status 1

This is error when i enable code verification.

Hi @ch0da. When the "Verify code after upload" preference is enabled, after finishing an upload Arduino IDE reads the memory on the Arduino board and compares the read data against the data of the compiled sketch binary file on your computer that was uploaded to the board. When it did that, it found that the data on the Arduino board did not match what should have been there. This means the uploaded program was not written to the memory in the Arduino board during the upload process as expected.

It is possible that a short or external circuitry connected to the Arduino board could cause this type of problem by interfering with the upload process.

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 another USB cable on hand, try changing the cable. Maybe a damaged or defective USB cable could be the cause. Make sure the USB cable is fully inserted into the USB socket on the board and computer.

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.

I tried plugin arduino by itself nothing connected to it except USB cable.I am not noticing any short circuit or bent pins on arduino. It is standing on my wooden desk so it should not have any conductive elements near it. Only thing i notice is that arduino gets hot when plugged in , I think this is normal but can not be sure this is ,y first time working with arduino.
I tried 3 cables that i know work. They all produce same error.

It is not normal. Unfortunately, the problem is probably caused by the Arduino board having suffered permanent physical damage. I recommend you carefully review what you were doing with the board the last time it was in a working state. You may be able to identify the cause of the damage and in this way profit from the mishap by gaining knowledge that will allow you to avoid subjecting boards to the same conditions in the future.

Unless you have the right tools on hand and the skills to use those tools, repair of the board will not be feasible. I suggest you attach a note to the damaged board describing what is wrong with it and put it in your electronics salvage bin. Then purchase a replacement board.

You can support the work Arduino does to provide free open source software, documentation, and hardware designs to the community by purchasing official hardware. It is available from these sources:

Thanks for information. I got it from store like 2 days ago and just wanted to test this program for writing numbers to screen while I wait for screen to arrive. I am guessing I got sold bad copy. I would like to support you guys but originals are not available in my country only clones and clones that are posing as original. Thanks for help.

1 Like