6.1.5.2 Running the Application
- Create a Root of Trust Chain for
RNWF Devices:The demo application includes a set of tools in
../apps/azure_cloud/tools
folder. It enables easy creation of certificate infrastructure and individual device certificates with very minimal user inputs.Note:- On Windows Operating Systems, make sure the GitBash is installed to run these tools.
- These scripts are based on the Azure's Create and Upload Certificates for Testing tutorial.
- Right click and open the Git Bash in the tools folder
- Run the create_initial_setup.sh as illustrated in the following figure. It will request the user to provide the domain suffix and common name for Root CA.
- Up on successful execution of above command, following three new folders will be created
- Device Certificate
- Run the
create_device_certificate.sh
to create individual device certificate. It requests the user to provide Subordinate/Intermediate CA folder name and a unique device id (Common Name).Note:- Note down the information of device ID or common name for later use in Azure configuration.
- In order to modify the default subject identifier
information, open the
create_device_certificate.sh
and update the following macros.
- On successful execution of device certificate, a new folder is created
inside the
../tools/devcerts
folder as illustrated in following figureNote: Note down the information of certificate and key file names (by default device ID or common name) for use later in the Azure TLS configuration - Use the PC companion mode of the setup and program the .pem and * .key* files (highlighted/marked below) using file_upload tools. For more details on file_upload tools, refer to the Certificate and Key Utility
- Run the
-
To establish a connection with a Azure IoT Hub without using Azure DPS or configuring Azure IoT Central service, follow Appendix A.1. For Cloud configuration and to execute the Azure Cloud demo follow step 4
Note: This is applicable to onlyv2.0.0
Azure Cloud Demo - Cloud Configurations and Demo Verification
- Mount the AVR128DB48 Curiosity Nano host board and the RNWF02 Add On Board on Curiosity Nano base board at respective headers. For more details about the boards placement in the Curiosity Nano base, see Figure 6-1.
- Connect the debugger USB port on the AVR128DB48 Curiosity Nano board to computer using a micro USB cable
- Open the project and launch MCC with Melody Content Manager Tool
- Configure Home-AP credentials for STA mode, using the Wi-Fi settings configuration. For more details about the Wi-Fi settings configuration, See Figure 3-16.
- Update the Azure Cloud
configuration with following details. For more details about the Azure Cloud
configuration, See Figure 3-24
- Unique Device ID (Common Name) noted in Step 2.a (Device Certificate, see Figure 6-42), update this Unique Device ID in Azure Cloud configuration as illustrated below
- Device Certificate and Key file names noted in Step 2.c (Device Certificate, see Figure 6-44), update this in Azure Cloud configuration as illustrated below
- Generate the code as illustrated below
- Build and program the code to the hardware using MPLAB X IDE
- Open the Terminal application (for example: Tera Term or PuTTY) on the PC
- Connect to the host board COM
port and configure the serial settings as follows:
- Baud: 115200
- Data: 8 Bits
- Parity: None
- Stop: 1 Bit
- Flow Control: None
- Press the SW0 (Soft Reset) button on the host board, see Figure 6-1.
Telemetry Verification for v2.0.0
Application
As the board boots up, application will list available certificates and keys on RNWF02 board. The board connects to configured Home-AP. After this, the demo attempts to connect to Azure IoT Hub (using configured link and without Azure DPS and IoT Central service) and starts sending the telemetry. To verify the device-to-cloud and cloud-to-device telemetry, use Azure IoT Explorer application (https://learn.microsoft.com/en-us/azure/iot/howto-use-iot-explorer) as illustrated below:
-
Device - Cloud Telemetry:
This demo publishes:
- Updated Counter value, which is incremented periodically
- The SW0 press count from the device
-
Cloud - Device Telemetry:
The Azure IoT Explorer is used to publish any custom message to verify cloud-to-device telemetry