Skip to main content
tsaligopoulos
Associate
April 27, 2017
Solved

SPWF04SC MQTT Connection problem

  • April 27, 2017
  • 2 replies
  • 1093 views
Posted on April 27, 2017 at 21:34

SPWF04SC

MQTT Unable to connect to any MQTT Server

According

http://www.st.com/content/ccc/resource/technical/document/user_manual/group0/69/bf/26/08/53/62/49/af/DM00329655/files/DM00329655.pdf/jcr:content/translations/en.DM00329655.pdf

 

UM2114 User manual

In Section 6.54

AT+S.MQTTCONN=test.mosquitto.org,,,,,,,,,,,

AT-S.ERROR:111:Request failed

+WIND:87:MQTT Closed:0:0

+WIND:87:MQTT Closed:0:0

I have also test other mqtt server broker.hivemq.com

AT+S.MQTTCONN=broker.hivemq.com,,,,,,,,,,,

AT-S.ERROR:111:Request failed

+WIND:87:MQTT Closed:0:0

+WIND:87:MQTT Closed:0:0

The module have internet connection

AT+S.PING=5,,test.mosquitto.org

AT-S.Start:37.187.106.16

AT-S.Reply:56:111

AT-S.Reply:56:111

AT-S.Reply:56:111

AT-S.Reply:56:111

AT-S.Reply:56:112

AT-S.Stop:0:111

AT-S.OK

And i have test successfully the insecure and secure connection with computer software client MQTT.fx on port 1883 on both servers

broker.hivemq.com

test.mosquitto.org

I have test also with ips instead of hostname

35.157.21.220

37.187.106.16

AT+S.MQTTCONN=35.157.21.220,,,,,,,,,,,

AT-S.ERROR:111:Request failed

+WIND:87:MQTT Closed:0:0

+WIND:87:MQTT Closed:0:0

I have also test a full set of options both with dns name and ip

AT+S.MQTTCONN=35.157.21.220,1883,/,0,,,testId,60,15,0,/home/1,test

 

AT-S.ERROR:111:Request failed

+WIND:87:MQTT Closed:0:0

+WIND:87:MQTT Closed:0:0

 

I have also successfully connect with other module esp8266 and esp32  secure with TLS @ port 8883 and insecure

on both servers above.

Would you please provide some help ..

Thanks in advance.

    This topic has been closed for replies.
    Best answer by Gerardo GALLUCCI
    Posted on April 28, 2017 at 11:50

    Hi,

    MQTT client is built on top of websockets. Please check brokers option (if it accepts websocket clients) and port (if not specified, module will use 1883).

    Mosquitto accepts websockets on 8080 (currently down...), Hivemq on 8000 (connection succeeds).

    Example: at+s.mqttconn=broker.hivemq.com,8000,/mqtt,0,,,SPWF04SA,60,15,0,testwilltopic,hello hello my last will

    BR

    j

    2 replies

    Gerardo GALLUCCI
    ST Employee
    April 28, 2017
    Posted on April 28, 2017 at 11:50

    Hi,

    MQTT client is built on top of websockets. Please check brokers option (if it accepts websocket clients) and port (if not specified, module will use 1883).

    Mosquitto accepts websockets on 8080 (currently down...), Hivemq on 8000 (connection succeeds).

    Example: at+s.mqttconn=broker.hivemq.com,8000,/mqtt,0,,,SPWF04SA,60,15,0,testwilltopic,hello hello my last will

    BR

    j

    tsaligopoulos
    Associate
    April 29, 2017
    Posted on April 29, 2017 at 15:02

    Thank you very much for your quick and accurate response.

    spa23
    Associate III
    August 3, 2017
    Posted on August 03, 2017 at 10:32

    Hi

    I have managed to connect to the hivemq.com broker, with the example presented above.

    But I can’t publish a mqtt messages using: AT+S.MQTTPUB=0,panduro,1,1,8<cr>hello world

    AT+S.MQTTPUB=0,panduro,1,1,8

    If I send 8 bytes, I get:

    AT-S.ERROR:111:Request failed

    +WIND:87:MQTT Closed:0:0

    If I only try to send 7 bytes I don’t get any reply, until I send the last byte, and the I get the same error as above.

    I have tried using teraterm and putty for testing.

    Hope anyone has an input, thanks..