6.1.5.2 Running the Application

  1. 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:
    1. Right click and open the Git Bash in the tools folder
      Figure 6-39. Git Bash
    2. 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.
      Figure 6-40. Running create_initial_setup.sh
    3. Up on successful execution of above command, following three new folders will be created
      Figure 6-41. Setup Folders
  2. Device Certificate
    1. 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).
      Figure 6-42. Unique Device ID
      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.
      Figure 6-43. create_device_certificate.sh
    2. On successful execution of device certificate, a new folder is created inside the ../tools/devcerts folder as illustrated in following figure
      Note: 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
    3. 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
      Figure 6-44. Certificate and Key File
  3. 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 only v2.0.0 Azure Cloud Demo
  4. Cloud Configurations and Demo Verification
    1. 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.
    2. Connect the debugger USB port on the AVR128DB48 Curiosity Nano board to computer using a micro USB cable
    3. Open the project and launch MCC with Melody Content Manager Tool
    4. 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.
    5. Update the Azure Cloud configuration with following details. For more details about the Azure Cloud configuration, See Figure 3-24
      1. 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
        Figure 6-45. User Name
        Figure 6-46. Publish Topic Name
      2. 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
        Figure 6-47. Device Certificate and Key
    6. Generate the code as illustrated below
      Figure 6-48. Generating the Code
    7. Build and program the code to the hardware using MPLAB X IDE
      Figure 6-49. Programming the Board
    8. Open the Terminal application (for example: Tera Term or PuTTY) on the PC
    9. Connect to the host board COM port and configure the serial settings as follows:
      1. Baud: 115200
      2. Data: 8 Bits
      3. Parity: None
      4. Stop: 1 Bit
      5. Flow Control: None
    10. 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:

    1. Updated Counter value, which is incremented periodically
    2. The SW0 press count from the device
    Figure 6-50. Host App Logs
    Figure 6-51. Cloud App Logs
  • Cloud - Device Telemetry:

    The Azure IoT Explorer is used to publish any custom message to verify cloud-to-device telemetry
    Figure 6-52. Cloud App Logs
    Figure 6-53. Host App Logs