Skip to content

AVSystem/Anjay-freertos-client

Repository files navigation

Anjay-freertos-client

Supported hardware and overview

This repository contains LwM2M Client application based on open-source Anjay library and X-Cube-Cellular package which includes cellular modem drivers, FreeRTOS as well as mbedtls. This example supports the following configurations:

Project Path Board Modem
Projects/STM32L496G-DISCO/UserApp/BG96 P-L496G-CELL02 Discovery kit Quectel BG96 default modem provided with kit
Projects/B-L462E-CELL1/UserApp/TYPE1SC B-L462E-CELL1 Discovery kit Murata TYPE 1SE module with built-in eSIM (ST4SIM-200M)
Projects/B-L462E-CELL1/UserApp/TYPE1SC-AIBP B-L462E-CELL1 Discovery kit Murata TYPE 1SE module with built-in eSIM (ST4SIM-200M)
Supports AI Bridging Protocol.
Projects/B-U585I-IOT02A/BG96
B-U585I-IOT02A Discovery kit Quectel BG96 (provided with P-L496G-CELL02 devkit)

The project was developed using STM32Cube tools (STM32CubeIDE in particular).

The following LwM2M Objects are supported:

  • Security (/0),
  • Server (/1),
  • Device (/3),
  • Firmware Update (/5) (STM32L496G-DISCO and B-L462E-CELL1 projects),
  • Temperature (/3303),
  • Humidity (/3304),
  • Accelerometer (/3313),
  • Magnetometer (/3314),
  • Barometer (/3315),
  • Gyrometer (/3334),
  • Multiple Axis Joystick (/3345).

Cloning the repository

git clone --recursive https://github.com/AVSystem/Anjay-freertos-client

Compilation guide

  • Download STM32CubeIDE
  • Import the cloned project to your workspace
  • In the Project Explorer navigate to one of the [Project Path] taken from the table above, depending on the hardware you use.
  • To build and run the project:
    • For B-U585I-IOT02A board: simply build and run Anjay-freertos-client-B-U585I-IOT02A-BG96 configuration.
    • For STM32L496G-DISCO and B-L462E-CELL1 boards: please follow the instructions in Projects/STM32L496G-DISCO/README.md and Projects/B-L462E-CELL1/README.md respectively.

Connecting to the LwM2M Server

To connect to Coiote IoT Device Management LwM2M Server, please register at https://eu.iot.avsystem.cloud/. Then have a look at the Configuration menu to configure security credentials.

If you use BG96-based configuration, you must upgrade the firmware of the modem to at least BG96MAR02A08M1G revision. Older versions may cause an unexpected loss of connection.

Guide showing basic usage of Coiote DM is available on IoT Developer Zone.

Configuration menu

While connected to a serial port interface, and during bootup, the device shows:

Press any key in 3 seconds to enter config menu...

You can then press any key on your keyboard to enter the configuration menu. After that, you'll see a few configuration options that can be altered and persisted within the flash memory for future bootups.

Module persistence

This application features persistence of Security object, Server object and client's Attribute Storage to retain configuration of those modules over power cycles, to e.g. keep bootstrapped server configuration.

To enable module persistence, set "Use module persistence" option to y in shell config menu. Application will attempt to load those modules from non-volatile memory. Configuration of those modules from shell will be ignored, unless the application fails to restore the state from the memory.

The persisted state of aforementioned modules may be cleared using "Clear module persistence" option.

SIM Bootstrap (commercial feature)

STM32L496G-DISCO-BG96 project now features the SIM Bootstrap that allows bootstrapping the device using the SIM Smartcard. This feature is available only with releases of Anjay that include the bootstrapper commercial feature. To use the SIM Bootstrap feature, define USE_SIM_BOOTSTRAP in the STM32L496G-DISCO-BG96 project settings and make sure that the ANJAY_WITH_MODULE_BOOTSTRAPPER and ANJAY_WITH_MODULE_SIM_BOOTSTRAP options are enabled in Application/Inc/anjay/anjay_config.h.