My XIAO SAMD21 sketch compiles but does not upload

Following is the upload Output from my sketch. Everything compiles but the system glitches repeatedly at upload. I have selected the XIAO board in the Arduino IDE and the port is shown in the Tools menu before compiling/uploading.

Any help will be greatly appreciated. Along with this issue, I seem to burnout or “brick” a number of XIAO SAND21 microprocessors. I have done this so many times, i now design on a NANO or other Arduino component that doesn’t display the same tendencies. Can someone tell me what I might be doing wrong?

Sketch uses 78260 bytes (29%) of program storage space. Maximum is 262144 bytes.
Performing 1200-bps touch reset on serial port COM51
Waiting for upload port…
Upload port found on COM51
“C:\Users\Baran G\AppData\Local\Arduino15\packages\Seeeduino\tools\bossac\1.7.0-arduino3/bossac.exe” -i -d --port=COM51 -U true -i -e -w -v “C:\Users\Baran G\AppData\Local\Temp\arduino\sketches\073A668AE6C0EE5E04F2BA0B359F3EAE/BenderPro_1_SP_PCA_1.ino.bin” -R
No device found on COM51
Failed uploading: uploading error: exit status 1

Have you tried double resetting XIAO?
Or have you tried re-writing the bootloader?

The double reset lasts a few times before the XIAO becomes a brick. I will look into a program to rewrite the bootloader.

I guess a more important question is “How did I just render a XIAO SAMD21 inoperative with a single upload?” I have had some that I can rewrite my sketch and upload multiple times but lately, I get one shot.

It seems that Seeeduino would either change the architecture of the device or create a sketch that automatically refreshes the device between uploads. I have NEVER experienced this with an arduino product before and the only reason I am trying so hard to make this device work is the tiny footprint.

If you are rewriting the bootloader, the following will be helpful.
How to unbrick a dead XIAO using a XIAO(DAPLink) and OpenOCD

How to unbrick a dead XIAO using ST-LINK and OpenOCD - #40 by msfujino

i find it is important to have a XIAO expansion board when uploading programs
so that i can double click the reset button
this is usually a problem when a sketch is using the usb com port for serial monitor
the reset button on the expansion board with the XIAO SAMD installed
1 click will cause a reset of the program
quick double click of reset button will cause
the amber led to flash in a ramping blink motion
this indicates it is ready for programming

also i have noticed that the com port may switch between lets say com 9 to com 10
and a window may pop up showing the usb as a file folder
when this happens it is import to acknowledge the question or close the window before proceeding and
make sure the correct com port is still selected

i sometimes notice that this is not required if the serial communications is not a part of the program running

i am assuming this is partly why new XIAO have reset and boot buttons included on some boards

i also saw somewhere that attaching a capacitor somewhere may also set it into a way that it will automaticly go into bootloader mode when power on… i think that was for an exp32… not sure about this one

FYI

CWG…

Try a double reset. Remember to save the backup first before resetting.

I appreciate the expansion board recommendation. I have one arriving soon. I was told I will have better luck with it. The truth is, I solved my programming issue such that the XIAO is no longer being disrupted. Once I have a working sketch, it never fails to upload properly.

Thank you for the links. My issue is resolved but this is prob=ably not the last time.