6.2.7.4 Running the Application

  1. Mount the RNWF11 Add On Board on SAME54 Xplained Pro Evaluation Kit at respective header. For more details about the boards placement, refer Figure 6-37.
  2. Connect the debugger USB port on the SAME54 Xplained Pro evaluation kit to computer using a micro USB cable
  3. Change the configuration. There are two options to change the configuration:
    1. Option 1: Change the configuration manually in the code
      1. Open the code in MPLAB IDE v6.00 or higher and add Home AP and device information in the application code.
        • In configuration.h, add Wi-Fi configurations in SYS_RNWF_WIFI_STA_SSID, SYS_RNWF_WIFI_STA_PWD, SYS_RNWF_STA_SECURITY.
        • In configuration.h, add Serial Number (Common Name) in the macro SYS_RNWF_MQTT_CLIENT_ID. This value is the same we can get as shown in Figure for “Device ID”. The device ID will be listed as shown in the following figure.
          Figure 6-60. Azure Device List In IoT Hub
        • In configuration.h, add IoT hub’s URL in the macro SYS_RNWF_MQTT_CLOUD_URL (see the following figure).
          Figure 6-61. Azure Iot Hub Page Overview
        • In configuration.h, add username in format iothub broker url}/{registration_id}/?api-version=2021-04-12 to macro SYS_RNWF_MQTT_CLOUD_USER_NAME. Replace {iothub broker url} with URL of your IOT hub and {registration_id} with Serial Number (Common Name).
        • Similarly, in configuration.h, SYS_RNWF_MQTT_TOPIC_NAME is in format devices/{registration_id}/messages/events/. Replace {registration_id} with Serial number (Common Name).
    2. Option 2: Change the configuration via MCC.
      • For more details about Wi-Fi configurations, refer Figure 3-31.
        1. The following fields can be configured via MCC Wi-Fi settings;
          1. SSID
          2. Security Type
          3. Passphrase
      • Refer Figure 3-37 to understand how to make Cloud Configuration changes
        1. The following fields can be configured via MCC settings.
          • Cloud URL
            1. Replace with IOT hub’s URL.

              This value is displayed on the “Overview” tab of the IoT Hub webpage. Refer Figure 6-61.

          • Client ID
            1. Add Serial Number (Common Name). Refer Figure .

              (Or)

              Go to “Devices” in the IoT Hub. The user can find the Serial Number in the device list. Refer Figure 6-60.

          • Username
            1. The format of username field is {iothub broker url}/{registration_id}/?api-version=2021-04-12. Replace {iothub broker url} with IoT hub’s URL and {registration_id} with Serial Number (Common Name).
          • Publish Topic Name
            1. The format of publish topic name is devices/{registration_id}/messages/event. Replace {registration_id} with the user’s Client ID.
  4. Save the changes and then build and program the project.
    Figure 6-62. Make and Program Device Main Project
  5. Connect to the “USB to UART” 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
  6. The board boots up and the application starts running. It prints Wi-Fi information, certificates on the board, Serial number of the device, connects to Home-AP and then to Azure IoT hub. It sends telemetry data for button press events and its count, parameters (IP address value, LED on/off, etc.) and commands.
    Figure 6-63. Device Interface Debug Log
    Figure 6-64. Device Interface Debug Log with Telemetry Data