6.2.8.2 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.
        • (Optional) The subscribe and publish topics are same, therefore the user can see the received messages on the terminal. The users can subscribe and publish to another topic of their choice and exchange message. Change Publish topic name in SYS_RNWF_MQTT_TOPIC_NAME in configuration.h.
        • (Optional) In app.c, the user can add subscribe topic name of their choice in g_subscribeList.
    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. Publish Topic Name (Optional)
        2. Sub Topic Name (Optional)
  4. Save the changes and then build and program the project.
    Figure 6-65. Make and Program Device Main Project
  5. Open the Terminal application (for example, Tera Term or PuTTY) on the PC.
  6. Connect to the host board’s 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
  7. Press the SW0 (Soft Reset) button on the host board.
  8. The board boots up and lists certificates available on the board. After successfully connecting with Wi-Fi, it connects to test.mosquitto.org on port 1883 (unencrypted).
  9. To demonstrate successful MQTT connection, the board subscribes to topic mchp/sample/b and publishes a message on the same topic. The received message is printed in the terminal.
    Figure 6-66. Basic Cloud Demo Logs
  10. If the user wants to change the Subscribe topic and Publish topic, make changes in the configuration, build the program, and run it again. Make a note of the Publish Topic Name and Subscribe Topic Name.
  11. Open a MQTT Client software tool (for example, MQTT.fx).
  12. Enter Subscribe topic in the tool at which the user wants to publish the message from the device. When the RNWF11 device connects to test.mosquitto.org it will publish message to the entered Publish Topic Name and the user can receive and see the messages in MQTT Client Software tool.
    Figure 6-67. Subscribe Window in MQTT Client Software
    Figure 6-68. Subscribe Topic Name in MQTT Client Software
    Figure 6-69. Message Received on Subscribed Topic
  13. Follow a similar method to receive messages on the user’s preferred Subscribe Topic Name.
    Figure 6-70. Sending Message from MQTT Client Software to the Device
    Figure 6-71. Message Received on the Device