Lost Connection to Photon. Photon Pulsing Green After Pulsing Blue for a Few Seconds. Continuous Fast Blinking Yellow after Resetting to Setup

The Photon had been successfully in use for a couple of weeks. I was updating and testing the Photon’s firmware for a couple of hours and all was well too, until this issue of the the lost connection came up. The Particle Cloud does acknowledge the Photon coming online when powered up and going offline when powered down, but that is the only connection that can be established with the Photon since this issue began. I have tried many tutorials for forcing a reset but none have worked, the light only continues to blink yellow after all attempts.
Thanks in advance for any suggestions!

Are you able to place the Photon in safe mode?

No, attempt to put in safe mode results in quick flash yellow light. All attempts result in yellow flashing light, other than initial power up which starts with pulsing cyan and then switches to pulsing green after a few seconds.

How about Listening mode?

Nope, no listening mode results in blinking yellow light. On closer examination the light may be blinking yellow and red simultaneously, yellow on top and red on bottom. I did think that a memory overload due to firmware I wrote was the cause of the crash to begin with, so the red light would make sense but the red light is blinking steady and fast along with the yellow light, which is unlike the SOS out of heap memory blinking pattern described in the Photon user guide. https://docs.particle.io/guide/getting-started/modes/photon/#safe-mode

Are you able to share a video?

Yeah, I can do a video. Give me a few to get it together and uploaded…

https://www.amazon.com/photos/share/5UVelfUktY3d3aGh8HnyfEqa6hGVB0sQ5o5aEuFoQdO Let me know if it’s too short a video. If you loop the video it would mimic the experience, just continues to blink like in the video. Not sure if you can pick up on the exact color in the video the way I can see it live where the red on the bottom is noticeable, blinking along with the yellow every blink.

It looks like DFU mode. What happens if you do a particle update?

Everything I do results in DFU mode. Particle update through the CLI doesn’t find the device, I’ve made sure its not a USB 3.0 port and I’ve tried different usb micro cords. Also says my device is offline on the Particle Mobile app. It does register as starting up and shutting down when monitoring the Particle Cloud Console. I think forcing a factory reset is the answer but all attempts result in DFU mode.

This is the particle update message,

"!!! I was unable to detect any devices in DFU mode...

Your device will blink yellow when in DFU mode.
If your device is not blinking yellow, please:

  1. Press and hold both the RESET/RST and MODE/SETUP buttons simultaneously.

  2. Release only the RESET/RST button while continuing to hold the MODE/SETUP button.

  3. Release the MODE/SETUP button once the device begins to blink yellow."

@BDub might be able to help here. I think a JTAG is needed to restore the Photon.

I changed the micro USB cord and was able to update system firmware, but the problem persists just like before the update.

Well @kennethlimcp the issue has been resolved. To break the cycle of always going into DFU mode I powered up the Photon, let it go into the pulsing green mode then held down the Setup and Reset button simultaneously, but then after only a couple of seconds released the reset then the Setup buttons which put the Photon into listening mode, blinking blue. I was then able to run particle setup through the CLI. After WiFi setup was complete I quickly flashed via Particle Build the default Blink_A_Led program. I then re-flashed tinker and have control over the Photon again. Thanks @kennethlimcp for helping walk me through this issue!!!

1 Like

To be honest, i have not clue what went wrong but i am glad it is working now. :wink:

I’m fairly certain I overloaded the heap, which caused this issue. I have to look into releasing memory, I’m a C# guy and most garbage collection is automatic in .Net.

Here is the code I suspect needs memory management…

    int myAverages[9];
int p = 0;
        int myReadings[9];
        for(int i=0; i <10; i++){
            analogvalue = analogRead(voltageMeter);
            myReadings[i] = analogvalue;
            if(i == 9){
                float myaverage = average(myReadings, 9);
                Particle.publish("readings: ", String(myReadings[0]) + ", " +String(myReadings[1]) + ", " +String(myReadings[2]) + ", " +String(myReadings[3]) + ", " +String(myReadings[4]) + ", " +String(myReadings[5]) + ", " +String(myReadings[6]) + ", " +String(myReadings[7]) + ", " +String(myReadings[8]));
                myAverages[p] = myaverage;
                //Particle.publish("readings average: ", String(myaverage));
                if(p == 9){
                    float myaverages = average(myAverages, 9);
                    Particle.publish("average of averages: ", String(myaverages));
                    p = 0;
                i = 0;
float average (int * array, int len)  // assuming array is int.
  long sum = 0L ;  // sum will be larger than an item, long for safety.
  for (int i = 0 ; i < len ; i++)
    sum += array [i] ;
  return  ((float) sum) / len ;  // average will be fractional, so float may be appropriate.

With myReadings[i] with i==9 you will be corrupting adjacent data.
Your array either needs to be [10] or your loop can only run while i < 9.

All your String() stuff will also contribute to some memory trouble.

Resetting i = 0 at the end of the loop, will trap your code in there too, which is not the best thing to do :wink: