This example project mainly targets the STM32L496AG-DISCOVERY development kit P-L496G-CELL02 along with the optional X-NUCLEO-IKS02A1 sensor board.
However, the code should run with basic functionality on any officially supported board by mbedOS: https://os.mbed.com/platforms, 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).
It uses mbedOS as the base operating system.
The following LwM2M Objects are supported in this application:
- Security (/0),
- Server (/1),
- Access Control (/2),
- Device (/3),
- Connectivity Monitoring (/4),
- Humidity (/3304),
- Accelerometer (/3313),
- Magnetometer (/3314),
- Barometer (/3315),
- Joystick (/3345).
- 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&flash project through UI.
NOTE: if you're using a built-in serial monitor, please make sure to use 115200
as a baud rate.
- 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
.
- 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
.
- 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.
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.
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.