i'm working with the Arduino MKR NB 1500 board and this MQTT library. The connection is done via TLS and after some optimizations it is more or less working. But from time to time i receive the -13 return code.
My question: any idea what is really behind this return code and how i could handle it without the WatchDog?
Currently i'm checking the MQTT connecting and try to reconnect but then i run into a deadlog and the WatchDog becomes active. This is something i would like to handle without a complete restart of the Arduino board.
Some code:
// Check for MQTT Connection and try to connect ...
void connectMQTT()
{
MyWatchDoggy.clear();
if (!mqttClient.connected()) {
Serial.println(F("MQTT not connected."));
int count = 0;
// Check for NB-IoT connection.
connectNB();
//
// HERE THE WHOLE EXECUTION STOPS ... WHAT COULD I DO BEFORE?
//
while (!mqttClient.connect(ICCID, MQTT_USER.c_str(), MQTT_PASS.c_str())) {
count++;
Serial.print(F("MQTT try to connect: "));
Serial.println(count);
if (count > mqtt_attempts) {
Serial.println(F("MQTT connect failed. Waiting for watchdog."));
while (1);
}
delay(5000);
}
Hello,
i'm working with the Arduino MKR NB 1500 board and this MQTT library. The connection is done via TLS and after some optimizations it is more or less working. But from time to time i receive the -13 return code.
My question: any idea what is really behind this return code and how i could handle it without the WatchDog?
Currently i'm checking the MQTT connecting and try to reconnect but then i run into a deadlog and the WatchDog becomes active. This is something i would like to handle without a complete restart of the Arduino board.
Some code: