[M467 | M487] Connect to Azure IoT using Connection String on NuMaker board and Mbed OS

, Mar 22, 2024|
0
12766
0
[For further inquiries, please e-mail to shchen2@nuvoton.com]
[Visit https://www.nuvoton.com/iot_startup for more IoT solutions]


We have ported an example of connecting NuMaker development boards to Azure IoT services using Mbed OS. The example can be found at https://github.com/OpenNuvoton/NuMaker-mbed-Azure-IoT-CSDK-DPS-example.

This example utilizes Azure DPS (Device Provisioning Service) authentication for device deployment. While it is possible to obtain various parameters following the Azure documentation step by step, it can be somewhat cumbersome. Azure IoT also offers another method using a connection string. By configuring a connection string, it is also possible to connect to Azure IoT.

The example mentioned above defaults to using DPS but also supports the connection string method with a slight modification as outlined below.

Simply modify the mbed_app.json file:
  • Change the value of use_dps to null.
  • Remove two macros: "USE_PROV_MODULE" and "HSM_AUTH_TYPE_CUSTOM"
  • Place your Connection String to value of iothub_connection_string

"use_dps": {
    "help": "Enable connecting with IoT Hub via DPS",
    "options": [null, true],
    "value": null,
    "macro_name": "USE_PROV_MODULE_FULL"
},

"macros": [
],

"iothub_connection_string": {
    "help": "Device connection string for IoT Hub authentication (NO DPS)",
    "value": "\"Place your obtained IOTHUB_CONNECTION_STRING here\""
}
If you are not familiar with the Mbed Studio development environment, please refer to the forum article (http://forum.nuvoton.com/viewtopic.php?f=33&t=11139) for a basic understanding after trying the operation once.