From 22abb0be556f794e7aac57fb82d3cafe3a44f904 Mon Sep 17 00:00:00 2001 From: eyjhb Date: Mon, 24 Nov 2025 13:11:23 +0100 Subject: [PATCH 1/4] Adds bluetooth support for nrf52840 dongle with default bootleader --- firmware-bluetooth/boards/nrf52840dongle_nrf52840.conf | 2 ++ firmware-bluetooth/boards/nrf52840dongle_nrf52840.overlay | 6 ++++++ 2 files changed, 8 insertions(+) create mode 100644 firmware-bluetooth/boards/nrf52840dongle_nrf52840.conf create mode 100644 firmware-bluetooth/boards/nrf52840dongle_nrf52840.overlay diff --git a/firmware-bluetooth/boards/nrf52840dongle_nrf52840.conf b/firmware-bluetooth/boards/nrf52840dongle_nrf52840.conf new file mode 100644 index 00000000..af9c3921 --- /dev/null +++ b/firmware-bluetooth/boards/nrf52840dongle_nrf52840.conf @@ -0,0 +1,2 @@ +CONFIG_USE_DT_CODE_PARTITION=n +CONFIG_NVS=n \ No newline at end of file diff --git a/firmware-bluetooth/boards/nrf52840dongle_nrf52840.overlay b/firmware-bluetooth/boards/nrf52840dongle_nrf52840.overlay new file mode 100644 index 00000000..e5ee83c3 --- /dev/null +++ b/firmware-bluetooth/boards/nrf52840dongle_nrf52840.overlay @@ -0,0 +1,6 @@ +/ { + aliases { + led0 = &led1_red; + led1 = &led1_blue; + }; +}; From 556463a6fa4c50f9156936cd089d4a5cf4d98afe Mon Sep 17 00:00:00 2001 From: eyjhb Date: Mon, 24 Nov 2025 14:18:24 +0100 Subject: [PATCH 2/4] Adds github workflow for nrf52840dongle --- .github/workflows/build-nrf52.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/.github/workflows/build-nrf52.yml b/.github/workflows/build-nrf52.yml index a313d59d..da4e7ee5 100644 --- a/.github/workflows/build-nrf52.yml +++ b/.github/workflows/build-nrf52.yml @@ -25,3 +25,25 @@ jobs: with: name: artifact-${{ matrix.board }} path: firmware-bluetooth/remapper_${{ matrix.board }}.uf2 + + build-nrf52840dongle: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - name: Build nrf52840dongle + run: | + docker run -v $PWD:/workdir/project -w /workdir/project/firmware-bluetooth nordicplayground/nrfconnect-sdk:v2.2-branch \ + west build -b nrf52840dongle_nrf52840 + - name: Generate DFU package + run: | + docker run -v $PWD:/workdir/project -w /workdir/project/firmware-bluetooth \ + --entrypoint=nrfutil \ + nordicplayground/nrfconnect-sdk:v2.2-branch \ + toolchain-manager launch /bin/bash -- -c \ + "nrfutil install nrf5sdk-tools && nrfutil pkg generate --hw-version 52 --sd-req=0x00 --application build/zephyr/remapper.hex --application-version 1 remapper.zip" \ + - name: Rename DFU Package + run: cp firmware-bluetooth/remapper.zip firmware-bluetooth/remapper_nrf52840dongle.zip + - uses: actions/upload-artifact@v4 + with: + name: artifact-nrf52840dongle_nrf52840 + path: firmware-bluetooth/remapper_nrf52840dongle.zip From 6ae9c26f8044afb2dac397c313fbe971f58fd931 Mon Sep 17 00:00:00 2001 From: eyjhb Date: Mon, 24 Nov 2025 14:18:48 +0100 Subject: [PATCH 3/4] Adds intructions on how to flash nrf52840 dongle --- BLUETOOTH.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/BLUETOOTH.md b/BLUETOOTH.md index 5efa40f4..8d51d182 100644 --- a/BLUETOOTH.md +++ b/BLUETOOTH.md @@ -12,9 +12,25 @@ The Bluetooth version of the remapper runs on Nordic's nRF52840 chip. Currently * [Adafruit Feather nRF52840 Express](https://www.adafruit.com/product/4062) * [Seeed Studio Xiao nRF52840](https://www.seeedstudio.com/Seeed-XIAO-BLE-nRF52840-p-5201.html) +* [nRF52840 Dongle](https://www.nordicsemi.com/Products/Development-hardware/nRF52840-Dongle) +## Flashing for Adafruit and Seed Studio To flash the [firmware](firmware-bluetooth), first put the board in flashing mode by double clicking the reset button quickly. A drive should appear on your computer. Copy the [UF2 file that matches your board](https://github.com/jfedor2/hid-remapper/releases/latest) to that drive and that's it. If you want to flash a newer version of the firmware in the future, you can also put the board in firmware flashing mode using the HID Remapper [web configuration tool](https://www.remapper.org/config/). +## Flashing for nRF52840 Dongle +For flashing the firmware for the nRF52840 Dongle, put the dongle into [flashing mode](https://academy.nordicsemi.com/flash-instructions-for-nrf52840-dongle/) by clicking the RESET button once, while it is connected to the computer. +A new device should appear as `/dev/ttyACM0`, and can be flashed by doing `nrfutil dfu usb-serial -pkg remapper_nrf52840dongle.zip -p /dev/ttyACM0`. + +Flashing can be done using Docker like so: + +```bash +docker run --device=/dev/ttyACM0:/dev/ttyACM0 -v $PWD:/src -it nordicplayground/nrfconnect-sdk:v2.2-branch bash +nrfutil install nrf5sdk-tools +nrfutil dfu usb-serial -pkg remapper_nrf52840dongle.zip -p /dev/ttyACM0 +``` + +## Paring devices + To connect Bluetooth devices to the remapper, you need to put the device in pairing mode. This is device-specific, but usually involves holding a button for a few seconds. Then you also need to put HID Remapper in pairing mode. You do this by either pressing the "user switch" button on the board or by clicking the "Pair new device" button on the web configuration tool (the Xiao board doesn't have a user button so you have to either do it through the web interface or by shorting pin 0 to GND). The remapper will also automatically enter pairing mode if no devices are currently paired. You can tell the remapper is in pairing mode if the blue LED is lit constantly. When it's not in pairing mode, the blue LED will be blinking, with the number of blinks per cycle corresponding to the number of currently connected devices. From 6b11661ecebb8963a0717d99cb02eabe55da787f Mon Sep 17 00:00:00 2001 From: eyjhb Date: Tue, 16 Dec 2025 22:44:44 +0100 Subject: [PATCH 4/4] Use fcb settings backend for nrf52840 dongle --- firmware-bluetooth/boards/nrf52840dongle_nrf52840.conf | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/firmware-bluetooth/boards/nrf52840dongle_nrf52840.conf b/firmware-bluetooth/boards/nrf52840dongle_nrf52840.conf index af9c3921..54f9bdd0 100644 --- a/firmware-bluetooth/boards/nrf52840dongle_nrf52840.conf +++ b/firmware-bluetooth/boards/nrf52840dongle_nrf52840.conf @@ -1,2 +1,10 @@ +# disable NVS as it makes the device +# unable to boot. Most likely because +# of some partition fun CONFIG_USE_DT_CODE_PARTITION=n -CONFIG_NVS=n \ No newline at end of file +CONFIG_NVS=n + +# use FCB as our storage backend +# instead, which works out of the box +CONFIG_SETTINGS_FCB=y +CONFIG_FCB=y \ No newline at end of file