1. Article purpose[edit source]
LoRaWAN® overview Gateway transmits/receives LoRa packets from end node device to network server. It acts as a packet forwarder.
The purpose of this article is to explain how to use STM32 Microprocessor for LoRaWAN® application. It explains integration of LoRa® concentrator module to STM32MP157F-DK2 Discovery kit and integration of LoRaWAN® opensource component from Chirpstack[1] and Semtech®[2].
LoRaWAN® is a MAC (media access control) layer protocol built on top of LoRa® modulation. LoRa® which stands for "Lo(ng) Ra(nge)") is a proprietary (Semtech®) low-power wide-area network (LPWAN) modulation technology. It is based on spread-spectrum modulation techniques. LoRaWAN® is a protocol layer that defines how devices use the LoRa® radio. It defines the network architecture, the communication, and security protocol and ensures interoperability with the LoRaWAN® network. LoRaWAN® architecture is mainly composed of the following elements:
- End devices are wirelessly connected to a LoRaWAN® network through radio gateways.
- Gateways forward all received LoRaWAN® radio packets to the network server.
- Network server is the center of the star topology. It runs on a server that manages the entire system.
- Application servers handle all the application layer payloads of the associated end-devices and provides the application-level service to the end user.
To know more about the LoRaWAN® architecture, refer the article LoRaWAN® overview
This article provides step-by-step instructions to configure:
LoRaWAN® components such as gateways, network server and application server will be running on STM32MP157F-DK2 Discovery kit .
This solution integrates Chirpstack open source LoRaWAN® components such as Network Server, Application Server.
Semtech® open source LoRa® packet forwarder is used to implement the Gateway. ChirpStack also provides the gateways bridge component which will be used to forward the packet received from packet forwarder to network server.
ChirpStack Application Server also provides the integration of MQTT, my Devices Cayenne and many more. This integration will help to further process the data. STM32CubeMonitor and myDevices Cayenne is used as dashboard to represent the data.
STM32MP157x-DKx Discovery kit will be used as packet forwarder to forward the packet received from LoRa® end node to third party network server such as "The Things Network (TTN)" and "Loriot®". To acheive this, Semtech® open source LoRa® packet forwarder is integrated in the OpenSTLinux. Here myDevice Cayenne is also supported by TTN and Loriot® and used as dashboard.
2. Prerequisites[edit source]
2.1. Software prerequisites[edit source]
- Linux® PC running Ubuntu® 18.04 or 20.04 is to be used. The developer can follow the OpenSTLinux_distribution for the host PC hardware and software configuration required to activate and run the STM32 MPU platforms.
2.2. Hardware prerequisites[edit source]
2.2.1. ST hardware[edit source]
2.2.1.1. STM32MP157x-DKx Discovery kit [edit source]
The STM32MP157D-DK1 Discovery kit and STM32MP157F-DK2 Discovery kit leverage the capabilities of the increased-frequency 800 MHz microprocessors in the STM32MP1 Series STM32MP1 Series to allow users easily develop applications using STM32 MPU OpenSTLinux Distribution software for the main processor and STM32CubeMP1 software for the co-processor.
For more information about the STM32MP157x-DKx Discovery kit and how to start it up, jump to this section STM32MP157x-DKx - hardware description
2.2.1.2. NUCLEO-WL55JC1[edit source]
The NUCLEO-WL55JC STM32WL Nucleo-64 board provides an affordable and flexible way for users to try out new concepts and build prototypes with the STM32WL Series microcontroller, choosing from the various combinations of performance, power consumption, and features.
For more information about the STM32WL Nucleo board refer the NUCLEO-WL55JC[3].
2.2.2. Additional hardware[edit source]
2.2.2.1. LoRa Concentrator Module[edit source]
The concentrator module is based on Semtech® SX130x digital base band chip. It has multiple channels to transmit/receive the LoRa® packets from several end node devices. To know more about the baseband chip visit Semtech®[4].
RAK provides several modules based on SX1301, SX1302 and SX1303 digital band chips such as RAK2245[5], RAK2287[6], RAK5146[7].
These modules support different frequency band and supports USB/SPI interface. To know more about these modules, visit the RAK[8].
2.2.2.2. Extension board[edit source]
It helps to connect the RAK wireless modules to STM32MP157x-DKx Discovery kit by mapping the signal of module to 40 pin connector.
To know more about extension board, visit the RAK store [9].
3. Hardware setup[edit source]
Step 1. Mount the RAK module on the RAK extension board. RAK5146 USB version is used for the demo. The steps will remain same for the other modules RAK2287 USB/SPI or RAK2245 SPI version.
Step 2. Connect the LoRa® and GPS antenna to UFL connector of RAK module.
Step 3. Mount the RAK extension board on STM32MP157F-DK2 Discovery kit . If you are using RAK module with SPI interface then USB cable connection is not required.
Step 4. Connect the power supply, USB cable and ethernet to the STM32MP157F-DK2 Discovery kit .
4. Software setup[edit source]
To run the application, meta-st-stm32mpu-app-lorawan layer needs to be added to OpenSTLinux distribution package. Follow the steps given below to integrate the meta-st-stm32mpu-app-lorawan in OpenSTLInux distribution package.
Step 1. Download and compile the STM32MP1 Distribution Package.
Step 2. Follow the default Example_of_directory_structure_for_Packages suggested by ST wiki page to follow this document synchronously.
Step 3. Download and clone the layer "meta-st-stm32mpu-app-lorawan" to "meta-st" layer.
cd $HOME/STM32MPU_workspace/STM32MP15-Ecosystemv3.1.0/Distribution-Package/openstlinux-5.10-dunfell-mp1-21-11-17/layers/meta-st
git clone "https://github.com/STMicroelectronics/meta-st-stm32mpu-app-lorawan" -b dunfell
Step 4. Set up the build configuration.
DISTRO=openstlinux-weston MACHINE=stm32mp1 source layers/meta-st/scripts/envsetup.sh
Step 5. Add the meta-st-stm32mpu-app-lorawan layer to build configuration.
bitbake-layers add-layer ../layers/meta-st/meta-st-stm32mpu-app-lorawan
Step 6. Building the OpenSTLinux distribution.
bitbake st-image-weston
Note: Building the Distribution Package for the first time may take several hours. Once the build is complete, the images are present in the following directory: build-<distro>-<machine>/tmp-glibc/deploy/images/stm32mp1.
Step 7. Follow instructions on Flashing the built image to program the new built images onto the STM32MP157x-DKx Discovery kit .
Step 8. Now that the image is flashed on the STM32MP157x-DKx Discovery kit , change the position of the boot switches in order to boot from the microSD card.
Step 9. Press the "Reset" button to reset the board.
Step 10. Now connect the minicom to the /dev/ttyACM0 device.
minicom -D /dev/ttyACM0
Step 11. Read the IP address of the STM32MP157x-DKx Discovery kit
ifconfig
Step 12. Connect the STM32MP157x-DKx Discovery kit using ssh connection.
ssh root@xxx.xxx.xxx.xxx
Step 13. Run the stm32mp1-config.sh script to configure the STM32MP157x-DKx Discovery kit .
cd /usr/local/lorawan-gateway ./stm32mp1-config.sh
5. How to run the ChirpStack application on STM32MP157x-DKx Discovery kit [edit source]
5.1. ChirpStack Configuration[edit source]
Step 1. Select "chirpstack" option and press enter key to proceed further.
5.1.1. LoRa concentrator module configuration[edit source]
Step 1. Select "Concentrator selection" option and press enter key to proceed further.
Step 2. Select "RAK5146 USB with GPS" to configure the rak5146 concentrator module and press enter key to proceed further.
Step 3. Select "EU868" ISM band and press enter key to proceed further.
Step 4. Select "EU863_870_1" and press enter key to proceed further.
Step 5. Wait to complete the frequency configuration.
Step 6. Frequency channel details will be displayed. Press enter key to proceed further.
Step 7. If frequency configuration is correct then select Yes and press enter key to proceed further else select No and press enter key to redo the frequency configuration.
Step 8. Wait to complete the Frequency configuration. Once it completes then press enter key to proceed with next step.
5.1.2. Gateway EUI configuration[edit source]
Step 1. Select "GatewayEUI configuration" from the menu and press enter key to proceed with next step.
Step 2. You have the option to enter the Gateway EUI either in auto or manual mode. In the auto configuration mode, it will use mac id to generate the gateway EUI. Follow steps 3a-3b to select auto configuration mode and steps 4a-4d to configure the EUI in manual mode
Step 3a. Select the "Auto configuration" mode and press enter key.
Step 3b. Select the "ethernet mac address " option to select ethernet mac-id for gateway eui generation. If you want to use wifi mac id to generate the gateway eui then select the "wifi mac address". Press enter key to proceed further.
Step 3c. Gateway EUI will be displayed on the screen. Store the gateway EUI for later use. Press enter key to move to next step.
Step 4a. Select the "Manual configuration" mode and press enter key.
Step 4b. Enter the gateway EUI and press enter key to continue further.
Step 4c. Message will be displayed to show the entered value of gateway EUI. If it is correct then select yes and press enter key to continue further. Otherwise select No and press enter key to enter the new value.
Step 4d. Gateway id configured message will appear on the screen. Press enter key to move to next configuration.
Note: Refer the article Automatic WiFi configuration at start up for wifi connectivity issues.
5.1.3. Server address and port configuration[edit source]
Step 1. Now we have to configure the server details. Select "Server configuration" and press enter key to proceed further.
Step 2. Server address for ChirpStack is localhost and it uses port number 1700 for up/down. If the displayed values is matching then click back to move next step. Otherwise follow steps 3a-3m to modify the details of local host.
Step 3a. To modify the server host name, select hostname and press enter key.
Step 3b. Enter the server address as local host and then press enter key.
Step 3c. If the displayed value of hostname is correct then press enter key else select back and press enter key to change the value.
Step 3d. Confirmation message will be displayed. Press enter key to proceed further.
Step 3e. To modify the port up value, select server port up and press enter key.
Step 3f. Enter the port up value as 1700 and then press enter key.
Step 3g. If the displayed value of server port up is correct then press enter key else select back and press enter key to change the value.
Step 3h. confirmation message will be displayed. Press enter key to proceed further.
Step 3i. To modify the port down value, select server port down and repeat the process for the server port down value.
5.1.4. Communication mode configuration[edit source]
Step 1. Select "Communication mode" from the menu and press enter key to proceed further.
Step 2. You have an option to select either "lan" or "wlan" for the communication. Follow steps 3a-3b to configure "lan" and 4a-4e to select "wlan" mode for server communication.
Step 3a. To use lan, you have to select communication mode as "lan" from the menu and press enter key to proceed further.
Step 3b. Confirmation message for lan selection will be displayed. Press enter key to proceed further to configure the database.
Step 4a. To use wifi, you have to select communication mode as "wlan" from the menu and press enter key to proceed further.
Step 4b. Enter the ssid and press enter key to proceed further.
Step 4c. Enter the password and press enter key to proceed further.
Step 4d. A note for wifi will be displayed, press enter key to proceed further.
Step 4e. Wifi selection confirmation will be appear on screen. Press enter key to proceed further.
5.1.5. Database configuration[edit source]
Step 1. Select the "Database configuration" from the menu and press enter key to proceed further.
Step 2. Database Password Configuration menu gives an option to modify the database password. Follow the steps3a-3i to modify the password. Otherwise select back and press enter key to proceed step.
The default password for Chirpstack Application Server and Chirpstack Network Server is "dbpassword".
Step 3a. Select ChirpStack application server option from the menu to modify the password of application server and press enter key to proceed further.
Step 3b. Enter the password and press enter key.
Step 3c. To proceed with the modification select yes and then press enter key.
Step 3d. Confirmation message will be displayed. Press enter key to move to next steps
Step 3e. Select ChirpStack network server option from the menu to modify the password of network server and press enter key to proceed further.
Step 3f. Enter the password and press enter key.
Step 3g. To proceed with the modification select yes and press enter key.
Step 3h. Confirmation message will be displayed. Press enter key to move to next steps.
Step 3i. Database passwords are now successfully modified. Select back and press enter key to proceed with further configuration.
5.1.6. Save ChirpStack configuration[edit source]
Step 1. Select the "Start ChirpStack" from the menu and press enter key to continue with the configuration. Passwords are now successfully modified.
Step 2. Wait to complete the gateway confirmation.
Step 3. Gateway configuration done in the previous steps will be displayed. Press enter key to continue.
Step 4. Press enter key to proceed with selected configuration.
Step 5. Wait for the configuration to complete.
Step 6. Message to restart will be displayed. Press enter key to continue.
Step 7. After the system reboots, you have to configure the chirpstack webserver to connect with the end device. Follow the section ChirpStack server configuration
5.2. GatewayInfo[edit source]
Run the stm32mp1-gateway-info.sh on STM32MP157x-DKx Discovery kit to get the STM32MP1 Gateway info.
It will be helpful to get the Gateway_EUI , mac address, and other details required for configuration in later stages.
cd /usr/local/lorawan-gateway ./stm32mp1-gateway-info.sh
5.3. ChirpStack server configuration[edit source]
Step 1. Open the URL "http://<ip address>:8080" by entering the ip address of STM32MP157x-DKx Discovery kit . To get the ip address execute the following command.
ifconfig
Step 1a. Enter user name and password as admin.
Step 2. Click on the "network server".
Step 3. Click on ADD tab.
Step 4. Enter "network server name" to identify the server and its host name along with port number. Then click on ADD NETWORK SERVER
stm32mp1-networkserver created successfully.
Step 5. Select "service-profiles" from the left menu. Click on + CREATE tab.
Step 6.Enter service-profile name, select "network server" from the drop down menu. Check the Add gateway meta-data box. Click on CREATE SERVICE-PROFILE.
service profile created successfully.
Step 7. Select "Device-profiles" from left menu . Then click on + CREATE tab.
Step 8. Enter device profile information. Then click on CREATE DEVICE-PROFILE tab.
Note: LoRaWAN® MAC version and LoRaWAN® Regional Parameters version field depends on the parameter specified to "LORAMAC_SPECIFICATION_VERSION " in STM32CubeWL firmware configuration as explained in chapter (step 5) of How to configure Nucleo-WL55JC as LoRa end node device.
Then click on CREATE DEVICE-PROFILE tab.
Device profile created successfully.
Step 9. Select "Device supports OTAA" in “JOIN(OTAA/ABP)” tab. Then click on UPDATE-DEVICE-PROFILE tab.
Step 10. Select "Cayenne LLP" from Payload codec drop down menu in “ CODEC ” tab. Then click on UPDATE-DEVICE-PROFILE tab.
Note: Cayenne Low Power Payload[10] is selected because it is enabled in STM32CubeWL firmware to view the data on the Cayenne dashboard. Refer chapter (step 3) of How to configure Nucleo-WL55JC as LoRa end node device for the configuration.
Step 11. Select "Gateways" from left menu. Then click on + CREATE tab.
Step 12a. Enter "Gateway_EUI" value in the "Gateway Id " field. Refer section GatewayInfo to get the "Gateway_EUI" details.
Step 12b. Select "Network-server" and "Service-profile" from the dropdown tab. Click on CREATE GATEWAY tab.
Gateway configuration done successfully.
Step 13. Select "Applications" from the left menu and click on “+ CREATE” tab.
Step 14. Enter Application details and click on “CREATE APPLICATION” tab.
Step 14a. Click on Application name to configure the Device details.
Step 14b. Click on “+ CREATE” tab to configure the device.
Step 14c. Enter the "LORAWAN_DEVICE_EUI " parameter value in the "Device EUI" field. Refer How to configure Nucleo-WL55JC as LoRa end node device chapter (step 6) to get the "LORAWAN_DEVICE_EUI".
Note: How to configure Nucleo-WL55JC as LoRa end node device chapter (step 10) also provides the information such as DevEUI, AppKey,AppEUI, DevAddr etc configured in the hardware.
Step 14d. Select "Device-profile" from the drop down menu and Click on “CREATE DEVICE.
Step 14e.Enter "LORAWAN_APP_KEY " parameter value in the "KEYS(OTAA)" tab. Refer How to configure Nucleo-WL55JC as LoRa end node device chapter (step 6) to get the "LORAWAN_APP_KEY ".
Click on SET DEVICE-KEYS.
Note: How to configure Nucleo-WL55JC as LoRa end node device chapter (step 10) also provides the information such as DevEUI, AppKey,AppEUI, DevAddr etc configured in the hardware.
Step 14f. Device created successfully.
""Gateway details after successful configuration.""
""LIVE LORAWAN FRAMES captured by gateway.""
DEVICE DATA is available at Applications. "'
Device data captured for end nodes.
5.4. STM32CubeMonitor Dashboard[edit source]
STM32CubeMonitor is a tool that allows real-time sampling and visualization of user variables while the application is running. It runs on Windows, Linux or macOS, and provides a browser-based interface. Refer STM32CubeMonitor_overview and STM32CubeMonitor_concepts to know more about it.The user can define their own flow to monitor variables for their application.
MQTT configuration file in the STM32MP157x-DKx Discovery kit must be modified by adding variables in the file mosquitto.conf
listener 1883
allow_anonymous true
cd /etc/mosquitto/ nano mosquitto.conf
Step 1. Open STM32CubeMonitor Application.
Step 2. Select "Import" option from the menu as shown in the image.
Step 3. Click on "Select a file to Import" and provide the path of the file "stm32wl-dashboard.json" and click on "Import" tab.
Note: stm32wl-dashboard.json file is available in meta-st-stm32mpu-app-lorawan at following path "/layers/meta-st/meta-st-stm32mpu-app-lorawan/recipes-framework/packet-forwarder/packet-forwarder.
Step 4.Open the LoRa Dashboard .
Step 5. Double Click on "application/1/device/+event/up" to open the "Edit mqtt node".
Step 6. Click on edit tab to update the server address of the gateway.
Step 7. You have to enter the ip address of STM32MP157x-DKx Discovery kit and click on "update" tab
Step 8. Double Click on "write file" to provide the path to store the LoRa end node data in "json" fomat.
Step 9 Enter the path and click "Done".
Step 10. Click on DEPLOY tab
Step 10. Click on "DASHBOARD" to view the data.
Step 7. Device details and chart will be available on the dashboard
5.5. Cayenne integration[edit source]
Step 1. Click on INTEGRATION tab in application . Click on EDIT in myDevices.
Step 2. Select Cayenne as myDevices endpoint from the drop down menu. Click on ADD INTEGRATION TAB.
Step 3. Go to myDevices Cayenne[11]. New user has to create an account using "Register" option. After registration use the credential to login in cayenne. Follow the "Step 4a" if you are adding the device for the first time. Otherwise use "Step 4b" to add another device.
Step 4a. Click on "All Devices" to choose a device to start a project.
Step 4b. Click on "Add new..." tab and select "Device & Widget" from the options to add new device.
Step 5. Select "Chirpstack" from the LoRa® as shown in the image.
Step 6. In the "Device&Widgets" search "P-NUCLEO-LRWAN1" to select "STM32 P-Nucleo-LRWAN1".
Step 7. Enter the DevEUI and click on "Add device" tab.
- In DevEUI you have to enter the "LORAWAN_DEVICE_EUI" value as explained in chapter (step 6) of How to configure Nucleo-WL55JC as LoRa end node device.
Open the Data tab to see the dashboard.
Live data is available in live tab.
6. How to configure STM32MP157x-DKx Discovery kit as LoRaWAN® gateway/packet forwarder[edit source]
Step 1. Select LoRa gateway and press enter key to proceed further.
6.1. LoRa concentrator module configuration[edit source]
Select "Concentrator selection" option and proceed as explained in LoRa concentrator module configuration
6.2. Gateway EUI configuration[edit source]
Select "GatewayEUI configuration" from the menu and proceed as explained in Gateway EUI configuration.
6.3. Server address and port configuration[edit source]
Step 1. Now we have to configure the server details. Select server configuration and press enter key to proceed further.
Step 2. You can use either TTN or Loriot® as network server. Refer the respective options for configuration.
6.3.1. Loriot® server configuration[edit source]
To Modify the Loriot server address , port up and down proceed as explained in Server address and port configuration excepting that the server address is "ap3.loriot.io" and the server port up and down numbers are "1780."
6.3.2. The Things Network (TTN) server configuration[edit source]
To Modify the TTN server address, port up and down proceed as explained in Server address and port configuration excepting that the server address is "au1.cloud.thethings.network" and the server port up and down numbers are "1700".
6.4. Communication mode configuration[edit source]
Select "Communication mode" from the menu and proceed as explained in Communication mode configuration.
6.5. Save lorawan gateway configuration[edit source]
Step 1. Select the start loragateway from the menu and press enter key to continue with the configuration. Passwords are now successfully modified.
Step 2. Wait to complete the gateway confirmation.
Step 3.Gateway configuration done in the previous steps will be displayed. Press enter key to continue.
Step 4. Press enter key to proceed with selected configuration.
Step 5. Wait for the configuration to complete.
Step 6. Message to restart will be displayed. Press enter key to continue.
Step 7. After the system reboots, you have to register the gateway on the How to register the LoRa end node device and gateway to the The Things Network (TTN) v3 server or How to register LoRa end node device and gateway to the Loriot network server as per your selection.
7. How to register LoRa end node device and gateway to the Loriot network server[edit source]
7.1. Loriot network server setup[edit source]
Step 1. Go to the Loriot® [12] and create an account on the preferred Loriot® server, such as
- "eu1.loriot.io" for Europe/Frankfurt, Germany, or
- "ap3.loriot.io" for Asia-Pacific/Mumbai, India.
Step 2. Click on "Register a new gateway" tab.
Step 3. Select the base platform as "packet forwarder STM".
Step 4. Enter the ethernet mac address to generate the gateway EUI. Refer chapter GatewayInfo to get the mac address.
Step 5. Select the region EU863-870 from the region and select channel as EU868_RX2SF9 from Add Band option .
Step 6. Open the sample network to see the status of register gateway.
7.2. Device registration to Loriot[edit source]
Step 1. Open the Application from Loriot Dashboard and click on Sample App.
Step 2. Click on "+ Enroll Device" from Loriot® Dashboard to enroll the device. Refer How to configure Nucleo-WL55JC as LoRa end node device chapter (step 6) to get the details.
- Select "OTAA" in the Enrollment process field.
- Enter the "LORAWAN_DEVICE_EUI " parameter value in the "Device EUI" field.
- Enter the "LORAWAN_JOIN_EUI " parameter value in the "Join EUI" field.
- Enter the "LORAWAN_APP_KEY " parameter value in the "Application Key" field.
- Click on "Enroll" tab.
Step 3. Click on Device Activity in the Loriot® Dashboard to see the status.
Step 4. To view the device data select "WebsocketApplication" and click on "Websocket sample by Loriot® ".
7.3. Cayenne integration in Loriot®[edit source]
Step 1.Go to Application in Loriot® Dashboard .Click on SampleApp and then select output.
Step 2. Click on "+Add new output " tab and select cayenne from output type.
Step 3. Go to Loriot® Dashboard and open the SampleApp in the Application. Copy and store the Application ID required for registration on cayenne web portal.
Step 4. Now click on "Access Tokens" in the Loriot® dashboard. Copy and store the Access token required for registration on cayenne portal.
7.4. Configuration on Cayenne[edit source]
Step 1. Go to myDevices Cayenne[13]. New user has to create an account using "Register" option. After registration use the credential to login in cayenne. Follow the "Step 2a" if you are adding the device for the first time. Otherwise use "Step 2b" to add another device.
Step 2a. Click on "All Devices" to choose a device to start a project.
Step 2b. Click on "Add new..." tab and select "Device & Widget" from the options to add new device.
Step 3. Select "Loriot" from the LoRa as shown in the image.
Step 4. In the "Device&Widgets" search "P-NUCLEO-LRWAN1" to select "STM32 P-Nucleo-LRWAN1".
Step 5. DevEUI , Loriot® server , Loriot® AppID and Loriot® Token configuration.
- Enter the value of "LORAWAN_DEVICE_EUI" in "DevEUI" field. Refer chapter (step 6) of How to configure Nucleo-WL55JC as LoRa end node device to get the details.
- Select "Loriot server " from the drop-down menu which is used for Loriot server setup as specified in Loriot network server setup.
- Enter the value of "Application ID" in the "Loriot AppID" field. Refer the chapter (step 3) of Cayenne integration in Loriot to get the details.
- Enter the value of "Application Token" in the Loriot token" field. Refer the chapter (step 4) of Cayenne integration in Loriot to get the details.
- Click on "Add device" tab.
Step 6. Device data will be updated on cayenne dashboard.
8. How to register the LoRa end node device and gateway to the The Things Network (TTN) v3 server[edit source]
8.1. The Things Network (TTN) v3 server setup[edit source]
Step 1. Open the The Things Network[14]. First you have to create an account on TTN.
Step 2. Open the console to select the cluster after sign-in.
Step 3. Select cluster as per your region.
Step 4. Click on register a gateway.
Step 5. Select "Gateways" tab and click on "+ Register gateway" to enter gateway details.
Step 6. Enter the Gateway EUI details. Refer the section GatewayInfo to get the "Gateway_EUI" details.
Step 7. Click on "Confirm" tab to proceed further.
Step 8. Gateway and frequency plan selection.
- Enter the Gateway name. It will be used to refer to your gateway instead of gateway ID.
- Select the frequency plan as per your gateway configuration. Refer section LoRa concentrator module configuration for details.
- Click on "Register Gateway" to proceed.
Step 9. Gateway activity will be visible after successful registration.
Step 10. Now proceed with device registration as explained in the next section Device registration to The Things Network v3 server.
8.2. Device registration to The Things Network v3 server[edit source]
Step 1. Open the console and click on "Create an application ".
Step 2. Click on tab "+ Create application ".
Step 3. Create application to register and manage end devices and their network data.
- Provide an application ID in the "Application ID" field.
- "Application name" and "Description" fields are optional.
- Click on "create application " to create the application.
Step 3. Click on "+ Register end device" tab to register the device.
Step 4. LoRa® end device registration. Refer How to configure Nucleo-WL55JC as LoRa end node device chapter to get the details.
- Select "Enter end devices specifics manually" option in the input method.
- Select the Frequency plan selected for stm32wl end node.
- Select "LoRaWAN Specification 1.0.4" for the field "LoRaWAN version".
- Select "Regional Parameters 1.0.1" for the field "Regional Parameters version".
- Click on Show advanced activation
- Select "Over the air activation(OTAA)" in "Activation mode" field.
- select "None (class A only)" in Additional LoRaWAN class capabilities" field.
- Select Use network's default MAC settings" in "Network defaults" field.
- Enter the "JOIN EUI " value for Provisioning information.
- Click on "Confirm" tab.
Note: LoRaWAN® version and Regional Parameters version field depends on the parameter specified to "LORAMAC_SPECIFICATION_VERSION " in STM32CubeWL firmware.
- 0x01000300: Link Layer(L2) v1.0.3 + Regional Parameters (RP) v1.0.3.
- 0x01000400: Link Layer TS001-1.0.4 + Regional Parameters RP002-1.0.1.
Step 5. DevEui and AppKey configuration. Refer chapter ( step 6) of How to configure Nucleo-WL55JC as LoRa end node device to get details.
- Enter "LORAWAN_DEVICE_EUI" value in DevEui field.
- Enter "LORAWAN_APP_KEY" parameter value in "AppKey" field.
Step 6. The device activity will be visible as soon as device joins the network server.
8.3. Cayenne integration in The Things Network v3[edit source]
Step 1. Select webhooks from the integration. Click on the "+ Add webbook" tab.
Step 2. Select Cayenne from the webhook template.
Step 3. Enter text in "webhook id" field and click on "Create cayenne webhook" tab.
Step 4. Cayenne webhook will be added and its status will be updated.
8.4. Configuration on Cayenne[edit source]
Step 1. Go to myDevices Cayenne[15]. New user has to create an account using "Register" option. After registration use the credential to login in cayenne. Follow the "Step 2a" if you are adding the device for the first time. Otherwise use "Step 2b" to add another device.
Step 2a. Click on "All Devices" to choose a device to start a project.
Step 2b. Click on "Add new..." tab and select "Device & Widget" from the options to add new device.
Step 3. Select "The Things Network" from the LoRa as shown in the image.
Step 4. In the "Device&Widgets" search "P-NUCLEO-LRWAN1" to select "STM32 P-Nucleo-LRWAN1".
Step 5. Enter the DevEUI and click on "Add device" tab.
- In DevEUI you have to enter the "LORAWAN_DEVICE_EUI" value as explained in chapter (step 6) of How to configure Nucleo-WL55JC as LoRa end node device.
Step 6. Device data will be updated on cayenne dashboard.
Step 7. To view live data click on "Data" tab.
9. How to configure Nucleo-WL55JC as LoRa end node device[edit source]
Step 1. Download the STM32CubeWL firmware [16].
Step 2. Import/Open the LoRaWAN_End_Node project in the STM32CubeIDE.
~\STM32Cube_FW_WL_V1.3.0\Projects\NUCLEO-WL55JC\Applications\LoRaWAN\LoRaWAN_End_Node\STM32CubeIDE
Note: EWARM and MDK-ARM workspace is also available.
Step 3. To configure European band on 868MHz. Open the file "lora_app.h" and assign the parameter "LORAMAC_REGION_EU868" to "ACTIVE_REGION".
Enable Cayenne Low Power Payload as as shown in the below image.
Parameter to select different region frequency band is given below.
- LORAMAC_REGION_AS923 /*AS band on 923MHz*/
- LORAMAC_REGION_AU915 /*Australian band on 915MHz*/
- LORAMAC_REGION_CN779 /*Chinese band on 779MHz*/
- LORAMAC_REGION_EU868 /*European band on 868MHz*/
- LORAMAC_REGION_KR920 /*South korean band on 920MHz*/
- LORAMAC_REGION_IN865 /*India band on 865MHz*/
- LORAMAC_REGION_US915 /*North american band on 915MHz*/
- LORAMAC_REGION_RU864 /*Russia band on 864MHz*/
- LORAMAC_REGION_CN470 /*Chinese band on 470MHz*/
- LORAMAC_REGION_EU433 /* European band on 433MHz*/
Note: STM32WL Nucleo board is available in 2 versions to support high frequency band and low frequency band. You have to take care while ordering the development kit."
- NUCLEO-WL55JC1 supports high-frequency band. RF frequency range from 865 to 928 MHz."
- NUCLEO-WL55JC2 supports Low-frequency band. RF frequency range from 433 to 510 MHz."
Step 4. Enable the region as per the band selected by uncommenting the definition in "lorawan_conf.h" file.
Step 5. By default, Link Layer TS001-1.0.4 and Regional Parameters RP002-1.0.1 is configured. To select the different |LoRaWAN® version modify the value of "LORAMAC_SPECIFICATION_VERSION" parameter in "lorawan_conf.h" file.
- 0x01000300: Link Layer(L2) v1.0.3 + Regional Parameters (RP) v1.0.3.
- 0x01000400: Link Layer TS001-1.0.4 + Regional Parameters RP002-1.0.1.
Step 6.Open the "se-identity.h" file to enter the "LORAWAN_DEVICE_EUI", "LORAWAN_JOIN_EUI", "LORAWAN_APP_KEY" and "LORAWAN_NWK_KEY".
These values should be unique in each device. The values shown below are only for reference.
Step 7. Enable the generation of hex and binary file as shown below.
Step 8. After this modification, you have to build the target. After successful build, hex file will be generated at following path.
~\STM32Cube_FW_WL_V1.3.0\Projects\NUCLEO-WL55JC\Applications\LoRaWAN\LoRaWAN_End_Node\STM32CubeIDE\Debug
Step 9. Now program the generated hex file 'LoRaWAN_End_Node.hex' in Nucleo-WL55JC1 kit using stm32cubeprogrammer.
Step 10. Open the "Tera Term" application and configure the baud rate to 115200. Reset the hardware to view the debug messages. You can also verify the configured parameter in IDE with the values displayed on the screen. Make a note of "LORAWAN_DEVICE_EUI", "LORAWAN_JOIN_EUI", "LORAWAN_APP_KEY" and "LORAWAN_NWK_KEY" parameter values. It will be required for registration.
Step 11. Now the device is ready for registration in the LoRaWAN® servers such as chirpstack, Loiot, TTN etc. You have to repeat the process to add several end node devices.