Skip to content

Commit dcc3d43

Browse files
Merge pull request #222954 from timlt/az-update
Update az quickstart
2 parents 22f6183 + 7507576 commit dcc3d43

File tree

1 file changed

+53
-42
lines changed

1 file changed

+53
-42
lines changed

articles/iot-develop/quickstart-devkit-mxchip-az3166-iot-hub.md

Lines changed: 53 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ ms.author: timlt
66
ms.service: iot-develop
77
ms.devlang: c
88
ms.topic: quickstart
9-
ms.date: 10/21/2022
9+
ms.date: 01/04/2023
1010
ms.custom: mode-other, engagement-fy23, devx-track-azurecli
1111
---
1212

13-
# Connect an MXCHIP AZ3166 devkit to IoT Hub
13+
# Quickstart: Connect an MXCHIP AZ3166 devkit to IoT Hub
1414

1515
**Applies to**: [Embedded device development](about-iot-develop.md#embedded-device-development)<br>
1616
**Total completion time**: 30 minutes
@@ -30,9 +30,9 @@ You'll complete the following tasks:
3030

3131
## Prerequisites
3232

33-
* A PC running Windows 10
34-
* If you don't have an Azure subscription, [create one for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F) before you begin.
33+
* A PC running Windows 10 or Windows 11
3534
* [Git](https://git-scm.com/downloads) for cloning the repository
35+
* If you don't have an Azure subscription, [create one for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F) before you begin.
3636
* Azure CLI. You have two options for running Azure CLI commands in this quickstart:
3737
* Use the Azure Cloud Shell, an interactive shell that runs CLI commands in your browser. This option is recommended because you don't need to install anything. If you're using Cloud Shell for the first time, sign in to the [Azure portal](https://portal.azure.com). Follow the steps in [Cloud Shell quickstart](../cloud-shell/quickstart.md) to **Start Cloud Shell** and **Select the Bash environment**.
3838
* Optionally, run Azure CLI on your local machine. If Azure CLI is already installed, run `az upgrade` to upgrade the CLI and extensions to the current version. To install Azure CLI, see [Install Azure CLI](/cli/azure/install-azure-cli).
@@ -111,7 +111,7 @@ To create an IoT hub:
111111
112112
1. Run the [az iot hub create](/cli/azure/iot/hub#az-iot-hub-create) command to create an IoT hub. It might take a few minutes to create an IoT hub.
113113
114-
*YourIotHubName*. Replace this placeholder below with the name you chose for your IoT hub. An IoT hub name must be globally unique in Azure. This placeholder is used in the rest of this quickstart to represent your unique IoT hub name.
114+
*YourIotHubName*. Replace this placeholder in the code with the name you chose for your IoT hub. An IoT hub name must be globally unique in Azure. This placeholder is used in the rest of this quickstart to represent your unique IoT hub name.
115115
116116
The `--sku F1` parameter creates the IoT hub in the Free tier. Free tier hubs have a limited feature set and are used for proof of concept applications. For more information on IoT Hub tiers, features, and pricing, see [Azure IoT Hub pricing](https://azure.microsoft.com/pricing/details/iot-hub).
117117
@@ -125,7 +125,7 @@ To create an IoT hub:
125125
126126
### Configure IoT Explorer
127127
128-
In the rest of this quickstart, you'll use IoT Explorer to register a device to your IoT hub, to view the device properties and telemetry, and to send commands to your device. In this section, you configure IoT Explorer to connect to the IoT hub you just created and to read plug and play models from the public model repository.
128+
In the rest of this quickstart, you'll use IoT Explorer to register a device to your IoT hub, to view the device properties and telemetry, and to send commands to your device. In this section, you configure IoT Explorer to connect to your IoT hub and to read plug and play models from the public model repository.
129129

130130
To add a connection to your IoT hub:
131131

@@ -203,9 +203,9 @@ To connect the MXCHIP DevKit to Azure, you'll modify a configuration file for Wi
203203
204204
|Constant name|Value|
205205
|-------------|-----|
206-
|`IOT_HUB_HOSTNAME` |{*Your Iot hub hostName value*}|
207-
|`IOT_HUB_DEVICE_ID` |{*Your Device ID value*}|
208-
|`IOT_DEVICE_SAS_KEY` |{*Your Primary key value*}|
206+
| `IOT_HUB_HOSTNAME` | {*Your host name value*} |
207+
| `IOT_HUB_DEVICE_ID` | {*Your Device ID value*} |
208+
| `IOT_DEVICE_SAS_KEY` | {*Your Primary key value*} |
209209
210210
1. Save and close the file.
211211
@@ -254,41 +254,55 @@ You can use the **Termite** app to monitor communication and confirm that your d
254254
255255
```output
256256
Starting Azure thread
257-
257+
258+
258259
Initializing WiFi
259-
MAC address: C8:93:46:8A:4C:43
260-
Connecting to SSID 'iot'
261-
SUCCESS: WiFi connected to iot
262-
260+
MAC address: ******************
261+
SUCCESS: WiFi initialized
262+
263+
Connecting WiFi
264+
Connecting to SSID 'iot'
265+
Attempt 1...
266+
SUCCESS: WiFi connected
267+
263268
Initializing DHCP
264-
IP address: 192.168.0.18
265-
Mask: 255.255.255.0
266-
Gateway: 192.168.0.1
269+
IP address: 192.168.0.49
270+
Mask: 255.255.255.0
271+
Gateway: 192.168.0.1
267272
SUCCESS: DHCP initialized
268-
273+
269274
Initializing DNS client
270-
DNS address: 75.75.75.75
275+
DNS address: 192.168.0.1
271276
SUCCESS: DNS client initialized
272-
273-
Initializing SNTP client
274-
SNTP server 0.pool.ntp.org
275-
SNTP IP address: 157.245.166.169
276-
SNTP time update: Jun 8, 2021 18:16:50.807 UTC
277+
278+
Initializing SNTP time sync
279+
SNTP server 0.pool.ntp.org
280+
SNTP time update: Jan 4, 2023 22:57:32.658 UTC
277281
SUCCESS: SNTP initialized
278-
282+
279283
Initializing Azure IoT Hub client
280-
Hub hostname: ***.azure-devices.net
281-
Device id: mydevice
282-
Model id: dtmi:azurertos:devkit:gsgmxchip;1
283-
Connected to IoT Hub
284-
SUCCESS: Azure IoT Hub client initialized
284+
Hub hostname: ***.azure-devices.net
285+
Device id: mydevice
286+
Model id: dtmi:azurertos:devkit:gsgmxchip;2
287+
SUCCESS: Connected to IoT Hub
288+
289+
Receive properties: {"desired":{"$version":1},"reported":{"deviceInformation":{"__t":"c","manufacturer":"MXCHIP","model":"AZ3166","swVersion":"1.0.0","osName":"Azure RTOS","processorArchitecture":"Arm Cortex M4","processorManufacturer":"STMicroelectronics","totalStorage":1024,"totalMemory":128},"ledState":false,"telemetryInterval":{"ac":200,"av":1,"value":10},"$version":4}}
290+
Sending property: $iothub/twin/PATCH/properties/reported/?$rid=3{"deviceInformation":{"__t":"c","manufacturer":"MXCHIP","model":"AZ3166","swVersion":"1.0.0","osName":"Azure RTOS","processorArchitecture":"Arm Cortex M4","processorManufacturer":"STMicroelectronics","totalStorage":1024,"totalMemory":128}}
291+
Sending property: $iothub/twin/PATCH/properties/reported/?$rid=5{"ledState":false}
292+
Sending property: $iothub/twin/PATCH/properties/reported/?$rid=7{"telemetryInterval":{"ac":200,"av":1,"value":10}}
293+
294+
Starting Main loop
295+
Telemetry message sent: {"humidity":31.01,"temperature":25.62,"pressure":927.3}.
296+
Telemetry message sent: {"magnetometerX":177,"magnetometerY":-36,"magnetometerZ":-346.5}.
297+
Telemetry message sent: {"accelerometerX":-22.5,"accelerometerY":0.54,"accelerometerZ":1049.01}.
298+
Telemetry message sent: {"gyroscopeX":0,"gyroscopeY":0,"gyroscopeZ":0}.
285299
```
286300
287301
Keep Termite open to monitor device output in the following steps.
288302
289303
## View device properties
290304
291-
You can use Azure IoT Explorer to view and manage the properties of your devices. In this section and the following sections, you'll use the Plug and Play capabilities that surfaced in IoT Explorer to manage and interact with the MXCHIP DevKit. These capabilities rely on the device model published for the MXCHIP DevKit in the public model repository. You configured IoT Explorer to search this repository for device models earlier in this quickstart. In many cases, you can perform the same action without using plug and play by selecting the same action from the left side menu of your device pane in IoT Explorer. However, using plug and play often provides an enhanced experience. This is because IoT Explorer can read the device model specified by a plug and play device and present information specific to that device.
305+
You can use Azure IoT Explorer to view and manage the properties of your devices. In this section and the following sections, you'll use the Plug and Play capabilities that surfaced in IoT Explorer to manage and interact with the MXCHIP DevKit. These capabilities rely on the device model published for the MXCHIP DevKit in the public model repository. You configured IoT Explorer to search this repository for device models earlier in this quickstart. You can perform many actions without using plug and play by selecting the action from the left side menu of your device pane in IoT Explorer. However, using plug and play often provides an enhanced experience. IoT Explorer can read the device model specified by a plug and play device and present information specific to that device.
292306

293307
To access IoT Plug and Play components for the device in IoT Explorer:
294308

@@ -306,14 +320,12 @@ To access IoT Plug and Play components for the device in IoT Explorer:
306320
| Tab | Type | Name | Description |
307321
|---|---|---|---|
308322
| **Interface** | Interface | `MXCHIP Getting Started Guide` | Example model for the MXCHIP DevKit |
309-
| **Properties (read-only)** | Property | -- | The model currently doesn't have any read-only properties |
323+
| **Properties (read-only)** | Property | `ledState` | The current state of the LED |
310324
| **Properties (writable)** | Property | `telemetryInterval` | The interval that the device sends telemetry |
311325
| **Commands** | Command | `setLedState` | Turn the LED on or off |
312-
| **Telemetry** | Telemetry | `temperature` | The temperature in Celsius |
313326

314327
To view device properties using Azure IoT Explorer:
315328

316-
1. Select the **Properties (read-only)** tab. Currently, there aren't any read-only properties exposed by the device model.
317329
1. Select the **Properties (writable)** tab. It displays the interval that telemetry is sent.
318330
1. Change the `telemetryInterval` to *5*, and then select **Update desired value**. Your device now uses this interval to send telemetry.
319331

@@ -324,10 +336,10 @@ To view device properties using Azure IoT Explorer:
324336

325337
To use Azure CLI to view device properties:
326338

327-
1. Run the [az iot hub device-identity show](/cli/azure/iot/hub/device-identity#az-iot-hub-device-identity-show) command.
339+
1. Run the [az iot hub device-twin show](/cli/azure/iot/hub/device-twin#az-iot-hub-device-twin-show) command.
328340

329341
```azurecli
330-
az iot hub device-identity show --device-id mydevice --hub-name {YourIoTHubName}
342+
az iot hub device-twin show --device-id mydevice --hub-name {YourIoTHubName}
331343
```
332344

333345
1. Inspect the properties for your device in the console output.
@@ -436,7 +448,7 @@ If you no longer need the Azure resources created in this quickstart, you can us
436448
437449
To delete a resource group by name:
438450
439-
1. Run the [az group delete](/cli/azure/group#az-group-delete) command. This removes the resource group, the IoT Hub, and the device registration you created.
451+
1. Run the [az group delete](/cli/azure/group#az-group-delete) command. This command removes the resource group, the IoT Hub, and the device registration you created.
440452
441453
```azurecli-interactive
442454
az group delete --name MyResourceGroup
@@ -452,14 +464,13 @@ To delete a resource group by name:
452464
453465
In this quickstart, you built a custom image that contains Azure RTOS sample code, and then flashed the image to the MXCHIP DevKit device. You also used the Azure CLI and/or IoT Explorer to create Azure resources, connect the MXCHIP DevKit securely to Azure, view telemetry, and send messages.
454466
455-
As a next step, explore the following articles to learn more about using the IoT device SDKs to connect devices to Azure IoT.
467+
As a next step, explore the following articles to learn more about using the IoT device SDKs to connect general devices, and embedded devices, to Azure IoT.
456468
457469
> [!div class="nextstepaction"]
458-
> [Connect an MXCHIP AZ3166 devkit to IoT Central](quickstart-devkit-mxchip-az3166.md)
459-
> [!div class="nextstepaction"]
460-
> [Connect a simulated device to IoT Central](quickstart-send-telemetry-central.md)
470+
> [Connect a general simulated device to IoT Hub](quickstart-send-telemetry-iot-hub.md)
471+
461472
> [!div class="nextstepaction"]
462-
> [Connect a simulated device to IoT Hub](quickstart-send-telemetry-iot-hub.md)
473+
> [Learn more about connecting embedded devices using C SDK and Embedded C SDK](concepts-using-c-sdk-and-embedded-c-sdk.md)
463474
464475
> [!IMPORTANT]
465476
> Azure RTOS provides OEMs with components to secure communication and to create code and data isolation using underlying MCU/MPU hardware protection mechanisms. However, each OEM is ultimately responsible for ensuring that their device meets evolving security requirements.

0 commit comments

Comments
 (0)