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.

MQTT Client Demo App for a different server

Other Parts Discussed in Thread: CC3200, CC3100, CC3200SDK, UNIFLASH

Hi,

I have used MQTT Client demo application for dumping ADC data on cloud server messagesight.demos.ibm.com.

But from past 2 days, I am getting network error when I publish the data. But the subscribed data (/cc3200/ToggleLEDCmdL1) comes through fine.

I am getting the below error:

Publish Message Received
Topic: /cc3200/ToggleLEDCmdL1 [Qos: 0]
Data is: /cc3200/ToggleLEDCmdL1
C: Msg w/ ID 0x0000, processing status: Good
C: FH-B1 0xc0 to net 17, Sent (2 Bytes) [@ 55]
C: Rcvd msg Fix-Hdr (Byte1) 0xd0 from net 17 [@ 55]
C: Msg w/ ID 0x0000, processing status: Good
C: FH-B1 0x35 to net 17, Sent (74 Bytes) [@ 59]
C: Net 17, Raw Error -1, Time Out: N
C: RX closing Net 17 [-1]
C: Cleaning session for net 17
C: Net 17 now closed
disconnect from broker messagesight.demos.ibm.com

 CC3200 Publishes the following message
Topic: /cc3200/ButtonPressEvtSw3
Data: Push button sw3 is pressed on CC32XX device

 Exiting the Application

 

Since its a network error it gives, I am trying to do this on a different server. The one I tried is broker.mqttdashboard.com. I got the following error.

Version: Client LIB 1.0.4, Common LIB 1.1.1.
C: FH-B1 0x10 to net 17, Sent (45 Bytes) [@ 4]
C: Net 17, Raw Error -1, Time Out: N
C: RX closing Net 17 [-1]
C: Cleaning session for net 17
C: Net 17 now closed
disconnect from broker broker.mqttdashboard.com

Broker connect fail for conn no. 1

I have tried connecting to this server earlier, but I have failed with a different error (donot have a log of that). But I would like to connect to different server just in case the IBM server doesnot respond.

My question is, Can I connect MQTT Client demo to different servers like the one above? What changes should I do for the same? I have tried changing the  server address, port address, keep alive timer.

Many Thanks,

Soumya

 

  • Hi Soumya,

    Yes, you can change the example to connect to a different server. Check out the documentation for the MQTT in the SDK at cc3200-sdk/docs/netapps/mqtt.

    Additionally, you may want to refer to this thread regarding the issue with the ibm server -

    https://e2e.ti.com/support/wireless_connectivity/simplelink_wifi_cc31xx_cc32xx/f/968/p/534051/1964158#1964158

    Best Regards,

    Ben

  • Hi Ben,

    Thanks for the pointers.

    I am now using broker.mqttdashboard.com as the server on port 1883 and I am able to publish my messages.

    Best Regards,

    Soumya

  • Hi Soumya,

    Could you please explain your procedure , because I'm unable to connect to MQTT broker in both sample examples MQTT-Client and MQTT-Server application. Did you hard code the broker in code or use their broker?

    Techinspired.
  • Hello TechInspired,

    I just tried this to verify.  Here's the procedure, using CC3200SDK_1.3.0 and ServicePack CC3100_CC3200_ServicePack_1.0.1.11-2.9.0.0.

    Hope that helps,

    ~roger

    1. With Uniflash - Format SFLASH
    2. With Uniflash - Program Service Pack
    3. Reset Board
    4. Create new workspace in CCS (or IAR)
    5. Import MQTT client example
    6. Change server from messagesight.demos.ibm.com --> iot.eclipse.org
    7. Change clientId to be unique – e.g. using MAC address : user1 --> user-112233445566
    8. Change subscribe and publish topics to be unique – e.g. using MAC address : cc3200 --> cc3200-112233445566
    9. Change common.h for SSID/password
    10. Build, Connect, Load and Run Application

     

     

                     *************************************************

                        CC3200 MQTT_Client Application

                     *************************************************

    Host Driver Version: 1.0.1.11

    Build Version 2.9.0.0.31.1.4.0.1.1.0.3.37

    Device is configured in default state

    Started SimpleLink Device: STA Mode

    [WLAN EVENT] STA Connected to the AP: XXXXXXXX

    [NETAPP EVENT] IP acquired by the device

     

    Device has connected to XXXXXXXX

    Device IP Address is 192.168.0.101

     

    Version: Client LIB 1.4.0, Common LIB 1.5.0.

     …

     Success: conn to Broker no. 1

     …

     Client subscribed on following topics:

    /cc3200-112233445566/ToggleLEDCmdL1

    /cc3200-112233445566/ToggleLEDCmdL2

    /cc3200-112233445566/ToggleLEDCmdL3

     …

    <PUSH SW2>

      CC3200 Publishes the following message

    Topic: /cc3200-112233445566/ButtonPressEvtSw2

    Data: Push button sw2 is pressed on CC32XX device

    <PUSH SW3>

     CC3200 Publishes the following message

    Topic: /cc3200-112233445566/ButtonPressEvtSw3

    Data: Push button sw3 is pressed on CC32XX device

     

    Using mqtt client to observe traffic :-

     

    $ ./mosquitto_sub -h iot.eclipse.org -p 1883 -t /cc3200-112233445566/#

    Push button sw2 is pressed on CC32XX device  < WHEN SW2 pushed on LP >

    Push button sw3 is pressed on CC32XX device  < WHEN SW3 pushed on LP >

  • Hi Roger,

    Thanks a lot for the information you guided above!

    With your help I was able to successfully run the sample MQTT-Client application. I found the 'verify answer' tab(as I got my answer with your help) to hit for reply but there was only 'Reply' option.

    Now when I run the application,I get messages like this on putty.

    Now I want to connect my CC3200 device to cloud. I tried with AWS but the device hung up at a very last step at 'VERIFY PROTOCOL' in driver.c .

    1) Now can I use these sample examples of MQTT-Client and MQTT-Server to connect to cloud, or do need do different procedure to get connected to cloud?

    2) I'm thinking to use IBM Bluemix but according to this thread https://e2e.ti.com/support/wireless_connectivity/simplelink_wifi_cc31xx_cc32xx/f/968/t/563333 ,just want to know ,is it still broken on IBM server ?

    Best Regards,

    Techinspired

  • Hello Techinspired,

    Glad you got that working - that's good news!

    1) The MQTT_client example is already connecting you to a cloud hosted MQTT broker - you just need to configure it for the broker that matches your requirements. In the example above, we used the Paho MQTT sandbox server at iot.eclipse.org. This is a test broker.

    2) That thread discusses 2 things a) configuring the mqtt example to talk to iot.eclipse.org (as we did above) and b) configuring the mqtt example to talk to IBM Watson IoT. Both of these services should be working fine.

    [ Note : to try to clarify : the original server used in the mqtt_client example was : messagesight.demos.ibm.com. This was a publicly accessible sandbox server for MQTT application testing (which is why it was used in these early examples). This server is now only available for specific ibm provided demos - hence the reason we need to switch this example to use a different test broker. This is not related to IBM Bluemix. ]

    ~roger