FreeRTOS MQTT not connecting with Mi-Fi router


Hi, I have an IoT device based on the FreeRTOS shadow PIC32 demo. When it's connected to a standard DSL Wi-Fi router it works fine, subscribes to the IoT shadow and everything works OK. However, when I connect to a Mi-Fi 4G router on the sky mobile (O2) network, it fails to connect to MQTT. I have made sure that I can connect on port 8883 to AWS endpoint on the Mi-Fi 4G router using powershell command:

test-netconnection -computer -port 8883

A connection is established OK.

This is the console out when it fails:

33 14822 [IP-task] Socket sending wakeup to MQTT task.

44 24823 [MQTT] About to close socket.
45 25823 [MQTT] Socket closed.
46 25823 [MQTT] Notifying task.
47 25823 [MQTT] Received message 0 from queue.
48 25824 [IoTShadowClient-Init] Command sent to MQTT task failed.
49 25824 [IoTShadowClient-Init] [Shadow 0] MQTT: Connect failed.
50 25824 [IoTShadowClient-Init] AWS shadow client connect unsuccessful, returned 2.
51 25824 [IoTShadowClient-Init] Failed to connect shadow client.`

I have debugged the code and found that the ***prvSendCommandToMQTTTask ***function returns 'eMQTTCouldNotBeSent' in the receive message identifier.

I have checked all the router settings, firewall is currently off. I have ensured that port 8883 is open. I am using a TP-Link router MR6400 using Sky Mobile (O2). It's worth noting that I have also tried on a Hauwei router also with the same result.

Any ideas welcome.


asked 2 years ago311 views
2 Answers

I would test the connection with an MQTT client (AWS IoT SDK example or a regular MQTT client like mosquitto) on a computer connected to the affected router.

answered 2 years ago

Thanks, good call I' will do. But to ask perhaps a dumb question, Is there any reason why it would not work on a mobile network provider?

answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions