1. Article purpose[edit source]
The purpose of this article is to explain how to integrate the LoRa concentrator module with STM32MP157F-DK2, managed by Linux on Cortex®-A7.
This article provides step-by-step instructions to:
run the Chirpstack server application on STM32MP1 discovery kit
to use STM32MP1 discovery kit as standalone packet forwarder.
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 PC prerequisites for the host PC hardware and software configuration required to activate and run the STM32 MPU platforms.
- openstlinux-5.10-dunfell-mp1-21-11-17
- STM32CubeProgrammer v2.10.0
- STM32CubeMonitor v1.4.0
2.2. Hardware prerequisites[edit source]
2.2.1. ST hardware[edit source]
For more information about the STM32 discovery board and how to start it up, jump to this section
Getting_started/STM32MP1_boards/STM32MP157F-DK2
- NUCLEO-WL55JC1.
For more information about the STM32WL nucleo kit and refer the webpage
NUCLEO-WL55JC
2.2.2. Additional hardware[edit source]
- RAKMODULES
- RAK EXTENSION
3. Hardware setup[edit source]
Step 1. Mount the RAK Module on the RAK extension Board.
Step 2. Connect the LoRa and GPS antenna to UFL connector of RAK module.
Step 3. Mount the RAK extension board on STM32MP1 discovery kit.
Step 4. Connect the power supply , USB cable and ethernet to discover kit .
4. Software setup[edit source]
To run the application, meta-st-loragateway layer needs to be added to OpenSTLinux distribution package . Please follow the steps given below to integrate the meta-st-loragateway 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-loragateway" 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/amitemrkumar/meta-st-loragateway
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-loragateway layer to build configuration.
bitbake-layers add-layer ../layers/meta-st/meta-st-loragateway/
Step 6. Build your layer separately and then build the complete Distribution Layer.
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 Discovery kit.
Step 8. Now that the image is flashed on the STM32MP157F-DK2 Discovery kit . Please 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 ipaddress of the STM32MP157 discovery kit.
ifconfig
Step 12. Connect the STM32MP157F-DK2 board using ssh connection.
ssh root@xxx.xxx.xxx.xxx
Step 13. Run the stm32mp1-config.sh script to configure the discovery kit.
cd /usr/local/lorawan-gateway ./stm32mp1-config.sh
5. How to run the chirpstack server application on STM32MP157F-DK2[edit source]
5.1. ChirpstackConfiguration[edit source]
Step 1. Select chirpstack option and click ok to proceed further.
5.1.1. Lora concentrator module configuration[edit source]
Step 1. Select concentrator selection option and click ok to proceed further.
Step 2. Select RAK2287 SPI with GPS to configure the rak2287 module and click ok to proceed further.
Step 3. Select EU868 ISM band and click ok to proceed further.
Step 4. Select EU863_870_1 and and click ok to proceed further.
Step 5. Wait to complete the frequency configuration.
Step 6. Frequency channel details will be displayed . Click ok to proceed further.
Step 7. If frequency configuration is correct then click Yes to proceed further else click No to redo the frequency configuration.
Step 8. Please wait to complete the Frequency configuration. Once it completes then click to proceed with next step.
5.1.2. Gateway ID configuration[edit source]
Step 1. Select Gateway ID Configuration from the menu and click 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 . Please 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 click ok.
Step 3b. Gateway eui will be displayed on the screen. Please store the gateway eui for later use . Click ok to move to next step.
Step 4a. Select the Manual configuration mode and click ok.
Step 4b. Enter the gateway eui and click ok to continue further.
Step 4c. Message will be displayed to show the entered value of gateway eui. If it is correct then click yes to continue further. Otherwise click No to enter the new value.
Step 4d. Gateway id configured message will appear on the screen . Click ok to move to next configuration.
5.1.3. Server address and port configuration[edit source]
Step 1. Now we have to configure the server details. Select server configuration and Click ok 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 , please select hostname and click ok .
Step 3b. Enter the server address as local host and then click ok.
Step 3c. If the displayed value of hostname is correct then click ok else click back and re-enter the value.
Step 3d. confirmation message will be displayed. Click ok to proceed further.
Step 3e. To modify the port up value , please select server port up and click ok .
Step 3f. Enter the port up value as 1700 and then click ok.
Step 3g. If the displayed value of server port up is correct then click ok else click back and re-enter the value.
Step 3h. confirmation message will be displayed. Click ok to proceed further.
Step 3i. To modify the port down value , please select server port down and click ok .
Step 3j. Enter the port down value as 1700 and then click ok.
Step 3k. If the displayed value of server port down is correct then click ok else click back and re-enter the value.
Step 3l. Confirmation message will be displayed. Click ok to proceed further.
Step 3m. Chirpstack hostname, port up/down is configured . Click back to move to next step
5.1.4. Communication mode configuration[edit source]
Step 1. Select Communication mode from the menu and click ok to proceed further.
Step 2. You have an option to select either lan or wlan for the communication. Please 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 click ok to proceed further.
Step 3b. Confirmation message for lan selection will be displayed. Click ok to proceed further to configure the database.
Step 4a. To use wifi, you have to select communication mode as wlan from the menu and click ok to proceed further.
Step 4b. Enter the ssid and click ok to proceed further.
Step 4c. Enter the password and click ok to proceed further.
Step 4d. A note for wifi will be displayed .Click ok to proceed further.
Step 4e. Wifi selection confirmation will be appear on screen.Click ok to proceed further.
5.1.5. Database configuration[edit source]
Step 1. Select the database configuration from the menu and click ok to proceed further.
Step 2. Database password configuration menu gives an option to modify the database password . Please follow the steps3a-3i to modify the password . Otherwise click back to move to next step.
Step 3a. Select chirpstack application server option from the menu to modify the password of application server and click ok to proceed further.
Step 3b. Enter the password and click ok.
Step 3c. To proceed with the modification click yes .
Step 3d. Confirmation message will be displayed. Click ok to move to next steps
Step 3e. Select chirpstack network server option from the menu to modify the password of networkserver and click ok to proceed further.
Step 3f. Enter the password and click ok.
Step 3g. To proceed with the modification click yes .
Step 3h. Confirmation message will be displayed. Click ok to move to next steps
Step 3i. Database passwords are now successfully modified . Click back to proceed with further configuration.
5.1.6. Save chirpstack configuration[edit source]
Step 1. Select the start chirpstack from the menu and click ok 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 . Click ok to continue.
Step 4. Click ok to proceed with selected configuration.
Step 5. Wait for the configuration to complete.
Step 6. Message to restart will be displayed .Click ok to continue.
Step 7. After the system reboots , you have to configure the chirptack webserver to connnect with the end device. Please follow the section "How to configure chirpstack server to register gateways and endnode.
5.2. Chirpstack server configuration[edit source]
Step 1. Open the chirpstack webpage using ipaddress . Enter user name and password as admin .
Step 2. Click on the network server.
Step 3. Click on ADD tab.
Step 4. Enter network sever name to identify the server and its host name alongwith 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 succesfully.
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.
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.
Step 11. Select Gateways from left menu . Then click on + CREATE tab.
Step 12a. Enter gateway details in the general tab.
Step 12b.Select Network-server and Service-profile from the dropdown tab. Click on CREATAE GATEWAY tab.
Gateway configuration done successfuly.
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 device details.
Step 14d.Select Device-profile from the drop down menu and Click on “CREATE DEVICE.
Step 14e.Enter Application Key in the KEYS(OTAA) tab . Click on SET DEVICE-KEYS.
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.3. 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. Create an account at cayenne .
Step 4. Sign-in at cayenne with your user ID.
Step 5. Select All Device from to configure devices .
Step 6. Search P-NCLEO-LRWAN1 in the Devices and widgets .Then select chirpstack from LoRa drop down window .
Step 7. Enter Device EUI then click Add device tab .
Open the Data tab to see the dashboard.
Live data is available in live tab.
5.4. STM32CubeMonitor Dashboard[edit source]
Step 1. Open STM32CubeMonitor Application.
Step 2. Import stm32wl-dashboard.json in stm32cubemonitor. Click Import tab .
Step 3.Open the LoRa Dashboard .
Step 4. Double Click on application/1/device/+event/up and Enter Server Address of the gateway.
Step 5. Enter the path to store the endnode data in json format.
Step 6. Click on DEPLOY tab and then open DASHBOARD to view the data
Step 7. Device details and chart will be available on the dashboard
6. How to run the LoRaWAN gateway application on STM32MP157F-DK2[edit source]
Step 1. Select Loragateway and click ok to proceed further.
6.1. Lora concentrator module configuration[edit source]
Step 1. Select concentrator selection option and click ok to proceed further.
Step 2. Select RAK2287 SPI with GPS to configure the rak2287 module and click ok to proceed further.
Step 3. Select EU868 ISM band and click ok to proceed further.
Step 4. Select EU863_870_1 and and click ok to proceed further.
Step 5. Wait to complete the frequency configuration.
Step 6. Frequency channel details will be displayed . Click ok to proceed further.
Step 7. If frequency configuration is correct then click Yes to proceed further else click No to redo the frequency configuration.
Step 8. Please wait to complete the Frequency configuration. Once it completes then click to proceed with next step.
6.2. Gateway ID configuration[edit source]
Step 1. Select Gateway ID Configuration from the menu and click 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 . Please 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 click ok.
Step 3b. Gateway eui will be displayed on the screen. Please store the gateway eui for later use . Click ok to move to next step.
Step 4a. Select the Manual configuration mode and click ok.
Step 4b. Enter the gateway eui and click ok to continue further.
Step 4c. Message will be displayed to show the entered value of gateway eui. If it is correct then click yes to continue further. Otherwise click No to enter the new value.
Step 4d. Gateway id configured message will appear on the screen . Click ok to move to next configuration.