Blecon Device SDK on the NRF52840-DK
The Blecon Device SDK allows you to build Blecon modem functionality directly into your device. Initially, the SDK supports the nRF Connect SDK platform, based on the Zephyr operating system.
The aim of this getting started guide is to help you evaluate the Blecon Device SDK by compiling, flashing and running a simple example.
Make sure your environment is set up to build for the nRF Connect SDK by following through the corresponding getting started guide. This guide shows you how to install all the tools you will need for this quickstart.
We will start by setting up a west workspace containing the Blecon Device SDK.
First, initialise a west workspace for the SDK:
$ west init -m https://github.com/blecon/blecon-device-sdk
=== Initializing in /Users/blecon/ws/test
--- Cloning manifest repository from https://github.com/blecon/blecon-device-sdk
Cloning into '/Users/blecon/ws/test/sdk-test/.west/manifest-tmp'...
remote: Enumerating objects: 91, done.
remote: Counting objects: 100% (91/91), done.
remote: Compressing objects: 100% (62/62), done.
remote: Total 91 (delta 19), reused 86 (delta 14), pack-reused 0
Receiving objects: 100% (91/91), 143.61 KiB | 738.00 KiB/s, done.
Resolving deltas: 100% (19/19), done.
--- setting manifest.path to blecon-device-sdk
=== Initialized. Now run "west update" inside /Users/blecon/ws/test/sdk-test.
Update the workspace:
$ west update
=== updating nrf (nrf):
--- nrf: initializing
Initialized empty Git repository in /Users/donatiengarnier/ws/test/sdk-test/nrf/.git/
--- nrf: fetching, need revision v2.4.0
warning: redirecting to https://github.com/nrfconnect/sdk-nrf/
remote: Enumerating objects: 169039, done.
...
Our
west.yml
manifest pulls in a Zephyr fork with two extra patches. If you're using the NCS-provided version of Zephyr, please cherry-pick the following patches:We will now build the application and flash it on the DK.
Use west build to compile the example. You can have a look at the application's configuration in the its prj.conf file.
$ west build -b nrf52840dk_nrf52840 -s blecon-device-sdk/examples/zephyr
...
[97/103] Linking C executable zephyr/zephyr_pre1.elf
[102/103] Linking C executable zephyr/zephyr.elf
Memory region Used Size Region Size %age Used
FLASH: 292436 B 1020 KB 28.00%
RAM: 115696 B 256 KB 44.13%
IDT_LIST: 0 GB 2 KB 0.00%
[103/103] Generating zephyr/merged.hex
You can now flash the example with west.
$ west flash
-- west flash: rebuilding
ninja: no work to do.
-- west flash: using runner nrfjprog
Using board 683659291
-- runners.nrfjprog: Flashing file: /Users/blecon/ws/test/sdk-test/build/zephyr/merged.hex
[ #################### ] 7.606s | Erase file - Done erasing
[ #################### ] 3.663s | Program file - Done programming
[ #################### ] 3.610s | Verify file - Done verifying
Enabling pin reset.
Applying pin reset.
-- runners.nrfjprog: Board with serial number 683659291 flashed successfully.
We will read the device's unique URL and use it to connect to an echo network. The content of any request sent to this network will be sent back as is within the response.
Installing the Blecon App
Before proceeding further, please install the Blecon App. The Blecon App acts as a hotspot to nearby Blecon devices.
We will create a simple network Open the Blecon Console. Create a network by clicking on Create Network.
Once you're on the network's configuration page, set the request handler to the reference echo integration's URL:
https://echo.integrations.blecon.net
.
Echo network
You can now set this network in your network connection context by following the network link visible above (starting with
https://blecon.app
).Connect a serial terminal (baudrate 115200bps) to the DK to read the device's unique URL. The device's identity is generated at first boot and stored in a 4kB flash section managed by the partition manager (see the partition manager's configuration file, and read more about the partition manager here).
$ screen /dev/tty.usbmodem0006836592911 115200
NFC URL: https://blecon.dev/27c6dcd1-1920-4a27-b80c-03debc122c4b
*** Booting Zephyr OS build v3.3.99-ncs1 ***
[00:00:00.008,544] <inf> bt_sdc_hci_driver: SoftDevice Controller build revision:
e0 7e 2e c1 5e 05 85 23 46 15 dc fa 8e 29 7d 70 |.~..^..# F....)}p
10 93 a5 fc |....
[00:00:00.019,165] <inf> bt_hci_core: HW Platform: Nordic Semiconductor (0x0002)
[00:00:00.019,195] <inf> bt_hci_core: HW Variant: nRF52x (0x0002)
[00:00:00.019,226] <inf> bt_hci_core: Firmware: Standard Bluetooth controller (0x00) Version 224.11902 Build 2231721665
[00:00:00.020,690] <inf> bt_hci_core: Identity: F4:35:4F:56:85:2D (random)
[00:00:00.020,721] <inf> bt_hci_core: HCI: version 5.4 (0x0d) revision 0x1077, manufacturer 0x0059
[00:00:00.020,751] <inf> bt_hci_core: LMP: version 5.4 (0x0d) subver 0x1077
Device URL: https://blecon.dev/27c6dcd1-1920-4a27-b80c-03debc122c4b
Open the URL in your browser. You will now be asked if you want to connect the device to the network set-up previously. Follow the connection flow and confirm the connection request.

Connection page
You can now go back to the serial terminal - you should shortly see a first request being made!
$ screen /dev/tty.usbmodem0006836592911 115200
...
Connected, sending request.
Got response: Hello blecon!
Once the Blecon library is initialised, a connection is requested. Once the connection is made (and a corresponding callback is raised), the program sends a request (the ASCII string "Hello blecon!"). Another callback is called when the response is available, which is identical to the request's content.
You can also refer to the Blecon library's main header file which documents its API and callbacks structure.
This simple example showcases how you can use Blecon within Zephyr to send and receive data to a cloud service with Bluetooth Low Energy.