🛠 Diffuser une fréquence cardiaque BLE vers nRF Toolbox
The objective
Flash the Nordic "heart rate" example (standard GATT Heart Rate service) onto the nRF52840-MDK, then observe the simulated heart rate curve in the nRF Toolbox mobile app. This is the flagship demo of the MakerDiary wiki: it validates the entire chain — SDK, SoftDevice S140, mergehex, drag-and-drop flashing, and BLE radio.
Prerequisites
- nRF5 SDK 17.x and the Arm GCC toolchain (
gcc-arm-none-eabi) expected by the SDK. - Nordic's
mergehextool (nRF Command Line Tools). - The MakerDiary examples repository, which contains the examples for the board:
git clone https://github.com/makerdiary/nrf52840-mdk.git
cd nrf52840-mdk
Step 1 — Compile ble_app_hrs
make BOARD=nrf52840_mdk -C examples/nrf5-sdk/ble_app_hrs/s140/nrf52840
The application hex file is output to the example's _build/ folder. Note: The MakerDiary repository has not been updated since 2021; if compilation fails, ensure you are using SDK 17.0.x with the SoftDevice S140 6.1.1 expected by the Makefiles.
Step 2 — Merge and flash
The BLE stack requires the SoftDevice S140. Merge the two hex files, then drop the image onto the DAPLINK drive:
mergehex -m s140_nrf52_6.1.1_softdevice.hex \
_build/ble_app_hrs_nrf52840_mdk.hex \
-o firmware.hex
Drop firmware.hex onto the DAPLINK drive, then press Boot/Reset.
Step 3 — Connect with nRF Toolbox
- Install nRF Toolbox (Android/iOS) and open the Heart Rate module.
- Start a scan: the device appears (advertising name
Nordic_HRM). - Connect: the simulated heart rate curve updates via BLE notifications.
What this demo teaches you
- Advertising → connection → GATT: The Heart Rate service (0x180D) exposes the Heart Rate Measurement characteristic as notify — the core of a BLE peripheral.
- The SoftDevice is a controller + BLE stack that runs underneath your application; without merging, nothing advertises (the famous issue #31).
- The DAPLink's virtual COM port (CDC, 115200 baud) displays the example's logs: ideal for troubleshooting.
Zephyr Alternative
The upstream Zephyr peripheral_hr sample also works on the board, but the MakerDiary port is outdated: it no longer compiles with Zephyr 3.5+ (issue #55). Use the current version from the Zephyr tree (west build -b nrf52840_mdk samples/bluetooth/peripheral_hr) rather than the one from the repository.