Photon with solid cyan

I recently replaced a Boron with a Photon (after implementing a WiFi extender from a building a few hundred feet away). I added an external antenna to the Photon to achieve (successfully) maximum signal level. My application ran perfectly for many hours (see attached screenshot)
but then went off line. The cyan LED is now on steady, i.e. no “breathing”. Removing and restoring power, i.e. re-booting, results in about 3 “breaths” and then the LED goes back to steady.

The official Photon documentation 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 for example, it could be solid cyan if it was previously breathing cyan, or solid red if it was trying to output an SOS pattern.”

Can anyone offer and explanation or solution? If it is a bug in my firmware, why would it take several hours to manifest itself? In case it is, indeed, a problem with my code, here it is:

#include <NCD2Relay.h>

NCD2Relay controller;

String data = String(10);
static unsigned long lastPumpUpdate = millis();
int previousStatus;
int status;
unsigned long publishInterval = 300000;
unsigned long lastPublish = millis();
unsigned long lastReset = millis();
bool linkUp = true;

STARTUP(WiFi.selectAntenna(ANT_EXTERNAL)); 

void setup()
   {
   controller.setAddress(0,0,0);
    int status = controller.readInputStatus(3); // Read input terminal 2
    previousStatus = status;
    Particle.publish("IO", String(status), 60, PRIVATE);
    lastPublish = millis();
    lastReset = millis();
    lastPumpUpdate = millis();
    linkUp = true;
   }


void loop()
{
    if ( millis() > lastReset + 3600000 ){ // Reinitialize the MCP23008 chip on the NCD relay board every hour
        controller.setAddress(0,0,0); // Reinitialize the MCP23008 chip on the NCD relay board
        lastReset = millis(); // Reset last initialization time to current program time
    }
    if ( millis() > lastPublish + publishInterval ){ // Send float switch status every 5 minutes
        int status = controller.readInputStatus(3); // Read input terminal 3
        previousStatus = status;
  	    Particle.publish("IO", String(status), 60, PRIVATE);
	    lastPublish = millis();
    }
}

If I need to modify/embellish the code, how do I get it onto the Photon if it’s off-line? Reset to factory defaults and start all over again?

On an unrelated matter: I notice that all three of my Photons (when on-line) occasionally populate the event log with entries as shown in another screenshot. They appear to just be status updates rather than reports of some problem. Is there a way to suppress these reports from the event log?

Thanks in advance for any advice.

UPDATE: I tried almost everything to get the problem Photon functional again. It wouldn’t even go into DFU mode long enough for me to try a factory reset. With no other suggestions yet offered by the community and badly in need of a solution, I “stole” a functioning Photon from another of my accounts, unclaimed it there, claimed it by the account experiencing the problem, flashed it with the exact same firmware that had been running on the problem device, added the external antenna, modified its network credentials appropriately and inserted it into the NCD relay board in place of the problem unit. Everything is now functional again.

I am now forced to conclude that the original Photon is defunct and will try to get the supplier to replace it.

Can you try running it through Device Restore USB | Tools | Particle? and see if that makes a difference?

Will do! Thanks for the suggestion.

Tried it Chris. No joy. The tool gets to “Putting device into DFU mode” but the Photon remains in the constant, no breathing cyan state. Never goes into DFU mode.

:slightly_frowning_face:
That’s odd though - the fact that it’s picking up the device means it’s responding to serial commands at least.
Can you see a serial port? If you open a connection at 14400 baud, does it kick the device into DFU mode?
If you can get it to listening mode, you can reflash the bootloader using particle flash --serial bootloader.bin (Found on GH)

Unfortunately Chris, I cannot get the Particle CLI to install correctly or run on my M1 Mac with Mac OS 12.1. I have installed Rosetta and I ran the “bash <( curl -sL https://particle.io/install-cli )” command in Terminal, but after that any attempt to run any particle command results in nothing happening. I tried to uninstall in order to start fresh using “npm uninstall -g particle-cli” but I get the error “-bash: npm: command not found”. Any ideas?

Hey Brian! I’ve been playing lately a lot with this wonderful Restore tool, and in the cases where it cannot put the device in DFU mode on its own, I help it by doing it myself:

To enter DFU Mode:

Hold down BOTH buttons
Release only the RESET button, while holding down the SETUP button.
Wait for the LED to start flashing yellow (it will flash magenta first)
Release the SETUP button
The device now is in the DFU mode.


source

Can you try?

I did that before, Gus, but within a few seconds it dropped back out of DFU mode. But I just tried it again and DFU mode “stuck”, i.e. it is stying in DFU mode. But now I have a bigger problem: I cannot get Particle CLI app to work on my M1 Mac. Stay tuned while I try to resolve that issue.

Great news!! As you will recall, the USB Restore tool hung while waiting for the Photon to go into DFU mode. However, I just tried again after putting the Photon into DFU mode manually. The tool recognized that it was in DFU mode (said so) and successfully did a full restore. Back to normal functionality now. Thanks to Chris for pointing me to the tool and to Gus for the encouragement to try manual DFU mode again (I had tried it before but it wouldn’t stay in that mode long enough).

2 Likes

yeah! :metal: :metal: :metal:

1 Like

one thing (or two) you can add to your firmware is this:

SYSTEM_MODE(AUTOMATIC);
SYSTEM_THREAD(ENABLED);

source

Have you restarted the Terminal post install? I have it running on my M1 Mac no problem.
The bash command is the preferred method.

You can use the serial trick with an app like Coolterm.

Interesting that you should point that out Gus. I discovered both of those commands just yesterday (or was it the day before?). I had another Photon go off line after a week or more of rock-solid behavior. It had a strong WiFi signal but I found it ‘breathing’ green, not cyan. Contrary to my normal strategy, I decided to read the documents and discovered what the issue and solution was. SYSTEM_THREAD(AUTOMATIC) fixed it!

1 Like

Yes, restarted Terminal many times and was using bash. After install, all that is in my ~bin folder is a link to Terminal.
Screen Shot 2022-03-01 at 2.26.33 PM

Why are you doing the same as I do? this is crazy! :slight_smile:

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