Any idea what could cause this error (ArduinoIoTCloudTCP::handle_ConnectMqttBroker could not connect to iot.arduino.cc:8883 Error: -2) on my MKR NB 1500? I looked at the 2 other instances that the forum had and neither solution worked for me. It only appears sometimes and stops the device from connecting to the cloud. The modem has been updated to the newest firmware by Arduino Support so I do not think that is the issue.
I have managed to fix the issue. For some reason, the arduino cloud code periodically changes the Thing ID so that it no longer matches the Thing ID given in the devices tab. This causes that error to occur and for the Arduino to no longer be seen online. If I completely delete the device and add it through the setup, it works again. Tedious work around but it works! Don't know the root of the issue though.
Hi @saroth2 thanks for the update. That is really strange. Just to make sure are you talking about the thing-id or the device-id ? I want to investigate a bit deeper this strange condition, but the thing-id is not involved at all during the client connection only the device-id is used.
Sorry you're correct it is the device ID! I was able to reproduce the error and it did say device ID in the serial monitor. It seems to spontaneously change the device ID in the sketch if I put the Arduino to sleep using LowPower.sleep. Then, even if I remove the sleep, any future sketches will pop up the Error -2. I have to then completely reconfigure the MKR NB 1500.
Thank you! This fix worked for me as well.
Got the Error -2 and anything else didn't work.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.