Photon offline with solid orange LED

So my firmware runs great for long periods of time, then the logs show some anomalies, then it locks up completely with a solid orange LED. Here the sequence I saw today,,,

|particle/device/updates/forced|false|SPP_000001|3/6/20 at 12:30:50 am|
|particle/device/updates/enabled|true|SPP_000001|3/6/20 at 12:30:50 am|
|spark/status|online|SPP_000001|3/6/20 at 12:30:50 am|

Then it recovers. Then a couple hours later....

|spark/device/diagnostics/update|{"device":{"system":{"uptime":18,"memory":{"total":82944,"used":42984}},"network":{"connection":{"status":4,"error":0,"disconnects":0,"attempts":1,"disconnect":0},"signal":{"rssi":-62,"strength":76,"quality":67.74,"qualityv":30,"at":1,"strengthv":-62}},"cloud":{"connection":{"status":1,"error":0,"attempts":1,"disconnect":0},"disconnects":0,"publish":{"rate_limited":0},"coap":{"unack":0}}},"service":{"device":{"status":"ok"},"coap":{"round_trip":158},"cloud":{"uptime":0,"publish":{"sent":2}}}}|SPP_000001|3/6/20 at 1:58:52 am|
|spark/device/last_reset|power_down|SPP_000001|3/6/20 at 1:58:52 am|
|particle/device/updates/forced|false|SPP_000001|3/6/20 at 1:58:52 am|
|particle/device/updates/enabled|true|SPP_000001|3/6/20 at 1:58:52 am|
|spark/status|online|SPP_000001|3/6/20 at 1:58:52 am|

then it recovers again and goes along fine for 5 hours, then fails again....

|spark/status|offline|SPP_000001|3/6/20 at 7:07:24 am|

... this failure locks up the device with a solid amber LED. The documentation only mentions orange here

While connecting to the Cloud, the RGB LED will be blinking cyan followed by:

1 orange blink: Decryption error.
2 orange blinks: Could not reach the internet.
3 orange blinks: Connected to the internet, but could not reach the Particle Device Cloud. This sometimes is seen as yellow or red and indicates bad server keys.

Then later it says...

In most cases, solid colors are the side effect of a bug. If code crashes or infinitely loops with interrupts disabled, it's possible that the LED animation will stop. The color of the LED is the color it last was before failure.

So how do I go about troubleshooting this? Seems like it could be just about anything.

Bob

The last quote you posted is where I would start. Do you have interrupt service routines or callbacks that could loop? Do you do any non thread safe operations (if using threads) or blocking operations in those? Posting your code would help us help you figure it out.

I do some button checking in ISRs. Here’s that code…

  // Button handling
  pinMode(PIN_BTN1, INPUT_PULLDOWN);
  attachInterrupt (PIN_BTN1, btn1Rising, RISING);  // attach interrupt handler
  pinMode(PIN_BTN2, INPUT_PULLDOWN);
  attachInterrupt (PIN_BTN2, btn2Rising, RISING);  // attach interrupt handler

  // Alarm buzzer
  pinMode(PIN_ALARM, OUTPUT);
  digitalWrite(PIN_ALARM, LOW);
 }

void loop()
{
  detect_event();
  button_check();
  display_data();
}

void infoHandler(const char *topic, const char *data)
{
  // if (String(topic) == "device")
  sprintf(deviceName,"%s",data);
}

// Interrupt Service Routine (ISR)
void btn1Rising()
{
  btn1High = true;
  btn1Count++;
}

void btn2Rising()
{
  btn2High = true;
  btn2Count++;
}

void button_check()
{
  if (btn1High)
 {
    // Make sure the pin stays high
    // If it goes low right away, this was probably noise

    if (btn1Count > 1 || (btn1Count == 1 && (digitalRead (PIN_BTN1) == HIGH)))
    {
      // Real event, so do something real
      dispMode++;

      if (dispMode > DISPMODES
        dispMode = 1;
    }

    noInterrupts();  // Critical Section
    btn1High = false;
    btn1Count = 0;
    interrupts();    // Critical Section
  }

  if (btn2High)
  {
    // Make sure the pin stays high
    // If it goes low right away, this was probably noise

    if (btn2Count > 1 || (btn2Count == 1 && (digitalRead (PIN_BTN2) == HIGH)))
    {
      // Real event, so do something real
      if (alarmEnabled)
        sound_alarm(FALSE);  // turn off audible alarm
      alarmEnabled = !alarmEnabled;
    }

    noInterrupts();  // Critical Section
    btn2High = false;
    btn2Count = 0;
    interrupts();    // Critical Section
  }

}

Is this really your code?
If so, you are missing a closing parenthesis here.

You have also omitted the variable declarations as well as detect_event() and display_data().
Without the entire code I'd not look any further as we might be searching for the lost key near the lamp post where we got light rather than the place were it was lost :wink:

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