Appendix to LWM2M FOTA and Data Demonstration System

Warning

Content in this section is provided on a best-effort basis.

This document contains additional information related to the LWM2M FOTA and Data Demonstration System.

Additional IoT Devices

96Boards Carbon

In order to use the 96Boards Carbon with this demonstration system, you’ll first need to set up a secondary chip on the board that provides Bluetooth functionality.

There are two chips on the Carbon that need firmware, an STM32 and an nRF51. The STM32 runs the bootloader and main application. The nRF51 is the secondary chip which needs to be flashed first to provide Bluetooth to the STM32, which doesn’t support it on its own.

Build the application for the secondary chip from the Zephyr microPlatform installation directory:

./genesis build -b 96b_carbon_nrf51 -c prj_96b_carbon_nrf51.conf \
                --skip-signature zephyr/samples/bluetooth/hci_spi/

This creates a firmware binary for the nRF51 at the following location:

outdir/zephyr/samples/bluetooth/hci_spi/96b_carbon_nrf51/app/zephyr.elf

Flashing the nRF51 device requires an external SWD flashing tool, such as the Black Magic Debug Probe or Segger JLink.

Before flashing this file, first put your Carbon in DFU mode by unplugging it, then plugging it back in with the BOOT0 button pressed. This ensures the STM32 firmware does not interfere with the nRF51. Then follow the Zephyr 96b_carbon_nrf51 flashing instructions to flash the binary to the nRF51.

Now run this from the Zephyr microPlatform installation directory to build the main application:

./genesis build -b 96b_carbon zephyr-fota-samples/dm-lwm2m

You’ll need to install dfu-util to flash this binary. A recent version of dfu-util is required; depending on your host operating system, you may need to build this from source.

To flash the STM32, first put your Carbon into DFU mode again. Then, from the Zephyr microPlatform installation directory, run:

./genesis flash -b 96b_carbon zephyr-fota-samples/dm-lwm2m

FRDM-K64F

Building for FRDM-K64F requires some configuration information which depends on your local network:

  • An IP address to use for the IoT gateway
  • Whether the board should use DHCP, or a static IP address

This information must be written to the file zephyr-fota-samples/dm-lwm2m/boards/frdm_k64f-local.conf in the Zephyr microPlatform installation directory.

To use DHCP, with gateway IP address A.B.C.D, create the file with the following contents.

CONFIG_NET_DHCPV4=y
CONFIG_NET_APP_PEER_IPV4_ADDR="A.B.C.D"

To use a static IP address X.Y.Z.W for the FRDM-K64F instead, use this.

CONFIG_NET_APP_MY_IPV4_ADDR="X.Y.Z.W"
CONFIG_NET_APP_PEER_IPV4_ADDR="A.B.C.D"

In addition, zephyr-fota-samples/dm-lwm2m/boards/frdm_k64f-local.conf must contain a line which specifies the IP address of the COAP proxy. In this case, that’s just the IP address of your gateway device. To use IP address L.M.N.O, add a line like this after the other networking configuration:

CONFIG_LWM2M_FIRMWARE_UPDATE_PULL_COAP_PROXY_ADDR="L.M.N.O"

Now you can build the binaries. From the Zephyr microPlatform installation directory:

./genesis build -b frdm_k64f zephyr-fota-samples/dm-lwm2m

Flashing this board requires pyOCD. To install:

pip install --user pyOCD

If you don’t have pip installed, see the pip Installation documentation. On Linux platforms, you also need to install the following udev rules as root, then unplug and plug back in any boards you may have connected:

echo 'ATTR{idProduct}=="0204", ATTR{idVendor}=="0d28", MODE="0666", GROUP="plugdev"' > /etc/udev/rules.d/50-cmsis-dap.rules

To flash the binaries, plug the K64F into your system via the USB connector labeled “SDA USB”. Then, from the Zephyr microPlatform installation directory:

./genesis flash -b frdm_k64f zephyr-fota-samples/dm-lwm2m

Additional Leshan Information

This section contains additional information for more complex use cases or further development.