This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

RTOS/SIMPLELINK-CC3220-SDK: mqtt not working for cc3220 communication via the Azure IoT Hub client SDK in C

Part Number: SIMPLELINK-CC3220-SDK

Tool/software: TI-RTOS

Hi Sir,

I'm trying to connect my CC3220 to the azure cloud using the “iothub_client_sample_mqtt” example in the azure_cc32xx_2_20_00_05 SDK.

 

SDK versions are

1)       Code Composer Studio 9.0.0

2)       simplelink_cc32xx_sdk_3_10_00_04

3)       azure_cc32xx_2_20_00_05

 

The callback function of “ReceiveMessageCallback” is not invoked when the example is executed. The messages are not transmitted to the azure cloud. The console shows the following message.

 

[Cortex_M4_0] Starting the iohub_client_sample_mqtt example

Starting the iohub_client_sample_mqtt example

Current time: Sun May 19 05:57:20 2019

 

CC32XX has connected to AP and acquired an IP address.

IP Address: 172.20.10.2

IoTHubClient_LL_SetMessageCallback...successful.

IoTHubClient_LL_SendEventAsync accepted message [0] for transmission to IoT Hub.

IoTHubClient_LL_SendEventAsync accepted message [1] for transmission to IoT Hub.

IoTHubClient_LL_SendEventAsync accepted message [2] for transmission to IoT Hub.

IoTHubClient_LL_SendEventAsync accepted message [3] for transmission to IoT Hub.

IoTHubClient_LL_SendEventAsync accepted message [4] for transmission to IoT Hub.

 

However, I only modify the program at line 135 as follow.

 

      //if ((iotHubClientHandle = IoTHubClient_LL_CreateFromConnectionString(connectionString, MQTT_Protocol)) == NULL)

        if ((iotHubClientHandle = IoTHubClient_LL_CreateFromConnectionString(connectionString, HTTP_Protocol)) == NULL)

 

The messages can be transmitted to the azure cloud using HTTP protocol.

 

The console messages show

 

[Cortex_M4_0] Starting the iohub_client_sample_mqtt example

Current time: Sun May 19 05:55:03 2019

 

CC32XX has connected to AP and acquired an IP address.

IP Address: 172.20.10.2

IoTHubClient_LL_SetMessageCallback...successful.

IoTHubClient_LL_SendEventAsync accepted message [0] for transmission to IoT Hub.

Confirmation[0] received for message tracking id = 0 with result = IOTHUB_CLIENT_CONFIRMATION_OK

IoTHubClient_LL_SendEventAsync accepted message [1] for transmission to IoT Hub.

Confirmation[1] received for message tracking id = 1 with result = IOTHUB_CLIENT_CONFIRMATION_OK

IoTHubClient_LL_SendEventAsync accepted message [2] for transmission to IoT Hub.

Confirmation[2] received for message tracking id = 2 with result = IOTHUB_CLIENT_CONFIRMATION_OK

IoTHubClient_LL_SendEventAsync accepted message [3] for transmission to IoT Hub.

Confirmation[3] received for message tracking id = 3 with result = IOTHUB_CLIENT_CONFIRMATION_OK

IoTHubClient_LL_SendEventAsync accepted message [4] for transmission to IoT Hub.

Confirmation[4] received for message tracking id = 4 with result = IOTHUB_CLIENT_CONFIRMATION_OK

 

Has the adapter layer for the CC3220 only been certified for HTTP communication via the Azure IoT Hub client SDK in C?

  • Hi,

    Could you please let me know which 3220 device you are using? (is it the CC3220S or CC3220SF)

    Also, what is your network topology like? Are you behind a firewall? Is there a proxy server in between your network and the WAN?

    Finally, are you able to see your device's connection log in the Azure IoT Hub website? Does it show that your device is connecting to the hub when you are attempting to run the example (using MQTT)?

    Steve

  • Hi Steve,
    I use TI's CC3220SF-LAUNCHXL development kit to connect Azure IoT.
    The CC3220SF in station mode connects to a WiFi access point on my iPhone.

    A) The following message shows connection log using MQTT in cmd shell.

    C:\Users\aetsl>iotc-explorer login "SharedAccessSignature sr=b32c3ed0-6188-42b3-89ec-ad9187f92a7c&sig=7qsNm9I1j%2F8ED12Jao6ivwOf4g%2BsuYn79bb5tdcUCoQ%3D&skn=cc3220sf&se=1590281424585"
    Login successful. Session expires Sun May 24 2020 08:50:24 GMT+0800 (GMT+08:00)

    C:\Users\aetsl>iotc-explorer monitor-messages
    Monitoring messages from all devices...

    << No response ……..>>

    B) The following message shows connection log using HTTP in cmd shell.

    C:\Users\aetsl>iotc-explorer login "SharedAccessSignature sr=b32c3ed0-6188-42b3-89ec-ad9187f92a7c&sig=7qsNm9I1j%2F8ED12Jao6ivwOf4g%2BsuYn79bb5tdcUCoQ%3D&skn=cc3220sf&se=1590281424585"
    Login successful. Session expires Sun May 24 2020 08:50:24 GMT+0800 (GMT+08:00)

    C:\Users\aetsl>iotc-explorer monitor-messages
    Monitoring messages from all devices...

    =================================== Device cc3220sf at Fri, 24 May 2019 09:06:07 GMT ==================================
    {
    deviceId: "myFirstDevice",
    windSpeed: 13,
    temperature: 22,
    humidity: 76
    }

    =================================== Device cc3220sf at Fri, 24 May 2019 09:06:08 GMT ==================================
    {
    deviceId: "myFirstDevice",
    windSpeed: 13,
    temperature: 28,
    humidity: 60
    }

    =================================== Device cc3220sf at Fri, 24 May 2019 09:06:08 GMT ==================================
    {
    deviceId: "myFirstDevice",
    windSpeed: 12,
    temperature: 23,
    humidity: 72
    }

    =================================== Device cc3220sf at Fri, 24 May 2019 09:06:09 GMT ==================================
    {
    deviceId: "myFirstDevice",
    windSpeed: 13,
    temperature: 22,
    humidity: 63
    }

    =================================== Device cc3220sf at Fri, 24 May 2019 09:06:09 GMT ==================================
    {
    deviceId: "myFirstDevice",
    windSpeed: 12,
    temperature: 25,
    humidity: 63
    }

    Sincerely,
    S. L. Jeng
  • Thanks for getting back to me on that info, these are important details.

    Steven Connell said:
    Finally, are you able to see your device's connection log in the Azure IoT Hub website? Does it show that your device is connecting to the hub when you are attempting to run the example (using MQTT)?

    But, I didn't see any response to the above, which is an important detail because if you see that the device actually connected to the cloud server, it lets me know that it got past the secure connection phase.

    Can you please check the Azure website's connection log for your device and see if it shows that you connected?

    Steve

  • I am sorry that I don’t know how to obtain connectivity logs of IoT Hub from Azure web. The telemetry messages that send from CC3220SF (using HTTP protocol) and reach to IoT hub can be verified by Metrics function of IoT Hub .

    When I execute IoTHubClient_LL_CreateFromConnectionString call to create a IoT Hub client for communication with my IoT Hub, the return value is a non-NULL IOTHUB_CLIENT_LL_HANDLE. It indicates the CC3220SF has connected to the Azure IoT Hub.

    I use IoTHubClient_LL_SendEventAsync call to send the telemetry message. But the callback is not fired to confirm the message has been successfully sent or fail to be sent.

    I try to use IoTHubClient_LL_GetSendStatus call and get current sending status for IoTHubClient. The sending state always returns IOTHUBCLIENT_SENDSTATUS_BUSY. The telemetry messages fail to send.

    Looking forward to your kind assistances. Thanks.

    S. L. Jeng
  • Hi S.L.,

    I was able to reproduce the issue you're seeing, as well as get it resolved.

    I found that the issue was due to an out of date service pack version on my CC3220 board. Can you try updating your service pack to the latest?

    Let's start by checking which service pack you have on your device:

    1. Open the Uniflash tool (If you don't have it, you need to Download TI Uniflash and install it)

    2. Connect to your CC3220SF board

    3. Click on the "Service Pack" link, under "Files" on the left hand side. You should see the current version of the service pack. Here's what it looked like for me:

    4. Assuming you see an older service pack version, click Browse and navigate to the location of the current version. It should be included with your SDK, e.g. on my PC it's here:

    C:\ti\simplelink_cc32xx_sdk_3_10_00_04\tools\cc32xx_tools\servicepack-cc3x20

    5. Click the "generate image" button (seen on the bottom right of the screen shot)

    6. After the update completes, power cycle your board and then try to reload/rerun the example

    Hopefully this fixes your issue, as it did for me.

    Steve

  • Hi, Steve
    The problem has been fixed. Thanks for your help.

    Sincerely,
    S. L. Jeng