Cannot upload to XIAO nrf52840, cannot access bootloader mode with reset

I have a XIAO nrf52840 board that I’m trying to upload code to. Uploading the code bricks the device for some reason. Now when I try to upload through the Arduino IDE I get the follow error:

Failed to upgrade target. Error is: Serial port could not be opened on COM8. Reason: Cannot configure port, something went wrong. Original message: PermissionError(13, 'A device attached to the system is not functioning.', None, 31)
Traceback (most recent call last):
  File "nordicsemi\dfu\dfu_transport_serial.py", line 113, in open
  File "site-packages\serial\serialwin32.py", line 31, in __init__
  File "site-packages\serial\serialutil.py", line 240, in __init__
  File "site-packages\serial\serialwin32.py", line 78, in open
  File "site-packages\serial\serialwin32.py", line 222, in _reconfigure_port
serial.serialutil.SerialException: Cannot configure port, something went wrong. Original message: PermissionError(13, 'A device attached to the system is not functioning.', None, 31)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "nordicsemi\__main__.py", line 294, in serial
  File "nordicsemi\dfu\dfu.py", line 235, in dfu_send_images
  File "nordicsemi\dfu\dfu.py", line 157, in _dfu_send_image
  File "nordicsemi\dfu\dfu_transport_serial.py", line 115, in open
nordicsemi.exceptions.NordicSemiException: Serial port could not be opened on COM8. Reason: Cannot configure port, something went wrong. Original message: PermissionError(13, 'A device attached to the system is not functioning.', None, 31)

Possible causes:
- Selected Bootloader version does not match the one on Bluefruit device.
    Please upgrade the Bootloader or select correct version in Tools->Bootloader.
- Baud rate must be 115200, Flow control must be off.
- Target is not in DFU mode. Ground DFU pin and RESET and release both to enter DFU mode.

Double clicking the reset button only makes an inaccesible drive appear:

I cannot open the drive, so I cannot upload another bootloader to it. Arduino recognizes the device when plugged in, but cannot upload to it. Extremely frustrating, this has happened to two boards now. Any ideas on how to fix? Eveyrthing I’ve read suggests double clicking reset then dragging new UF2 into the drive, but I cannot access the drive.

I also have an NRF52832 DK with J-Link. If the xiao bootloader can be flashed using this that would be fine too. Not sure how though.

What version of BoardSupportPackege do you have?
When XIAO is connected to USB, do you see COM8 in Windows device manager?

I’m using the nrf52840 mbed enabled BSP from https://files.seeedstudio.com/arduino/package_seeeduino_boards_index.json.

COM8 is recognized when I plug in the XIAO via the USB.

I also managed to flash the bootloader hex to the xiao using jlink with my nrf development kit. However, that made no difference. Is there a hex I can upload to my xiao to verify whether it’s working or not?

Do you use the bluefruit library?
Does the compilation complete successfully?

Right now I’m just trying to upload blink code to test the upload functionality. It compiles fine, it just doesn’t upload.

What ports are visible in Device Manager when the upload fails?

COM8 is still visible when the device fails.

Is Seeed XIAO nRF52840 Sense OR TinyUSB Serial listed under Universal Serial Bus Devices in the Device Manager?
Note: not “Ports (COM & LPT)”.

Neither. Under Universal Serial Bus Devices, it only shows APP Mode. See photos attached.

How about removing COM8 in Device Manager?
Or how about running an update of the COM8 driver?

I’ve tried both of those, neither work.

Have you tried non-mbed BSP?

What is APP Mode?
Have you tried right-clicking?

This is a really basic question, but you always make sure you have selected COM8 in ArduinoIDE before uploading, right?

Yes I’ve tried non mbed BSP as well as selecting COM8 each time.

I’m succesfully uploading to the XIAO with SWD through Jlink. If I upload a blink bin and it doesn’t work, can that be used to verify that XIAO is unrecoverable? Or can it still recover even if that doesn’t work. Not sure what APP mode is. It still is there when XIAO is not plgged in.

Your problem seems to be a phenomenon I have never encountered before. Sorry for not being helpful.
As for re-writing the bootloader, you might find it by searching the forum or the Wiki. Also, a veteran may be able to take over.

No problem. Thank you anyways.

HI there,

If I may SO I have the same tools as you , Nrf_connect for desktop and a Jlink for SWD yes?

HTH
GL :slight_smile: PJ.

Can you open the programmer app? can you detect the chip like in this picture?

Hi PJ,

Thanks for helping with this issue. Yes I can open the programmer app and I get a similar looking chip layout. See below:

Hi there,

So sweet , your using the jlink on the dev board then “DK”
because that read looks pretty correct.? You good with it’s not the on-board nrf52840 but the SWD connected one ? YES!

You can download the Hex from the Xiao Github or Wiki. with the Bootloader. I have attached it here, also hit the Drag and Drop testing Files thread and put it in Bootloader mode and Drag a UF2 file to it.
to test RGB , SD , displays, etc…

Seeed_XIAO_nRF52840_Sense_bootloader-0.6.1_s140_7.3.0.zip (212.5 KB)

HTH
GL :slight_smile: PJ :v:

brb got to rescue some cats. :cat2:

I am truly so embarassed with myself. I had uploaded code using a certain USB cable earlier in the day, and this cable works with transmitting data from my phone to my computer so I assumed it was fine.

I’ve just switched the USB cable and everything works perfectly now. The double reset tap boots into bootloader mode, and I can upload code again. Forgot the first step of debugging: try a different cable. Something must be wrong with the first cable, as it recognizes the XIAO in device manager, but cannot transmit serial data to it.

Thank you both very much for your effort in solving this. I have spent 8 hours of my day working on fixing this, and my idiocy will forever live on this forum. You live and you learn LOL.