Cannot ping Boron

Hello I cannot ping my Boron but I cannot put my finger on the problem. After my software boots I can ping my device for a couple of minutes. Then suddenly it stops being able to ping. The weird thing is that my watchdog handler is never being called which means that particle connected is always being returned true.

I use my Boron in manual mode and my main loop looks as follows:

void loop()
{
  currentTime = millis();
  DeviceNameHelperEEPROM::instance().loop();

  if (waitFor(Particle.connected, MAX_PARTICLE_TIMEOUT))
  {

    if (currentTime - lastUpdatePMTime >= UPDATE_INTERVAL)
    {
      lastUpdatePMTime = currentTime;
      updateIAQData(); // Update sensordata statistics each time UPDATE_INTERVAL has passed
      if (isPMinitialized)
      {
        checkEnvironment();
      }
    }

    // Send out data each time the send interval has passed. 
    // Interval muliplies by the amount of connection failures to reduce data consumption
    if (currentTime - lastMeasurementTime >= (sendDataInterval * (mqtt_connect_failure_count + 1)))
    {
      if(mqttClient.isConnected())
      {
        sendIAQData();
        checkSensors();
        mqttClient.loop();
      } else {
        connectMQTT();
      }
      lastMeasurementTime = currentTime;
    }
  }
  else
  {
    watchdogHandler();
  }
  uint32_t timeSpend = millis() - currentTime;
  particleProcessCount++;
  if (timeSpend > 2) {
    Log.info("loop-time=%lu, \tprocess count=%i", timeSpend, particleProcessCount);
    particleProcessCount = 0;
  }

  Particle.process();
}

The logging output is as follows:

0000880958 [app] INFO: loop-time=408,   process count=4156
0000881813 [app] INFO: loop-time=263,   process count=3312
0000882958 [app] INFO: loop-time=408,   process count=4129
0000883808 [app] INFO: loop-time=258,   process count=3317
0000884963 [app] INFO: loop-time=413,   process count=4162
0000885808 [app] INFO: loop-time=258,   process count=3291
0000886958 [app] INFO: loop-time=408,   process count=4156
0000887813 [app] INFO: loop-time=263,   process count=3319
0000888958 [app] INFO: loop-time=408,   process count=4131
0000889809 [app] INFO: loop-time=258,   process count=3315
0000890964 [app] INFO: loop-time=413,   process count=4157
0000891809 [app] INFO: loop-time=258,   process count=3288
0000892959 [app] INFO: loop-time=408,   process count=4152

FYI loop time means blocking time of my own methods before particle process is being called. Process count is the amount of counts of particle process being called before a blocking method is used again.

After some time running my app returns the following in the Log

0001467871 [app] INFO: loop-time=263,   process count=3316
0001469016 [app] INFO: loop-time=408,   process count=4128
0001469866 [app] INFO: loop-time=258,   process count=3311
0001471021 [app] INFO: loop-time=413,   process count=4157
0001471868 [app] INFO: loop-time=259,   process count=3278
0001473017 [app] INFO: loop-time=408,   process count=4150
0001473017 [comm.protocol] ERROR: Event loop error 1
0001473018 [system] WARN: Communication loop error, closing cloud socket
0001473699 [app] INFO: loop-time=437,   process count=1
0001473963 [app] INFO: loop-time=263,   process count=1
0001475108 [app] INFO: loop-time=408,   process count=4131
0001475958 [app] INFO: loop-time=258,   process count=3316
0001477113 [app] INFO: loop-time=413,   process count=4154

Even after this error the watchdog is not being called. (device is not rebooting)

void watchdogHandler()
{
  Log.error("watchdog triggered!");
  delay(1s);
  System.reset();
}

I found the problem. I need to set the Particle.keepAlive() to a lower value! As i’m using a third party sim.

in my case i used Particle.keepAlive(30), which worked like a charm.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.