Supported hardware
This example project mainly targets the STM32L496AG-DISCOVERY development kit P-L496G-CELL02.
However, the code should run with basic functionality on any officially supported board by Mbed OS, having at least 512K flash and 32K of memory and additional SPI chip for configuration persistence, with the exception that the network setup will need to be implemented (see NetworkService class in main.cpp).
Sensor board X-NUCLEO-IKS01A2
The application also supports optional X-NUCLEO-IKS01A2 sensor board. This board can be attaached on top of most STM32 boards. You can enable it via configuration "SENSORS_IKS01A2=1"
in mbed_app.json
.
Overview
Application uses mbed OS as the base operating system.
The following LwM2M Objects are supported in this application:
- Security (/0),
- Server (/1),
- Device (/3),
- Connectivity Monitoring (/4).
Following objects are optional depending on HW choice:
- Humidity (/3304),
- Accelerometer (/3313),
- Magnetometer (/3314),
- Barometer (/3315),
- Joystick (/3345).
Compilation guide
With Mbed Studio (NOTE: requires registration on mbed.com)
- Download and install Mbed Studio
- Start Mbed Studio, click File -> Open Workspace and pick the folder with cloned repository.
- In the Libraries view, and then on
(!)
button, and then Fix all, to check out all dependencies (it may take a while). - You can now compile and flash project through UI.
NOTE: if you're using a built-in serial monitor, please make sure to use 115200
as a baud rate.
With mbed-cli
Ubuntu 18.04 or later
- Download and unpack the GCC ARM Compiler.
- Install dependencies:
sudo apt install python-pip git mercurial
- Install mbed-cli tool:
pip install mbed-cli
- Configure the project:
- set path to the compiler unpacked in the first step, e.g.
mbed config GCC_ARM_PATH ~/Downloads/gcc-arm-none-eabi-9-2019-q4-major/bin
- fetch dependencies:
mbed deploy
- set path to the compiler unpacked in the first step, e.g.
- Compile the project:
mbed compile
. The resulting binary is then./BUILD/DISCO_L496AG/GCC_ARM/Anjay-mbedos-client.bin
.
Windows 10
- Download and install mbed-cli.
- Open project's directory in terminal and fetch dependencies:
mbed deploy
. - Compile the project:
mbed compile
. The resulting binary is then./BUILD/DISCO_L496AG/GCC_ARM/anjay-mbedos-client.bin
.
Flashing the STM32 board
- Connect the USB STLINK micro-USB port on the STM32 board to your computer through a USB cable.
- The device should show up as a mass-storage device named
DIS_L496ZG
(or similar). - Copy the binary
anjay-mbedos-client.bin
to the device. This triggers flashing procedure. - After everything finishes, the STM32 board will reboot.
- You may now access the serial port interface e.g. through picocom on Linux:
picocom -b 115200 /dev/ttyACM0
or PuTTY on Windows.
Connecting to the LwM2M Server
To connect to Coiote IoT Device Management LwM2M Server, please register at https://www.avsystem.com/try-anjay/. Then have a look at the Configuration menu to configure security credentials and other necessary settings (like modem APNs, etc.).
NOTE: You may use any LwM2M Server compliant with LwM2M 1.0 TS. The server URI can be changed in the Configuration menu.
Configuration menu
While connected to a serial port interface, and during bootup, the device shows:
Press any key in 3 seconds to enter device configuration 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.