Skip to main content
Version: 5.0

Expansion Package for STM32

info

STM32Cube Expansion Packages for LoRa connectivity deliver additional embedded software components to enable specific applicative use cases. It is used in our FreeRTOS demo example.

Prerequisites

Configure LoRaWAN

Before building the device application, you have to configure LoRaWAN identity and security information to:

  • Ensure that the default LoRaWAN configuration (region, class, data rate) suits your needs.
  • Set the IPv6 device prefix.

LoRaWAN Identity and Security

The LoRaWAN 1.0 device identity and security information is defined in the se-identity.h file that is located in the "App" folder.

Check the following settings:

  • STATIC_DEVICE_EUI is set to 1
  • LORAWAN_DEVICE_EUI is defined according to your needs
  • LORAWAN_JOIN_EUI is defined according to your needs since it is required by LORAWAN_APP_EUI
  • LORAWAN_NWK_KEY is defined according to your needs since it is required by LORAWAN_APP_KEY

LoRaWAN Device Configuration

LoRaWAN device configuration is defined in the fullsdkl2a.c file that is located in the "src" subfolder of FullSDK.

Check the following settings:

  • ACTIVE_REGION is defined with your region
  • LORAWAN_DEFAULT_CLASS is defined with the class of your device
  • LORAWAN_ADR_STATE is defined with the appropriate adaptative data rate
  • LORAWAN_DEFAULT_DATA_RATE is defined with the default data rate

Device IPv6 Prefix

Additionally, the IPv6 prefix of the device must be set in the task_sdk.c file in the same "src" subfolder of Core.

Initialize DEVICE_PREFIX with the IPv6 prefix value specified in the IP Network on Acklio IPCore.
Defining the device IPv6 prefix ensures that the synchronization messages used to configure the SDK will fit in the smallest LoRaWAN frames.

  • Acklio FullSDK runtime library for a ST-NUCLEO-L476RG board is located in this folder.

  • Acklio FullSDK runtime library for a ST-NUCLEO-WL55JC1 board is located in this folder

This library is configured for dynamic rules templates. The right template must be provisioned with a binary array provided by the CBOR package that can be downloaded from Acklio IPCore SCHC template, as illustrated below. The IPv6 device prefix must be set.

Download CBOR package

For the Demo purpose, the task named task_sdk provisions the CBOR package as a binary array called BINARY_RULES.

You can use L2 AT commands to set the IPv6 device prefix and the SCHC template.

Build the Device Application

The build steps are performed in STM32 Cube IDE when using an STM32L476RG board or in STM32 Cube WL when using an STM32WL55JC board.

Using ST Nucleo L476RG

Proceed as follows if you are using a ST-NUCLEO-L476RG microcontroller board.

  1. Start STM32CubeIDE.
  2. Go to "File > Open projects from File System...".
  3. Go to the "Import Source" directory.
  4. Choose Projects/NUCLEO-L476RG/Applications/LoRaWAN/FreeRTOS_IPv6UDP/STM32CubeIDE/sx1276mb1mas.
  5. Select the configuration you need between the default build configuration named "Release" (which is optimized for size) and another named "Debug" (which is optimized for debugging).
  6. Select the "Project Explorer" view, right-click the project then select "Build Project".

A warning message and a note message are displayed when compiling uip.c. This is an expected behavior.

Binary

The resulting binary file can be found here either in the "Release" or in the "Debug" subfolders, depending on the active build configuration.

Using ST Nucleo WL55JC1

Proceed as follows if you are using an "ST NUCLEO-WL55JC1" microcontroller board.

  1. Start STM32CubeWL.
  2. Go to "File > Open projects from File System..."?
  3. Go to the "Import Source" directory.
  4. Choose Projects/NUCLEO-WL55JC1/Applications/LoRaWAN/ATModem/STM32CubeIDE/. The default build configuration is named "Release".
  5. Select the configuration you need between the default build configuration named "Release" (which is optimized for size) and another named "Debug" (which is optimized for debug).
  6. Select the "Project Explorer" view, right-click the project then select "Build Project".
Binary

The resulting binary file can be found here either in the "Release" or in the "Debug" subfolders, depending on the active build configuration.

Flash the device

The flash steps are performed in STM32 Cube IDE.

Check that the board is connected to the development computer. Select the "Project Explorer" view then drag and drop the binary file to the mass storage device that is associated to the board.

Or proceed as follows:

  1. Select the Release build configuration as the active one.
  2. Go to "Run > Run Configurations..." to create the Run configuration from it, then click the "Run" button.

If the binary file is not found by the Run configuration, do the following:

  1. Close the run configuration window.
  2. Right-click the project in the "Project Explorer" view and select "Refresh".
  3. Start again.