User manual ® Demonstration of ST25DV64KC LoRa provisioning Introduction This demonstration is a joint development between STMicroelectronics and the ISCA Laboratory, Hellenic Mediterranean University (refer to for more information). ® LoRa is a long-range, low data rate, and lower-power wireless communication system used in industrial IoT applications including, for example, smart metering, sensor monitoring, alarm, etc.
Note: The information provided is from third-party URL addresses, active at the time of document publication. However, STMicroelectronics shall not be liable for any change, move, or inactivation of the URL or the referenced material mentioned above. UM3146 - Rev 1...
UM3146 Glossary Glossary Table 2. Acronyms and abbreviations Acronyms Definition AppEUI In LoRaWAN® specifications before 1.1, JoinEUI was called AppEUI. See JoinEUI. A device specific encryption key used during OTAA to derive both the Network Session Key and AppKey Application Session Key. Application Session Key is used to encrypt the messages to ensure confidentiality.
China. Figure 2. NUCLEO-WL55JC2 • X-NUCLEO-NFC07A1 Nucleo shield. This Nucleo shield contains a ST25DV64KC NFC tag. This dynamic NFC tag is connected to the STM32WL55 MCU to provide it NFC bidirectional connectivity. Figure 3. X-NUCLEO-NFC07A1 Nucleo shield The ST1 jumper must be placed on the 3.3 V side.
UM3146 Hardware requirements Note: Alternatively, it is also possible to use a board ANT7-T-25DV64KC that has a smaller foot print and NFC antenna, but some soldering is needed to connect it to the Nucleo_WL55 board. Figure 4. Nucleo_WL55 board Use either the board X-NUCLEO-NFC07A1 or the board ANT7-T-25DV64KC, both are not necessary. Table 3.
UM3146 Software requirements Software requirements In order to use this demonstration, the following software is required: • STM32CubeIDE • STM32CubeProgrammer • Optional: To rebuild the Android application, refer to the Android Studio website ([2]). UM3146 - Rev 1 page 6/33...
UM3146 Prerequisites Prerequisites The current demo relies on a LoRaWAN® infrastructure provided by The Things Network. This chapter explains how to create an account and create an application to The Things Network, which is necessary before using it. This registration is free and does not require a subscription. Creation of a user account on The Things Network console •...
UM3146 Registration of a gateway on The Things Network Registration of a gateway on The Things Network ® If using your own LoRa gateway, register it on The Things Network by clicking the Gateways tab and then the Register gateway button: Figure 8.
UM3146 Android application installation Android application installation Install the Android application from Google Play (refer to [4]). Android APK and source code can be downloaded from STSW-ST25010. To open and rebuild the source code, use Android Studio (refer to [2]). Personalization of the Android application For the Android application, no change is needed in the source code.
UM3146 Authentication in the Android application Figure 10. OAuth 2.0 authentication steps Click the Login button. The Android application opens a URL to start a login session on The Things Network server. Note: Example URL: https://eu1.cloud.thethings.network/oauth/authorize?client_id=st25-lora- provisioning&redirect_uri=https://www.myst25.com/lora/login/&state= 0FEF55D9FD8AE3F492EED15E4B498F71&response_type=code For The Things Network URL for user authentication, refer to [6]. The following parameters are passed to this URL: –...
UM3146 Troubleshooting Troubleshooting Depending on the smartphone and the browser used, the Android application link may not work as expected. For example, the redirect_uri (https://www.myst25.com/lora/login/) may open in the browser without opening the Android application. The following example demonstrates how to resolve the problem on a Google Pixel 6: Go to the Settings menu and search for Opening links.
UM3146 Troubleshooting Click the Add link button and tick the check box corresponding to www.myst25.com: Figure 13. Adding links ® The links pointing to www.myst25.com open in the LoRa provisioning application. However, each smartphone has its own organization for the Settings menu, so the wording and the location of the settings may be different.
UM3146 STM32WL firmware installation STM32WL firmware installation Download the STM32WL firmware from STSW-ST25DV010. This package contains the bootloader (source code and binary) and the firmware (source code and binaries for the European region). • For the bootloader, it is not necessary to recompile it, use directly as provided. •...
UM3146 Firmware personalization Change define of ACTIVE_REGION: Figure 15. Define the ACTIVE_REGION The possible values are listed in the enum LoRaMacRegion_t of the file Middlewares/Third_Party/ LoRaWAN/Mac/LoRaMacInterfaces.h: * LoRaMAC region enumeration typedef enum eLoRaMacRegion * AS band on 923MHz LORAMAC_REGION_AS923, * Australian band on 915MHz LORAMAC_REGION_AU915, * Chinese band on 470MHz LORAMAC_REGION_CN470,...
UM3146 Build of firmware binaries Figure 16. #define NFC_TYPE Build of firmware binaries The firmware is built with the STM32CubeIDE using the Build All entry in the project menu. Figure 17. Build firmware binaries Flashing Use STM32CubeProgrammer to flash the bootloader and the firmware: •...
UM3146 How to run the demonstration How to run the demonstration Login on The Things Network Launch the Android application and click the Login button. This opens a web browser to perform an OAuth authentication. The page requires you to provide to log in and password of your account on The Things Network: Figure 18.
UM3146 Add a LoRa® device to The Things Network ® Figure 19. LoRa main screen At the top of the screen, select the application with the name chosen in Section 5.2 Creation of an application on The Things Network. In this case, the application is named ST25 LoRa Demo. ®...
An NFC communication takes place between the smartphone and the LoRa device. This NFC communication uses the FTM mailbox of the ST25DV64KC to collect some information about the device. A popup opens to confirm adding this device to the application on The Things Network. The popup displays some information about the device, for example, its unique DevEUI.
UM3146 Getting data from theLoRa® device Figure 21. Set the device GPS location ® The GPS location is saved in the information associated to this device on The Things Network. LoRa devices are frequently used in isolated places, therefore knowing the exact GPS location is practical and may help to locate the device as necessary.
UM3146 Display of LoRa® data Figure 22. User button SW2 on Nucleo board On The Things Network console, click the application and then select the end device. Use the Live Data tab to see all the data (join data, uplink, and downlink data) exchanged with this device. The uplink data message contains the data sent by the device (“alt”, “ampr”, “bmehum”, etc.).
UM3146 Display of LoRa® data ® Figure 24. LoRa dashboard In this demonstration, the data collected by TTN’s LoRaWAN® server is exported through MQTT and displayed on a smartphone dashboard or in a web browser. ® TTN server acts as an MQTT broker sending notifications every time LoRa data is available.
UM3146 Display of LoRa® data Figure 25. MQTT URL and credentials When using the MQTT for the first time, click the Generate new API key button. Note: Copy the key and save it in a secure place because it is not possible to access it again. The API key is used as a password when configuring an MQTT client to receive MQTT notifications.
UM3146 Display of LoRa® data Figure 26. Data reformatted from JSON format ® The data sent by the LoRa device is shown in the decoded_payload field (including current, humidity, pressure, temperature, voltage, power, etc.). ® In this demonstration, two ways of displaying data coming from the LoRa device are shown: •...
UM3146 Display of LoRa® data 8.4.2 Display on a smartphone Install the ST25MQTTClient Android application from Google Play (refer to [12]). This application serves as an MQTT client able to receive the MQTT notifications, parse the JSON data, and display certain data in a graph or table. Figure 27.
UM3146 Display of LoRa® data Figure 29. Example MQTT notification display on a smartphone ® For example, the power data displayed in the graph, is sent by the LoRa device every 10 minutes. The user events are sent when the SW2 button of the Nucleo board is pressed. Note: It is necessary to wait for a minimum of 15 seconds between consecutive user events.
This bidirectional interface is also used during the product life to update its firmware. The ST25DV64KC contains a RAM mailbox of 256 bytes allowing the transfer of data both ways. The firmware of the STM32WL is updated this way. The data rate is about 40 seconds to transfer 100 Kbytes.
UM3146 Comparison with existing provisioning solutions Comparison with existing provisioning solutions Table 5. Comparison of provisioning solutions Provisioning Comments method This solution is presented in the current document. The bidirectional capability of the NFC tag is used to provision the device with keys. It is important to highlight that, with this solution, the key provisioning is not done at the factory but at Provisioning with runtime when the user or an installer sets up the product for the first time.
Page 32
UM3146 List of tables List of tables Table 1. References ............... . 2 Table 2.
Page 33
IMPORTANT NOTICE – READ CAREFULLY STMicroelectronics NV and its subsidiaries (“ST”) reserve the right to make changes, corrections, enhancements, modifications, and improvements to ST products and/or to this document at any time without notice. Purchasers should obtain the latest relevant information on ST products before placing orders. ST products are sold pursuant to ST’s terms and conditions of sale in place at the time of order acknowledgment.
Need help?
Do you have a question about the ST25DV64KC and is the answer not in the manual?
Questions and answers