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 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. diff --git a/firmware-bluetooth/boards/nrf52840dongle_nrf52840.conf b/firmware-bluetooth/boards/nrf52840dongle_nrf52840.conf new file mode 100644 index 00000000..54f9bdd0 --- /dev/null +++ b/firmware-bluetooth/boards/nrf52840dongle_nrf52840.conf @@ -0,0 +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 + +# 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 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; + }; +};