6.2.7.4 Running the Application
- 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.
- Connect the debugger USB port on the SAME54 Xplained Pro evaluation kit to computer using a micro USB cable
- Change the configuration. There are two
options to change the configuration:
- Option 1: Change the configuration
manually in the code
- 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 inSYS_RNWF_WIFI_STA_SSID
,SYS_RNWF_WIFI_STA_PWD
,SYS_RNWF_STA_SECURITY
. - In
configuration.h
, add Serial Number (Common Name) in the macroSYS_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. - In
configuration.h
, add IoT hub’s URL in the macroSYS_RNWF_MQTT_CLOUD_URL
(see the following figure). - In
configuration.h
, add username in formatiothub broker url}/{registration_id}/?api-version=2021-04-12
to macroSYS_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 formatdevices/{registration_id}/messages/events/
. Replace{registration_id}
with Serial number (Common Name).
- In
- Open the code in MPLAB IDE v6.00 or
higher and add Home AP and device information in the application code.
- Option 2: Change the configuration via MCC.
- For more details about Wi-Fi
configurations, refer Figure 3-31.
- The following fields can be
configured via MCC Wi-Fi settings;
- SSID
- Security Type
- Passphrase
- The following fields can be
configured via MCC Wi-Fi settings;
- Refer Figure 3-37 to understand how to make Cloud Configuration changes
- The following fields can be
configured via MCC settings.
- Cloud URL
- Replace with IOT hub’s
URL.
This value is displayed on the “Overview” tab of the IoT Hub webpage. Refer Figure 6-61.
- Replace with IOT hub’s
URL.
- Client ID
- 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.
- Add Serial Number
(Common Name). Refer Figure .
- Username
- 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).
- The format of username
field is
- Publish Topic Name
- The format of publish
topic name is
devices/{registration_id}/messages/event
. Replace{registration_id}
with the user’s Client ID.
- The format of publish
topic name is
- Cloud URL
- The following fields can be
configured via MCC settings.
- For more details about Wi-Fi
configurations, refer Figure 3-31.
- Option 1: Change the configuration
manually in the code
- Save the changes and then build and program the project.
- Connect to the “USB to UART” COM port and
configure the serial settings as follows:
- Baud – 115200
- Data – 8 Bits
- Parity – None
- Stop – 1 Bit
- Flow Control – None
- 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.