Can't connect via MQTT to mosquitto broker
答复
19-8-16 下午6:36

Hallo,

I tried to connect XDK via MQTT to mosquitto broker.

Because the default port of mosquitto is 1883 and I use my laptop, the setting is as showed in picture belowed.

"10.0.0.1" is my local IP address of my laptop.

I have also checked the firewall for port 1883 and opened it.

There are the only parts that I have changed.

And it didn't work.

 

The error message is as following:

 INFO | XDK DEVICE 1: This is a CC3100R device
 INFO | XDK DEVICE 1: CHIP 0x4000000
 INFO | XDK DEVICE 1: MAC 31.1.2.0.2
 INFO | XDK DEVICE 1: PHY 1.0.3.23
 INFO | XDK DEVICE 1: NWP 2.2.0.1
 INFO | XDK DEVICE 1: ROM 0x3333
 INFO | XDK DEVICE 1: HOST 1.0.1.11
 INFO | XDK DEVICE 1: Connected to WPA network successfully
 INFO | XDK DEVICE 1: IP address of device  10.0.0.4
 INFO | XDK DEVICE 1:               Mask    255.255.255.0
 INFO | XDK DEVICE 1:               Gateway 10.0.0.1
 INFO | XDK DEVICE 1:               DNS     10.0.0.1
 INFO | XDK DEVICE 1: WLANPersonalWPA2Connect : Connected to WPA network successfully. 
 INFO | XDK DEVICE 1: AppControllerFire : MQTT connection to the broker failed 
 INFO | XDK DEVICE 1: Error in WLAN package.
 INFO | XDK DEVICE 1: 	Package ID: 10
 INFO | XDK DEVICE 1: 	Module ID: 3
 INFO | XDK DEVICE 1: 	Severity code: 2
 INFO | XDK DEVICE 1: 	Error code: 1

 

I searched for the error code content, but don't quite understand the previous post related to it.

Can you please give me some advices?

Thank you~

 

 

0 (0 票)
RE: Can't connect via MQTT to mosquitto broker
答复
19-8-19 上午7:53 回复Ruby Shih。

Hi Ruby,

This error code leads to the file "BCDS_WlanNetworkConfig.h". There you will then see, depending on which function you have executed in your code, under #RETCODE_FAILURE what caused the error.

regards

Saeid

0 (0 票)
RE: Can't connect via MQTT to mosquitto broker
答复
19-8-21 下午2:48 回复Saeid Kajlar。

Dear Saeid,

Thank you for your answer.

Most of the functions in the BCDS_WLANNETWORKCONFIG.h are about IP getting.

But in the error message of my XDK, it says that it already got IP and successfully connected to WLAN.

 

So I still can't figure out the reason why I can't connect. 

I use the example code from XDK of MQTT, and only change the SSID, psw of WLAN, APP_MQTT_BROKER_HOST_URL and the port of it.

Because I saw some people also connect to the public MQTT server of mosquitto, 

I also tried to set up like 

#define APP_MQTT_BROKER_HOST_URL               "mqtt://test.mosquitto.org"

 

However, the error message is the same.

Did I do something wrong or there are other settings I should also change?

 

Ruby

 

0 (0 票)