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
This guide covers getting started using the with a supported board. This example uses the , 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.
The aim of this getting started guide is to help you evaluate the Blecon Device SDK by compiling, flashing and running a simple example.
You can then connect your modem to the Nucleo board.
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
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.
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.
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:
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.
If you're not familiar with Zephyr, please head first .
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 for more details.
Install the 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
Make sure your environment is set up to build for Zephyr by following through the . This guide shows you how to install all the tools you will need for this quickstart.
Use west build to compile the example. You can have a look at the application's configuration in the its .
Please have a look at the and review the program's control flow.
To explore Blecon further, or email us at