eclipse-threadx / netxduo

Eclipse ThreadX - NetXDuo is an advanced, industrial-grade TCP/IP network stack designed specifically for deeply embedded real-time and IoT applications
https://github.com/eclipse-threadx/rtos-docs/blob/main/rtos-docs/netx-duo/index.md
MIT License
230 stars 131 forks source link

Deployment in Device Update for IoT Hub is Failed with NETX DUO 6.4.1 #259

Closed chenhui-zhao closed 3 months ago

chenhui-zhao commented 3 months ago

I encountered a Device Update failure issue with NETX DUO 6.4.1. I used NXP MCUXpresso SDK on i.MX RT MCU and updated the RTOS version to 6.4.1.

My test environment is: MCU SDK: NXP MCUXpresso SDK 2.5.0 toolchian: Arm GNU Toolchian 12.3.Rel1 20230626 board: MIMXRT1060 EVKC Eclips ThreadX: Version 6.4.1 project: azure_iot_embedded_sdk_adu (boards/evkcmimxrt1060/azure_rtos_examples/azure_iot_embedded_sdk_adu)

When testing the Device Update example project (azure_iot_embedded_sdk_adu), the original project works well. But, after upgrading RTOS to the version 6.4.1, deploying new image failed. I have created a device in IoT hub and uploaded a new binary image and manifest file to Azure IoT hub, and created a new update successfully. When deploying the new update to device in Azure IoT hub, it showed the deployment is undergoing, but the device can not receive the update information and there is no deployment information in the device twin.

In addition, I found the difference of agent information in the device twin. The original one is:

"agent": {
          "compatPropertyNames": "manufacturer,model",
          "deviceProperties":
          {
               "interfaceId": "dtmi:azure:iot:deviceUpdate;1",
               "manufacturer": "NXP",
               "model": "MIMXRT1xxx"
          }
}

The version 6.4.1 is:

"agent": {
          "compatPropertyNames": "manufacturer,model",
          "deviceProperties":
          {
                "aduVer": "AzureRTOS;agent/6.4.1",
                "contractModelId": "dtmi:azure:iot:deviceUpdateContractModel;2",
                "manufacturer": "NXP",
                "model": "MIMXRT1xxx"
           }
}

Could you help me fix the problem?

bo-ms commented 3 months ago

Hi @chenhui-zhao Thanks for asking. ADU agent initial release is 6.2.0. The interfaceId has been updated to contractModelId in 6.2.1 for ADU Service GA.

On ADU service side, both interfaceId and contractModelId are supported, user need to make sure that the sample uses the corresponding mode id with the source file, for example: using contractModelId for “dtmi:azure:iot:deviceUpdateModel;2” in 6.2.1 and later (refer to the sample and dtdl file thermostat-4.json), and using interfaceId for “dtmi:azure:iot:deviceUpdateModel;1” in 6.2.0 (check the sample and dtdl fle thermostat-3.json).

contractModelId as 'dtmi:azure:iot:deviceUpdateContractModel;2'
interfaceId as 'dtmi:azure:iot:deviceUpdateContractModel;1'

In your case, using 6.4.1, you only need to update the correct pnp model id (contractModelId for 'dtmi:azure:iot:deviceUpdateContractModel;2') in the sample, refer to this sample.

FYI: same GitHub issue here: [ADU not functional after removing 'interfaceId' device properties · Issue #208

chenhui-zhao commented 3 months ago

Hi @bo-ms Thank you for the quick support. I have resolved it by the following steps:

  1. Change the PNP model ID to
    #define SAMPLE_PNP_MODEL_ID           "dtmi:com:example:Thermostat;4"
  2. Change deviceManufacturer and deviceModel to manufacturer and model in the update manifest file as below:
    "compatibility": [ 
      {   
        "manufacturer": "NXP",
        "model": "MIMXRT1xxx"
      }
bo-ms commented 3 months ago

Hi @chenhui-zhao Good to know you resolved the issue.