I have a project based on the NANO platform that I was working on when, for no obvious (to me) reason, I could no longer upload and started getting the message "An error occured while uploading the sketch". It had been loading fine previously. And the code compiles without errors.
I tried all the basics such as restarting the Arduino app, restarting my Mac. I ensured the board and processor were right, and even tried the Old Bootloader option. All to no avail.
I tried another simple sketch (which I have attached) and got the same error (verbose compiler output also attached).
I pulled a new NANO out of the box, and it seems to load fine (at least no errors).
So I suspect that I somehow fried the original NANO, although the power light comes on and the RX and TX lights flash when appropriate, so it's not completely dead.
The NANO is presently wired into a fairly complex (for me) configuration and I'm hoping not to have to start over, so, before I do, does anyone have any suggestions how to proceed/fix the problem?
Thanks.
Simple sketch:
/*
PIN 6 - Buzzer
*/
int f = 0;
int d = 50;
void setup()
{
noTone(2);
}
void loop()
{
for(f=250;f<=400;f++)
{
tone(2, f);
delay(d);
}
noTone (6);
delay (2000);
}
Compiler output:
Arduino: 1.8.16 (Mac OS X), Board: "Arduino Nano, ATmega328P"
/Applications/Arduino.app/Contents/Java/arduino-builder -dump-prefs -logger=machine -hardware /Applications/Arduino.app/Contents/Java/hardware -hardware /Users/David/Library/Arduino15/packages -tools /Applications/Arduino.app/Contents/Java/tools-builder -tools /Applications/Arduino.app/Contents/Java/hardware/tools/avr -tools /Users/David/Library/Arduino15/packages -built-in-libraries /Applications/Arduino.app/Contents/Java/libraries -libraries /Users/David/Documents/Arduino/libraries -fqbn=arduino:avr:nano:cpu=atmega328 -vid-pid=0000_0000 -ide-version=10816 -build-path /var/folders/v_/0m6f_b0x41980p9k48mhkxnw0000gp/T/arduino_build_241269 -warnings=all -build-cache /var/folders/v_/0m6f_b0x41980p9k48mhkxnw0000gp/T/arduino_cache_210145 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avrdude.path=/Users/David/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17 -prefs=runtime.tools.avrdude-6.3.0-arduino17.path=/Users/David/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17 -prefs=runtime.tools.arduinoOTA.path=/Users/David/Library/Arduino15/packages/arduino/tools/arduinoOTA/1.3.0 -prefs=runtime.tools.arduinoOTA-1.3.0.path=/Users/David/Library/Arduino15/packages/arduino/tools/arduinoOTA/1.3.0 -prefs=runtime.tools.avr-gcc.path=/Users/David/Library/Arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7 -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino7.path=/Users/David/Library/Arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7 -verbose /Users/David/Documents/Arduino/Sample_sirens/Sirens/Sirens.ino
/Applications/Arduino.app/Contents/Java/arduino-builder -compile -logger=machine -hardware /Applications/Arduino.app/Contents/Java/hardware -hardware /Users/David/Library/Arduino15/packages -tools /Applications/Arduino.app/Contents/Java/tools-builder -tools /Applications/Arduino.app/Contents/Java/hardware/tools/avr -tools /Users/David/Library/Arduino15/packages -built-in-libraries /Applications/Arduino.app/Contents/Java/libraries -libraries /Users/David/Documents/Arduino/libraries -fqbn=arduino:avr:nano:cpu=atmega328 -vid-pid=0000_0000 -ide-version=10816 -build-path /var/folders/v_/0m6f_b0x41980p9k48mhkxnw0000gp/T/arduino_build_241269 -warnings=all -build-cache /var/folders/v_/0m6f_b0x41980p9k48mhkxnw0000gp/T/arduino_cache_210145 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avrdude.path=/Users/David/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17 -prefs=runtime.tools.avrdude-6.3.0-arduino17.path=/Users/David/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17 -prefs=runtime.tools.arduinoOTA.path=/Users/David/Library/Arduino15/packages/arduino/tools/arduinoOTA/1.3.0 -prefs=runtime.tools.arduinoOTA-1.3.0.path=/Users/David/Library/Arduino15/packages/arduino/tools/arduinoOTA/1.3.0 -prefs=runtime.tools.avr-gcc.path=/Users/David/Library/Arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7 -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino7.path=/Users/David/Library/Arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7 -verbose /Users/David/Documents/Arduino/Sample_sirens/Sirens/Sirens.ino
Using board 'nano' from platform in folder: /Users/David/Library/Arduino15/packages/arduino/hardware/avr/1.8.5
Using core 'arduino' from platform in folder: /Users/David/Library/Arduino15/packages/arduino/hardware/avr/1.8.5
Detecting libraries used...
/Users/David/Library/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=10816 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR -I/Users/David/Library/Arduino15/packages/arduino/hardware/avr/1.8.5/cores/arduino -I/Users/David/Library/Arduino15/packages/arduino/hardware/avr/1.8.5/variants/eightanaloginputs /var/folders/v_/0m6f_b0x41980p9k48mhkxnw0000gp/T/arduino_build_241269/sketch/Sirens.ino.cpp -o /dev/null
Generating function prototypes...
/Users/David/Library/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=10816 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR -I/Users/David/Library/Arduino15/packages/arduino/hardware/avr/1.8.5/cores/arduino -I/Users/David/Library/Arduino15/packages/arduino/hardware/avr/1.8.5/variants/eightanaloginputs /var/folders/v_/0m6f_b0x41980p9k48mhkxnw0000gp/T/arduino_build_241269/sketch/Sirens.ino.cpp -o /var/folders/v_/0m6f_b0x41980p9k48mhkxnw0000gp/T/arduino_build_241269/preproc/ctags_target_for_gcc_minus_e.cpp
/Applications/Arduino.app/Contents/Java/tools-builder/ctags/5.8-arduino11/ctags -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives /var/folders/v_/0m6f_b0x41980p9k48mhkxnw0000gp/T/arduino_build_241269/preproc/ctags_target_for_gcc_minus_e.cpp
Compiling sketch...
/Users/David/Library/Arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -Wall -Wextra -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10816 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR -I/Users/David/Library/Arduino15/packages/arduino/hardware/avr/1.8.5/cores/arduino -I/Users/David/Library/Arduino15/packages/arduino/hardware/avr/1.8.5/variants/eightanaloginputs /var/folders/v_/0m6f_b0x41980p9k48mhkxnw0000gp/T/arduino_build_241269/sketch/Sirens.ino.cpp -o /var/folders/v_/0m6f_b0x41980p9k48mhkxnw0000gp/T/arduino_build_241269/sketch/Sirens.ino.cpp.o
Compiling libraries...
Compiling core...
Using precompiled core: /var/folders/v_/0m6f_b0x41980p9k48mhkxnw0000gp/T/arduino_cache_210145/core/core_arduino_avr_nano_cpu_atmega328_cd5fb58633494061cf05b90e34b7fe2d.a
Linking everything together...
/Users/David/Library/Arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-gcc -Wall -Wextra -Os -g -flto -fuse-linker-plugin -Wl,--gc-sections -mmcu=atmega328p -o /var/folders/v_/0m6f_b0x41980p9k48mhkxnw0000gp/T/arduino_build_241269/Sirens.ino.elf /var/folders/v_/0m6f_b0x41980p9k48mhkxnw0000gp/T/arduino_build_241269/sketch/Sirens.ino.cpp.o /var/folders/v_/0m6f_b0x41980p9k48mhkxnw0000gp/T/arduino_build_241269/../arduino_cache_210145/core/core_arduino_avr_nano_cpu_atmega328_cd5fb58633494061cf05b90e34b7fe2d.a -L/var/folders/v_/0m6f_b0x41980p9k48mhkxnw0000gp/T/arduino_build_241269 -lm
/Users/David/Library/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 /var/folders/v_/0m6f_b0x41980p9k48mhkxnw0000gp/T/arduino_build_241269/Sirens.ino.elf /var/folders/v_/0m6f_b0x41980p9k48mhkxnw0000gp/T/arduino_build_241269/Sirens.ino.eep
/Users/David/Library/Arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-objcopy -O ihex -R .eeprom /var/folders/v_/0m6f_b0x41980p9k48mhkxnw0000gp/T/arduino_build_241269/Sirens.ino.elf /var/folders/v_/0m6f_b0x41980p9k48mhkxnw0000gp/T/arduino_build_241269/Sirens.ino.hex
/Users/David/Library/Arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-size -A /var/folders/v_/0m6f_b0x41980p9k48mhkxnw0000gp/T/arduino_build_241269/Sirens.ino.elf
Sketch uses 2354 bytes (7%) of program storage space. Maximum is 30720 bytes.
Global variables use 30 bytes (1%) of dynamic memory, leaving 2018 bytes for local variables. Maximum is 2048 bytes.
/Users/David/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17/bin/avrdude -C/Users/David/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17/etc/avrdude.conf -v -patmega328p -carduino -P/dev/cu.usbserial-1130 -b115200 -D -Uflash:w:/var/folders/v_/0m6f_b0x41980p9k48mhkxnw0000gp/T/arduino_build_241269/Sirens.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 "/Users/David/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17/etc/avrdude.conf"
User configuration file is "/Users/David/.avrduderc"
User configuration file does not exist or is not a regular file, skipping
Using Port : /dev/cu.usbserial-1130
Using Programmer : arduino
Overriding Baud Rate : 115200
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x00
avrdude done. Thank you.
An error occurred while uploading the sketch