Last edited one year ago

How to integrate LoRaWAN gateway


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 More info green.png 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.

Loragatewayimage c.png

To know more about the LoRaWAN® architecture, refer the article LoRaWAN® overview

This article provides step-by-step instructions to configure:

  • STM32MP157x-DKx Discovery kit More info green.png as LoRaWAN® gateway, network server and application server.

LoRaWAN® components such as gateways, network server and application server will be running on STM32MP157F-DK2 Discovery kit More info green.png. 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.

Loragatewayimage a.png

  • STM32MP157x-DKx Discovery kit More info green.png as LoRaWAN® Gateway.

STM32MP157x-DKx Discovery kit More info green.png 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.

Loragatewayimage b.png

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 More info green.png[edit source]

The STM32MP157D-DK1 Discovery kit More info green.png and STM32MP157F-DK2 Discovery kit More info green.png 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.

STM32MP157F-DK2

For more information about the STM32MP157x-DKx Discovery kit More info green.png 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.

NUCLEO-WL55JC1

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].

RAKModule0.png

2.2.2.2. Extension board[edit source]

It helps to connect the RAK wireless modules to STM32MP157x-DKx Discovery kit More info green.png by mapping the signal of module to 40 pin connector.
To know more about extension board, visit the RAK store [9].

RAKModule 1.png

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.

RAKModule 2a.png


Step 2. Connect the LoRa® and GPS antenna to UFL connector of RAK module.

RAKModule 3a.png

Step 3. Mount the RAK extension board on STM32MP157F-DK2 Discovery kit More info green.png. If you are using RAK module with SPI interface then USB cable connection is not required.

RAKModule 4a.png



RAKModule 6.png

Step 4. Connect the power supply, USB cable and ethernet to the STM32MP157F-DK2 Discovery kit More info green.png.

RAKModule 5.png

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 More info green.png.

Step 8. Now that the image is flashed on the STM32MP157x-DKx Discovery kit More info green.png, 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 More info green.png

 ifconfig

Step 12. Connect the STM32MP157x-DKx Discovery kit More info green.png using ssh connection.

 ssh root@xxx.xxx.xxx.xxx

Step 13. Run the stm32mp1-config.sh script to configure the STM32MP157x-DKx Discovery kit More info green.png.

  cd /usr/local/lorawan-gateway
 ./stm32mp1-config.sh 

Loragatewayimage 1.png

5. How to run the ChirpStack application on STM32MP157x-DKx Discovery kit More info green.png[edit source]

5.1. ChirpStack Configuration[edit source]

Step 1. Select "chirpstack" option and press enter key to proceed further.
Loragatewayimage 2.png

5.1.1. LoRa concentrator module configuration[edit source]

Step 1. Select "Concentrator selection" option and press enter key to proceed further.
Loragatewayimage 3.png

Step 2. Select "RAK5146 USB with GPS" to configure the rak5146 concentrator module and press enter key to proceed further.
Loragatewayimage RAK5146 1.png

Step 3. Select "EU868" ISM band and press enter key to proceed further.
Loragatewayimage 5.png

Step 4. Select "EU863_870_1" and press enter key to proceed further.
Loragatewayimage 6.png

Step 5. Wait to complete the frequency configuration.
Loragatewayimage 8.png

Step 6. Frequency channel details will be displayed. Press enter key to proceed further.
Loragatewayimage 7.png

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.
Loragatewayimage 9.png

Step 8. Wait to complete the Frequency configuration. Once it completes then press enter key to proceed with next step.
Loragatewayimage RAK5146 2.png

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.
Loragatewayimage 11.png

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.
Loragatewayimage 12.png

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.
Loragatewayimage 12ab.png

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.
Loragatewayimage 13.png

Step 4a. Select the "Manual configuration" mode and press enter key.
Loragatewayimage 12a.png

Step 4b. Enter the gateway EUI and press enter key to continue further.
Loragatewayimage 13a.png

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.
Loragatewayimage 13b.png

Step 4d. Gateway id configured message will appear on the screen. Press enter key to move to next configuration.
Loragatewayimage 13c.png

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.
Loragatewayimage 14.png

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.
Loragatewayimage 15.png

Step 3a. To modify the server host name, select hostname and press enter key.
Loragatewayimage 15a.png

Step 3b. Enter the server address as local host and then press enter key.
Loragatewayimage 15b.png

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.
Loragatewayimage 15c.png

Step 3d. Confirmation message will be displayed. Press enter key to proceed further.
Loragatewayimage 15d.png

Step 3e. To modify the port up value, select server port up and press enter key.
Loragatewayimage 15e.png

Step 3f. Enter the port up value as 1700 and then press enter key.
Loragatewayimage 15f.png

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.
Loragatewayimage 15g.png

Step 3h. confirmation message will be displayed. Press enter key to proceed further.
Loragatewayimage 15h.png

Step 3i. To modify the port down value, select server port down and repeat the process for the server port down value.
Loragatewayimage 15i.png

5.1.4. Communication mode configuration[edit source]

Step 1. Select "Communication mode" from the menu and press enter key to proceed further.
Loragatewayimage 16.png

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.
Loragatewayimage 17.png

Step 3b. Confirmation message for lan selection will be displayed. Press enter key to proceed further to configure the database.
Loragatewayimage 17a.png

Step 4a. To use wifi, you have to select communication mode as "wlan" from the menu and press enter key to proceed further.
Loragatewayimage 18.png

Step 4b. Enter the ssid and press enter key to proceed further.
Loragatewayimage 19.png

Step 4c. Enter the password and press enter key to proceed further.
Loragatewayimage 20.png

Step 4d. A note for wifi will be displayed, press enter key to proceed further.
Loragatewayimage 21.png

Step 4e. Wifi selection confirmation will be appear on screen. Press enter key to proceed further.
Loragatewayimage 22.png

5.1.5. Database configuration[edit source]

Step 1. Select the "Database configuration" from the menu and press enter key to proceed further.
Loragatewayimage 23.png

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".
Loragatewayimage 32.png

Step 3a. Select ChirpStack application server option from the menu to modify the password of application server and press enter key to proceed further.
Loragatewayimage 24.png

Step 3b. Enter the password and press enter key.
Loragatewayimage 25.png

Step 3c. To proceed with the modification select yes and then press enter key.
Loragatewayimage 26.png

Step 3d. Confirmation message will be displayed. Press enter key to move to next steps
Loragatewayimage 27.png

Step 3e. Select ChirpStack network server option from the menu to modify the password of network server and press enter key to proceed further.
Loragatewayimage 28.png

Step 3f. Enter the password and press enter key.
Loragatewayimage 29.png

Step 3g. To proceed with the modification select yes and press enter key.
Loragatewayimage 30.png

Step 3h. Confirmation message will be displayed. Press enter key to move to next steps.
Loragatewayimage 31.png

Step 3i. Database passwords are now successfully modified. Select back and press enter key to proceed with further configuration.
Loragatewayimage 32.png

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.
Loragatewayimage 33.png

Step 2. Wait to complete the gateway confirmation.
Loragatewayimage 34.png

Step 3. Gateway configuration done in the previous steps will be displayed. Press enter key to continue.
Loragatewayimage 35ab.png

Step 4. Press enter key to proceed with selected configuration.
Loragatewayimage 36.png

Step 5. Wait for the configuration to complete.
Loragatewayimage 37.png

Step 6. Message to restart will be displayed. Press enter key to continue.
Loragatewayimage 38.png

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 More info green.png 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

Loragatewayimage 38a.png

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 More info green.png . To get the ip address execute the following command.

 ifconfig

Step 1a. Enter user name and password as admin.

Chirpstackserver 1.png

Step 2. Click on the "network server".

Chirpstackserver 2.png

Step 3. Click on ADD tab.

Chirpstackserver 3.png

Step 4. Enter "network server name" to identify the server and its host name along with port number. Then click on ADD NETWORK SERVER

Chirpstackserver 4.png

stm32mp1-networkserver created successfully.

Chirpstackserver 5.png

Step 5. Select "service-profiles" from the left menu. Click on + CREATE tab.

Chirpstackserver 6.png

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.

Chirpstackserver 7.png

service profile created successfully.

Chirpstackserver 7a.png

Step 7. Select "Device-profiles" from left menu . Then click on + CREATE tab.
Chirpstackserver 8.png


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.
Chirpstackserver 9.png

Then click on CREATE DEVICE-PROFILE tab.

Chirpstackserver 10.png

Device profile created successfully. Chirpstackserver 11.png

Step 9. Select "Device supports OTAA" in “JOIN(OTAA/ABP)” tab. Then click on UPDATE-DEVICE-PROFILE tab.
Chirpstackserver 12.png

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.

Chirpstackserver 13.png

Step 11. Select "Gateways" from left menu. Then click on + CREATE tab.
Chirpstackserver 14.png

Step 12a. Enter "Gateway_EUI" value in the "Gateway Id " field. Refer section GatewayInfo to get the "Gateway_EUI" details.

Chirpstackserver 15.png

Step 12b. Select "Network-server" and "Service-profile" from the dropdown tab. Click on CREATE GATEWAY tab.
Chirpstackserver 16.png

Gateway configuration done successfully. Chirpstackserver 17.png

Step 13. Select "Applications" from the left menu and click on “+ CREATE” tab.
Chirpstackserver 18.png

Step 14. Enter Application details and click on “CREATE APPLICATION” tab.
Chirpstackserver 19.png

Step 14a. Click on Application name to configure the Device details.
Chirpstackserver 20.png

Step 14b. Click on “+ CREATE” tab to configure the device.
Chirpstackserver 21.png

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.

Chirpstackserver 22.png

Step 14d. Select "Device-profile" from the drop down menu and Click on “CREATE DEVICE.
Chirpstackserver 23.png

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.

Chirpstackserver 24.png

Step 14f. Device created successfully.
Chirpstackserver 25.png

""Gateway details after successful configuration.""
Chirpstackserver 26.png

""LIVE LORAWAN FRAMES captured by gateway.""
Chirpstackserver 27.png

DEVICE DATA is available at Applications. "'
Chirpstackserver 28.png

Device data captured for end nodes.
Chirpstackserver 29.png

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 More info green.png 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.
Chirpstackserver 39.png

Step 2. Select "Import" option from the menu as shown in the image.

Chirpstackserver 40.png

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.

Chirpstackserver 40a.png

Step 4.Open the LoRa Dashboard .

Chirpstackserver 43.png

Step 5. Double Click on "application/1/device/+event/up" to open the "Edit mqtt node".

Chirpstackserver 44.png

Step 6. Click on edit tab to update the server address of the gateway.

Chirpstackserver 44a.png

Step 7. You have to enter the ip address of STM32MP157x-DKx Discovery kit More info green.png and click on "update" tab

Chirpstackserver 44b.png

Step 8. Double Click on "write file" to provide the path to store the LoRa end node data in "json" fomat.

Chirpstackserver 44c.png

Step 9 Enter the path and click "Done".

Chirpstackserver 44d.png

Step 10. Click on DEPLOY tab

Chirpstackserver 45.png

Step 10. Click on "DASHBOARD" to view the data.

Chirpstackserver 46.png

Step 7. Device details and chart will be available on the dashboard
Chirpstackserver 47.png

5.5. Cayenne integration[edit source]

Step 1. Click on INTEGRATION tab in application . Click on EDIT in myDevices.

Chirpstackserver 30.png

Step 2. Select Cayenne as myDevices endpoint from the drop down menu. Click on ADD INTEGRATION TAB.

Chirpstackserver 31.png

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.
TTNImage 20a.png

Step 4b. Click on "Add new..." tab and select "Device & Widget" from the options to add new device.
TTNImage 20b.png

Step 5. Select "Chirpstack" from the LoRa® as shown in the image.

Chirpstackserver 32.png

Step 6. In the "Device&Widgets" search "P-NUCLEO-LRWAN1" to select "STM32 P-Nucleo-LRWAN1".

Chirpstackserver 33.png

Step 7. Enter the DevEUI and click on "Add device" tab.

Chirpstackserver 36.png

Open the Data tab to see the dashboard.

Chirpstackserver 37.png

Live data is available in live tab.

Chirpstackserver 38.png

6. How to configure STM32MP157x-DKx Discovery kit More info green.png as LoRaWAN® gateway/packet forwarder[edit source]

Step 1. Select LoRa gateway and press enter key to proceed further.
Loragatewayimage 1.png

6.1. LoRa concentrator module configuration[edit source]

Select "Concentrator selection" option and proceed as explained in LoRa concentrator module configuration Loragatewayimage 3a.png

6.2. Gateway EUI configuration[edit source]

Select "GatewayEUI configuration" from the menu and proceed as explained in Gateway EUI configuration. Loragatewayimage 11a.png

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.
Loragatewayimage 14a.png

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."

Loragatewayimage 15ml.png

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".

Loragatewayimage 15ia.png

6.4. Communication mode configuration[edit source]

Select "Communication mode" from the menu and proceed as explained in Communication mode configuration.

Loragatewayimage 16a.png

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.
Loragatewayimage 33a.png

Step 2. Wait to complete the gateway confirmation.
Loragatewayimage 34.png

Step 3.Gateway configuration done in the previous steps will be displayed. Press enter key to continue.
Loragatewayimage 35a.png

Step 4. Press enter key to proceed with selected configuration.
Loragatewayimage 36.png

Step 5. Wait for the configuration to complete.
Loragatewayimage 37.png

Step 6. Message to restart will be displayed. Press enter key to continue.
Loragatewayimage 38.png

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.
LoriotImage 2.png

Step 3. Select the base platform as "packet forwarder STM".
LoriotImage 3.png

Step 4. Enter the ethernet mac address to generate the gateway EUI. Refer chapter GatewayInfo to get the mac address.
LoriotImage 4.png

Step 5. Select the region EU863-870 from the region and select channel as EU868_RX2SF9 from Add Band option .
LoriotImage 5.png

Step 6. Open the sample network to see the status of register gateway.
LoriotImage 5a.png

7.2. Device registration to Loriot[edit source]

Step 1. Open the Application from Loriot Dashboard and click on Sample App.
LoriotImage 6.png

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.
  • LoriotImage 7.png

Step 3. Click on Device Activity in the Loriot® Dashboard to see the status.
LoriotImage 9.png

Step 4. To view the device data select "WebsocketApplication" and click on "Websocket sample by Loriot® ".
LoriotImage 9a.png
LoriotImage 9b.png

7.3. Cayenne integration in Loriot®[edit source]

Step 1.Go to Application in Loriot® Dashboard .Click on SampleApp and then select output.
LoriotImage 10.png

Step 2. Click on "+Add new output " tab and select cayenne from output type.
LoriotImage 11.png LoriotImage 12.png

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.
LoriotImage 12a.png

Step 4. Now click on "Access Tokens" in the Loriot® dashboard. Copy and store the Access token required for registration on cayenne portal.
LoriotImage 12b.png

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.
TTNImage 20a.png

Step 2b. Click on "Add new..." tab and select "Device & Widget" from the options to add new device.
TTNImage 20b.png

Step 3. Select "Loriot" from the LoRa as shown in the image.
TTNImage 20d.png

Step 4. In the "Device&Widgets" search "P-NUCLEO-LRWAN1" to select "STM32 P-Nucleo-LRWAN1".
TTNImage 21.png

Step 5. DevEUI , Loriot® server , Loriot® AppID and Loriot® Token configuration.

LoriotImage 14.png

Step 6. Device data will be updated on cayenne dashboard.
LoriotImage 15.png

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.
TTNImage 1.png


Step 2. Open the console to select the cluster after sign-in.
TTNImage 2.png TTNImage 3.png

Step 3. Select cluster as per your region.
TTNImage 4.png

Step 4. Click on register a gateway.
TTNImage 6.png

Step 5. Select "Gateways" tab and click on "+ Register gateway" to enter gateway details.
TTNImage 7a.png

Step 6. Enter the Gateway EUI details. Refer the section GatewayInfo to get the "Gateway_EUI" details.
TTNImage 7a1.png

Step 7. Click on "Confirm" tab to proceed further.
TTNImage 7a2.png

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.

TTNImage 8.png

Step 9. Gateway activity will be visible after successful registration.
TTNImage 9.png

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 ".
TTNImage 10.png

Step 2. Click on tab "+ Create application ".
TTNImage 10a.png

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.

TTNImage 11.png


Step 3. Click on "+ Register end device" tab to register the device.
TTNImage 12.png

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.

TTNImage 13.png
TTNImage 13a.png

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.

TTNImage 14.png

Step 6. The device activity will be visible as soon as device joins the network server.

TTNImage 15.png

TTNImage 16.png

8.3. Cayenne integration in The Things Network v3[edit source]

Step 1. Select webhooks from the integration. Click on the "+ Add webbook" tab.
TTNImage 17.png

Step 2. Select Cayenne from the webhook template.
TTNImage 18.png

Step 3. Enter text in "webhook id" field and click on "Create cayenne webhook" tab.
TTNImage 19.png

Step 4. Cayenne webhook will be added and its status will be updated.
TTNImage 20.png

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.
TTNImage 20a.png

Step 2b. Click on "Add new..." tab and select "Device & Widget" from the options to add new device.
TTNImage 20b.png

Step 3. Select "The Things Network" from the LoRa as shown in the image.
TTNImage 20C.png

Step 4. In the "Device&Widgets" search "P-NUCLEO-LRWAN1" to select "STM32 P-Nucleo-LRWAN1".
TTNImage 21.png

Step 5. Enter the DevEUI and click on "Add device" tab.

TTNImage 22.png

Step 6. Device data will be updated on cayenne dashboard.
TTNImage 23.png

Step 7. To view live data click on "Data" tab.
TTNImage 23a.png

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.
Stm32wlimage 1.png

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.
Stm32wlimage 2.png

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.

Stm32wlimage 2a.png

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.
Stm32wlimage 3.png

Step 7. Enable the generation of hex and binary file as shown below.
Stm32wlimage 4.png Stm32wlimage 5.png

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.
Stm32programmer 1.png

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.
TeratermImage 1.png

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.

10. References[edit source]

No categories assignedEdit