Use the Blecon Modem from an MCU
Using the Modem API from an MCU
Last updated
Using the Modem API from an MCU
Last updated
Get Support
Ask a questionThis guide covers getting started using the Blecon Device SDK with a supported Zephyr board. This example uses the ST Nucleo L433-RC-P, however most boards supporting with an UART supporting hardware flow control can be made to work as well.
The Blecon Device SDK allows you to use a Blecon modem directly from your device. Initially, the SDK supports the Zephyr operating system.
If you're not familiar with Zephyr, 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.
The Nucleo board will drive a Blecon modem connected to its UART. First, you'll need to flash a supported Blecon modem platform with the latest modem firmware. Follow the modem getting started guide for more details.
You can then connect your modem to the Nucleo board.
For ease of use we have listed the corresponding nRF52840DK pins for this modem platform below. When using this platform, make sure the power switch is on, and SW6 is set to "nRF only" to prevent the modem board from drawing too much power.
See the Modem Firmware Releases page for the relevant pinout for other modems.
5V
5V
GND
GND
D0 / UART1 RX / PA10
TX
D0 / P1.01
D1 / UART1 TX / PA9
RX
D1 / P1.02
D2 / UART1 RTS / PA12
CTS
D3 / P1.04
D10 / UART1 CTS / PA11
RTS
D2 / P1.03
Install the Blecon app or Set up a Blecon Hotspot.
If you don't want to change the example's source code, prebuilt firmware images for supported boards are also available in the latest SDK's release
Make sure your environment is set up to build for Zephyr 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:
Update the workspace:
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.
You can now flash the example with west.
Connect a serial terminal (baudrate 115200bps) to the DK to read the device's unique URL.
You can also type blecon announce
command in the Zephyr shell to identify your device with your hotspot.
Once obtained, you can register this device with your network.
The hello world example makes requests to a globally available integration. In the request parameters, the namespace
field is set to "global:blecon_util"
and method
field to "echo"
. To send data to your own integration instead, set those to NULL
.
You can now go back to the serial terminal - you should shortly see a first request being made!
To make further requests, use the blecon connection_initiate command:
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. As part of preparing the request, the program queues one operation to send data (the ASCII string "Hello blecon!") and one to receive the response.
Callbacks are raised when these operations complete.
Refer to the Modem API Referencefor details on the various functions calls and callbacks.
This simple example showcases how you can use Blecon from an MCU running Zephyr to send and receive data to a cloud service using Bluetooth Low Energy.
To explore Blecon further, book a technical meeting or email us at support@blecon.net