I think I managed to brick the bootloader by writing to the flash from my application (should have read this before: XIAO BLE Sense persistent data).
The XIAO BLE sense does not show up anymore as USB device, i. e. there is no serial port or mass storage device showing up, even when the bootloaded is activated via double-pressing the reset button.
How can I flash the original booloader firmware, and where can I find it? (And which hardware is needed for that?)
Ok I think I can write the bootloader with OpenOCD using just a Raspberry PI over the SWD debug interface (via bottom pads TP1, TP2, TP3 and TP5 on the XIAO BLE).
Anyway, where can I find the original bootloader binary of the XIAO BLE sense?
I was able to unbrick my XIAO BLE sense with OpenOCD using a raspberry pi as SWD debugger / programmer.
I just set up a fresh Raspberry PI OS on a Raspberry PI Zero W, and installed openocd (âsudo apt install openocdâ), wired the XIAO BLE sense to the Raspberry PI (see below), and executed the following command:
Thank you for posting and good job. Will this work for any bootloaders designed for nrf52840? Can I switch from XIAO BLE SENSE Adafruit version 1.0 to MBED version 2.6.1 and vice versa?
Just in case you did not try yet: Yes, I think that should work. You should be able to write any bootloader designed for the nrf52840 with that method.
Hello, thanks for the solution, it worked for me too, but with a small change:
i had to add
set WORKAREASIZE 0
to /usr/share/openocd/scripts/target/nrf52.cfg
otherwise i got a lot of errors during programming.
I used it with a raspberry pi 4.
I have seen that programming with Arduino Ide (1,8.16) it is overwriting the bootloader each time.
Am I doing something wrong?
if you want the arduino bootloader, you can access it via the arduino installation
C:\Users<user name>\AppData\Local\Arduino15\packages\Seeeduino\hardware\nrf52\1.1.1\bootloader\Seeed_XIAO_nRF52840_Sense
There is a HEX file there.
Burn it as described by Cornelius_Grimm
I have a XIAO nrf52840 (not sense one). Iâve just tried some solutions but they didnât work for me, I guess. I have a Raspberry Pi 4 and during the programming some commands appearing on the terminal such as "Programming discontiuned at this adress " is it normal or not. Also, Iâve tried another solution for another nrf52840 device from Adafruit. You can reach from the link âCircuitPython nRF52840-dongle OpenOCD Pi Tutorial | Rototronâ. However, it wasnât solution for me too. Currently, when I plug in my XIAO to my computer, it shows itself as a storage device as like as resetted for a while but after that it cannot be recognized by computer and gives error about recogniton. Furthermore, after programming and resetting by terminal, it percieved external reset even i didnât touch anything and terminal gave response like âResetted by external resetâ and it happened just one time. I donât know what can i do to solve, do you have any idea about the problem.
I am getting this âexternal resetâ issue after burning bootloader and therefore unable to debug from vscode. What might be causing this issue?
Edit: Issue fixed. I simply entered the DFU mode the usual way and flashed blink firmware using Arduino IDE. Now everything is back to normal!! I do not understand what happened entirely. Can someone explain?
Hello, DFU mode is a special mode of bootloader and at lower level flash than the normal bootloader, it can using the flash bin to update your normal bootloader which occurs at your power in with no more action. We think there may some vital file is broken at your bootloader so DFU can cover and make its feature well
Hi. Iâm trying to do the same with my Seeed_XIAO_nRF52840_Sense but when I try to execute this command I get "Unexpected command line argument: select ". Iâm using pi zero 2 and the raspberry pi OS 5.4 64-bit, and Iâm using openocd for the first time, can you help me please?
This helped a lot! Should become part of the wiki imo. The case of âwhat if I bricked the device up to the point where a double reset doesnât workâ is not covered there.
The only thing that kept a connection to my Seeed Studio XIAO nRF52840 (Sense) was my RP debug probe. The board itself was connected to my PC, but when listing the connected USB devices, it did not show up.
True, the expansion board greatly helps. I started out with soldering some cables on the pads at the bottom of the board and hooking up the debug probe. But got myself an expansion board the same evening, way easier, and got some nifty extra features from it.