XIAO, on second upload: An error occurred while uploading the sketch (SOLVED)

I follower these instructions: https://wiki.seeedstudio.com/Getting_Started_with_Seeeduino/

It suggests using the Arduino Environment and to install the Seeeduino Driver.

I was able to upload the blink program (“Hello World”) and it is running fine; however, I wanted to check if I could make it blink faster. I made the changes to the program, compiled it and tried to uploaded it. But now I am getting “An error occurred while uploading the sketch”. This is the full report:

Arduino: 1.8.13 (Windows Store 1.8.42.0) (Windows 10), Board: "Atmel atmega328p Xplained mini"
C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\hardware -hardware C:\Users\Nathaniel\Documents\ArduinoData\packages -tools C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\tools-builder -tools C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\hardware\tools\avr -tools C:\Users\Nathaniel\Documents\ArduinoData\packages -built-in-libraries C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\libraries -libraries C:\Users\Nathaniel\Documents\Arduino\libraries -fqbn=atmel-avr-xminis:avr:atmega328p_xplained_mini -vid-pid=2886_802F -ide-version=10813 -build-path C:\Users\NATHAN~1\AppData\Local\Temp\arduino_build_842810 -warnings=all -build-cache C:\Users\NATHAN~1\AppData\Local\Temp\arduino_cache_422342 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arduinoOTA.path=C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\hardware\tools\avr -prefs=runtime.tools.arduinoOTA-1.3.0.path=C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\hardware\tools\avr -prefs=runtime.tools.avr-gcc.path=C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\hardware\tools\avr -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino7.path=C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\hardware\tools\avr -prefs=runtime.tools.avrdude.path=C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\hardware\tools\avr -prefs=runtime.tools.avrdude-6.3.0-arduino17.path=C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\hardware\tools\avr -verbose C:\Users\NATHAN~1\AppData\Local\Temp\arduino_modified_sketch_337500\Blink.ino
C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\arduino-builder -compile -logger=machine -hardware C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\hardware -hardware C:\Users\Nathaniel\Documents\ArduinoData\packages -tools C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\tools-builder -tools C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\hardware\tools\avr -tools C:\Users\Nathaniel\Documents\ArduinoData\packages -built-in-libraries C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\libraries -libraries C:\Users\Nathaniel\Documents\Arduino\libraries -fqbn=atmel-avr-xminis:avr:atmega328p_xplained_mini -vid-pid=2886_802F -ide-version=10813 -build-path C:\Users\NATHAN~1\AppData\Local\Temp\arduino_build_842810 -warnings=all -build-cache C:\Users\NATHAN~1\AppData\Local\Temp\arduino_cache_422342 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arduinoOTA.path=C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\hardware\tools\avr -prefs=runtime.tools.arduinoOTA-1.3.0.path=C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\hardware\tools\avr -prefs=runtime.tools.avr-gcc.path=C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\hardware\tools\avr -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino7.path=C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\hardware\tools\avr -prefs=runtime.tools.avrdude.path=C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\hardware\tools\avr -prefs=runtime.tools.avrdude-6.3.0-arduino17.path=C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\hardware\tools\avr -verbose C:\Users\NATHAN~1\AppData\Local\Temp\arduino_modified_sketch_337500\Blink.ino
Using board 'atmega328p_xplained_mini' from platform in folder: C:\Users\Nathaniel\Documents\ArduinoData\packages\atmel-avr-xminis\hardware\avr\0.6.0
Using core 'arduino' from platform in folder: C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\hardware\arduino\avr
Detecting libraries used...
"C:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\\hardware\\tools\\avr/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=10813 -DARDUINO_AVR_ATMEL_ATMEGA328P_XMINI -DARDUINO_ARCH_AVR "-IC:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\\hardware\\arduino\\avr\\cores\\arduino" "-IC:\\Users\\Nathaniel\\Documents\\ArduinoData\\packages\\atmel-avr-xminis\\hardware\\avr\\0.6.0\\variants\\atmega328p-xmini" "C:\\Users\\NATHAN~1\\AppData\\Local\\Temp\\arduino_build_842810\\sketch\\Blink.ino.cpp" -o nul -DARDUINO_LIB_DISCOVERY_PHASE
Generating function prototypes...
"C:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\\hardware\\tools\\avr/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=10813 -DARDUINO_AVR_ATMEL_ATMEGA328P_XMINI -DARDUINO_ARCH_AVR "-IC:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\\hardware\\arduino\\avr\\cores\\arduino" "-IC:\\Users\\Nathaniel\\Documents\\ArduinoData\\packages\\atmel-avr-xminis\\hardware\\avr\\0.6.0\\variants\\atmega328p-xmini" "C:\\Users\\NATHAN~1\\AppData\\Local\\Temp\\arduino_build_842810\\sketch\\Blink.ino.cpp" -o "C:\\Users\\NATHAN~1\\AppData\\Local\\Temp\\arduino_build_842810\\preproc\\ctags_target_for_gcc_minus_e.cpp" -DARDUINO_LIB_DISCOVERY_PHASE
"C:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\\tools-builder\\ctags\\5.8-arduino11/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "C:\\Users\\NATHAN~1\\AppData\\Local\\Temp\\arduino_build_842810\\preproc\\ctags_target_for_gcc_minus_e.cpp"
Compiling sketch...
"C:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\\hardware\\tools\\avr/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=10813 -DARDUINO_AVR_ATMEL_ATMEGA328P_XMINI -DARDUINO_ARCH_AVR "-IC:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\\hardware\\arduino\\avr\\cores\\arduino" "-IC:\\Users\\Nathaniel\\Documents\\ArduinoData\\packages\\atmel-avr-xminis\\hardware\\avr\\0.6.0\\variants\\atmega328p-xmini" "C:\\Users\\NATHAN~1\\AppData\\Local\\Temp\\arduino_build_842810\\sketch\\Blink.ino.cpp" -o "C:\\Users\\NATHAN~1\\AppData\\Local\\Temp\\arduino_build_842810\\sketch\\Blink.ino.cpp.o"
Compiling libraries...
Compiling core...
Using precompiled core: C:\Users\NATHAN~1\AppData\Local\Temp\arduino_cache_422342\core\core_atmel-avr-xminis_avr_atmega328p_xplained_mini_d72cf7820821928d7aba3a85f82dacbf.a
Linking everything together...
"C:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\\hardware\\tools\\avr/bin/avr-gcc" -Wall -Wextra -Os -g -flto -fuse-linker-plugin -Wl,--gc-sections -mmcu=atmega328p -o "C:\\Users\\NATHAN~1\\AppData\\Local\\Temp\\arduino_build_842810/Blink.ino.elf" "C:\\Users\\NATHAN~1\\AppData\\Local\\Temp\\arduino_build_842810\\sketch\\Blink.ino.cpp.o" "C:\\Users\\NATHAN~1\\AppData\\Local\\Temp\\arduino_build_842810/..\\arduino_cache_422342\\core\\core_atmel-avr-xminis_avr_atmega328p_xplained_mini_d72cf7820821928d7aba3a85f82dacbf.a" "-LC:\\Users\\NATHAN~1\\AppData\\Local\\Temp\\arduino_build_842810" -lm
"C:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\\hardware\\tools\\avr/bin/avr-objcopy" -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 "C:\\Users\\NATHAN~1\\AppData\\Local\\Temp\\arduino_build_842810/Blink.ino.elf" "C:\\Users\\NATHAN~1\\AppData\\Local\\Temp\\arduino_build_842810/Blink.ino.eep"
"C:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\\hardware\\tools\\avr/bin/avr-objcopy" -O ihex -R .eeprom "C:\\Users\\NATHAN~1\\AppData\\Local\\Temp\\arduino_build_842810/Blink.ino.elf" "C:\\Users\\NATHAN~1\\AppData\\Local\\Temp\\arduino_build_842810/Blink.ino.hex"
"C:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\\hardware\\tools\\avr/bin/avr-size" -A "C:\\Users\\NATHAN~1\\AppData\\Local\\Temp\\arduino_build_842810/Blink.ino.elf"
Sketch uses 928 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.
An error occurred while uploading the sketch

Sketch uses 926 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:\Users\Nathaniel\Desktop\arduino-1.8.13\hardware\tools\avr/bin/avrdude -CC:\Users\Nathaniel\Desktop\arduino-1.8.13\hardware\tools\avr/etc/avrdude.conf -v -patmega328p -carduino -PCOM3 -b57600 -D -Uflash:w:C:\Users\NATHAN~1\AppData\Local\Temp\arduino_build_501394/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\Nathaniel\Desktop\arduino-1.8.13\hardware\tools\avr/etc/avrdude.conf"

	Using Port                    : COM3
	Using Programmer              : arduino
	Overriding Baud Rate          : 57600
An error occurred while uploading the sketch

Do I need to reset something on the XIAO to get the updated program to upload? And do all pins need to be free of any connections to have a successful upload?

Thank you

(Related post on arduino forum: https://forum.arduino.cc/index.php?topic=721350)

I just got it to work.

I followed these steps, and now I can upload again.

1 Like

You should not have to enter Bootloader mode.