Blecon Device SDK on the NRF52840-DK
Introduction
This guide covers getting started using the Blecon Device SDK on the Nordic 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.
If you're not familiar with the nRF Connect SDK, please head first to the relevant documentation.
The aim of this getting started guide is to help you evaluate the Blecon Device SDK by compiling, flashing and running a simple example.
Set up your development environment
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.
Initialising the SDK's west workspace
First, initialise a west workspace for the SDK:
Update the workspace:
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:
https://github.com/blecon/zephyr/commit/04d59f3554d35290d2d6eac0e1d2e4e3564b525fhttps://github.com/blecon/zephyr/commit/518a558f67e55afca551e90a69d4fddf6a7b1afb
Build & flash the example application
We will now build the application and flash it on the DK.
Compiling the example for the NRF52840-DK
Use west build to compile the example. You can have a look at the application's configuration in the its prj.conf file.
Flashing the NRF52840-DK with the Blecon Modem Firmware
You can now flash the example with west.
Connect the device to an echo network
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.
Go to https://blecon.app on your mobile (or search on your app store) and install the app.
Creating the echo network
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
.
You can now set this network in your network connection context by following the network link visible above (starting with https://blecon.app
).
Reading the device's URL
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).
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.
Make a first request
Making the request
You can now go back to the serial terminal - you should shortly see a first request being made!
What is happening behind the scenes?
Please have a look at the example's source code and review the program's control flow.
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.
Summary
This simple example showcases how you can use Blecon within Zephyr to send and receive data to a cloud service with Bluetooth Low Energy.
To explore Blecon further, book a technical meeting or email us at support@blecon.net
Last updated