I thought I had been extremely careful to _not_ brick the device, but apparently I did.
I created a firmware-dfu.zip file, even with appropriate keys, etc. as below.
if /nix/store/if9z6wmzmb07j63c02mvfkhn1mw1w5p4-systemd-257.5/bin/journalctl --dmesg -b | grep -q 'Open DFU Bootloader'; then
echo "dmesg detected a device with an Open DFU Bootloader" &&
if /nix/store/zd7fljlfxbf071lpbr0kkfxhfw35ljzi-usbutils-018/bin/lsusb | /nix/store/gqmr3gixlddz3667ba1iyqck3c0dkpvd-gnugrep-3.11/bin/grep -q '1915:521f Nordic Semiconductor ASA Open DFU Bootloader'; then
echo "Device is currently connected via USB" &&
device_node=$(/nix/store/7y59hzi3svdj1xjddjn2k7km96pifcyl-findutils-4.10.0/bin/find /dev/serial/by-id/usb-Nordic_Semiconductor_Open_DFU_Bootloader_C1E8D2B54E6C-*) &&
echo "We found a DFU Bootloader for device $device_node"
n=/nix/store/byh3jmf68mav7nxsybcaidg9rici2p4m-nrfutil-1.0/bin/nrfutil
for p in $("$n" search| grep 'Not installed'| awk '{print $1}'); do
"$n" install "$p"
done
set -x
keydir=/configuration/secrets/Thread/nrf52840
key=$keydir/private.pem
if [ ! -f "$key" ]; then
"$n" nrf5sdk-tools keys generate "$key"
# /nix/store/rjzx8v679rwd6dsb6s08iy3j2rrax72s-openssl-3.4.1-bin/bin/openssl ecparam -name prime256v1 -genkey -noout -out "$key"
fi &&
app=/nix/store/10lclbfxncczar6i0789n473am6rlrcy-ot-nrf528xx-unstable-2025-05-23/bin/ot-rcp.hex &&
printf 'Using hex file: %s\n' "$app" &&
output=$(pwd)/thread_rcp_dfu.zip &&
printf 'Generating DFU package: %s\n' "$output" &&
"$n" pkg generate \
--hw-version 52 \
--sd-req 0x00 \
--application "$app" \
--key-file "$key" \
--application-version 1 \
"$output" &&
dfu_description=$("$n" pkg display "$output") &&
if printf '%s' "$dfu_description" | /nix/store/gqmr3gixlddz3667ba1iyqck3c0dkpvd-gnugrep-3.11/bin/grep 'sd_req: 0x00'; then
echo "Good, this is not a SoftDevice"
fi &&
echo "" &&
echo "$dfu_description"
else
echo "No DFU Bootloader found in dmesg output; nothing to do."
fi
fi
Then, I wanted to flash via:
#!/bin/sh if [ -z "$1" ]; then echo "Usage: $0 firmware.dfu.zip" exit 1 fi FW=$1 set -x printf "Flashing firmware '%s' to nRF52840 USB Dongle in DFU mode...\n" "$FW" n=/nix/store/byh3jmf68mav7nxsybcaidg9rici2p4m-nrfutil-1.0/bin/nrfutil # Flash via USB DFU "$n" dfu usb-serial -pkg "$FW" -p /dev/ttyACM0 if [ $? -eq 0 ]; then echo "Flash successful." else echo "Flashing failed." exit 3 fi
I saw output saying "device programmed" with a progress bar before it that went to 100%, suggesting that at least *something* was flashed. Before (from the distributor) the device was in DFU mode, showing a dimming orange LED and it would show up in both dmesg and lsusb (as checked by the code), but afterwards it just seems dead/bricked.
So, how do I recover this and how do I accomplish what really should have been an easy task of flashing an Openthread Border Router RCP (openthread.io/.../border-router) onto the device such that I can achieve my end goal of just being able to use Matter devices?
The code I used to build the ot-tcp.hex file (the artefact used in the code above creating the DFU zip file) is visible below:
# code used to build ot-rcp.hex bash build nrf52840 USB_trans arm-none-eabi-objcopy -O ihex $OT_CMAKE_BUILD_DIR/bin/ot-rcp $NIX_BUILD_TOP/bin/ot-rcp.hex
I feel like I have done nothing wrong and followed all instructions, but despite best intentions, the device still is bricked
Overall, I consider it a _horrible_ developer experience for trying to do something which should have been simple (adding an OBTR to the network).
I am aware other people asked somewhat similar questions, but my setup is probably somewhat unique. Version information of nrfutil:
$ /nix/store/byh3jmf68mav7nxsybcaidg9rici2p4m-nrfutil-1.0/bin/nrfutil --version nrfutil 8.0.0 (54d8087 2025-01-07) commit-hash: 54d8087a38b73b6e56942fb1b024b62365f06731 commit-date: 2025-01-07 host: x86_64-unknown-linux-gnu build-timestamp: 2025-01-07T14:26:42.070728557Z classification: nrf-external
So, the questions then are:
- How do I recover to factory settings (assuming I have little to no tools right now, but I can buy tools)? I pressed the white button (there are no other buttons visible) in an attempt to reset to factory settings.
- What do I need to flash Openthread RCP on it such that it *does* work?
- Why is it even possible to have a successful flash that bricks the device in the first place? E.g. why is there no simulation of some kind to make sure the resulting flashed device does something useful?
- If I need to buy something to make this work, what?