Unable to upload to XIAO MG24

An error occurred when uploading to one of the three XIAO_MG24 devices, and the upload failed. I tried the solutions described in this forum and Wiki (setting D0 to LOW, using the solution batch file from the Wiki, and Tools/Burn Bootloader) on three PCs, but no matter which PC I used, I couldn’t upload to this device, and the following message appeared. Also, the sketches I uploaded before the problem occurred are running fine, so I don’t think the MG24 itself is broken.

Is there anything I’m missing?

Open On-Chip Debugger 0.12.0+dev-01514-g21fa2de70 (2024-02-07-19:18)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
debug_level: 2
Info : auto-selecting first available session transport "swd". To override use 'transport select <transport>'.
efm32s2_dci_read_se_status
Info : Using CMSIS-DAPv2 interface with VID:PID=0x2886:0x0062, serial=67CD2BA4
Info : CMSIS-DAP: SWD supported
Info : CMSIS-DAP: FW Version = 2.0.0
Info : CMSIS-DAP: Serial# = 67CD2BA4
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 0 TDO = 0 nTRST = 0 nRESET = 0
Info : CMSIS-DAP: Interface ready
Info : clock speed 1000 kHz
Error: Error connecting DP: cannot read IDR


Error: busy command USB transfer at 0
Error: CMSIS-DAP command CMD_DISCONNECT failed.
Error: busy command USB transfer at 0
Error: CMSIS-DAP command CMD_LED failed.
Error: CMSIS-DAP command CMD_LED failed.
Failed chip erase: uploading error: exit status 0xc0000005

How many devices are connected? ie Are you sure you’re using the correct CMSIS-DAP interface?
Have you tried a “device recovery”?

Hi grobasoz,

How many devices are connected?

One MG24 is connected to the PC.

Are you sure you’re using the correct CMSIS-DAP interface?

How can I check this?

“device recovery”

What is this?

If only one device connected then should be correct CMSIS-DAP interface :slight_smile:

Device recovery is a full erase to “recover” the device from a firmware “lock up” of sorts.

I created my own if this doesn’t work for you…

I tried this tool and the one on the Wiki, but the problem was not resolved. The same message as in post #1 appeared, and I was unable to write anything.
In Device Manager,
USB Serial Device (COM21)
Seeed Studio XIAO MG24 (sense) CMSIS-DAP
is visible, but it says that IDR cannot read.

Is there anything I can look into before getting started with SAMD11?

I haven’t had any issues with SAMD11 on board so not sure what to check there?

One option would be to use the SWD interface?
Do you have an SWD programmer?
I’d probably suggest that (and an expansion board) or soldered SWDIO and SWCLK signals.

I have an expansion board and JLink, so I think I can use those to upload. However, I would prefer to be able to upload via USB as before. Do you think that’s possible?

I don’t see why not?

I have a XIAO MG24 dedicated for development with SWD and D0 (breakout) permanently wired.
I can alternate programming and debugging over SWD (with Segger OZone) or USB (OpenOCD + GDB).

If you can successfully recover the device with the SWD/JLink (and Commander.exe) then you should be able to go back to using USB/OpenOCD.

I’m just not sure why the OpenOCD recovery failed? Unless lock bits have been set? These below are OK.

Looking at the circuit diagram, there is a SAMD11 between the USB connector and the MG24’s SWDIO/SWCLK, which appears to be performing some kind of interface function.
On the other hand, since the MG24’s SWDIO/SWCLK pins are exposed on the back side, I believe it should be possible to upload a new sketch using an expansion board and JLink.
However, since the CMSIS-DAP connected to the USB port is reporting that the IDR is not visible, I suspect the issue lies either with the SAMD11 or that the MG24 is refusing to cooperate.
By the way, can the lock bit be easily verified using JLink?

EDIT:
It seems that JLink can be used to access internal registers and memory, so I will give it a try.

Yes, lock bit can be checked using Silicon Labs Commander and JLink (or Silabs’ equivalent).

The SAMD11 is the on-board programmer, so USB->SWD. Allows OpenOCD to debug using GDB.

I connected JLink using the pads on the back of the board.
After erasing the chip, I uploaded ”blink.ino.with_bootloader.hex” and confirmed that it blinked without any problems.
I checked the SecureElementStatus with SymplicityCommander, and it was the same as the screenshot posted by @grobasoz.
However, I couldn’t upload from USB, and I got the message “Error: Error connecting DP: cannot read IDR.”

The message suggests that the MG24 is refusing to connect to the DP. Alternatively, there may be an issue with the SAMD11 between the USB and the MG24.

1 Like

See if you can access the SAMD11 via SWD (S-CLK, S-DIO pads) and then re-flash new firmware?
I seem to recall having to use Microchip’s flash programmer (unless you have a Segger JLink with JFlash licence?).