Particle photon goes blank without any response after 2 months

Hi,
I have several photon devices installed for different customers. I have updated all of the devices with my latest firmware before 2 months. But for the last 3-4 days I have noticed that many of the devices goes offline, when I checked few of the devices , I have figured that the photon is blinking nothing(blank). But when I clicked the reset button I comes back normal and connected with the cloud. Can anyone tell what should be the cause?

If your code is not taking control of the RGB LED and doesn’t engage a sleep mode, then a steady off RGB LED most likely suggests a deadlock between Device OS and your application firmware.

We don’t have the code for controlling the RGB LED and not engaging the sleep function. Could you please explain what may be the causes for deadlock? We are using application watchdog with 60000ms delay.

There are several posts in this forum that feature the keyword “deadlock” and you can search for them to get a more indepth discussion, but in short, if you have for example multiple threads running which may concurrently demand access to some shared resource (e.g. a HW interface) situations may arise where two or more threads are mutually waiting for another to continue execution, but hence none of them will.

Without more info about your code the list of possible causes is just to complex for a forum thread.

I am using SYSTEM_THREAD(ENABLED) in my code.

void setup()
{

	pinMode(CE, OUTPUT);
	pinMode(CUTOFF_VALVE_HIGH,OUTPUT);
	pinMode(CUTOFF_VALVE_LOW,OUTPUT);
	pinMode(CUTOFF_VALVE_EN, OUTPUT);

	digitalWrite(CE, HIGH);
	Serial.begin(9600);
	Serial.println(F("Particle init.. v3.7e"));
	Serial.println(calculate_mlps(0x0001, 0x41A6), 3); //test

	SPI1.begin();
	//SPI1.beginTransaction(SPI1Settings(256000, MSBFIRST, SPI_MODE2));
	SPI1.setDataMode(SPI_MODE2);
	SPI1.setClockSpeed(10000000);
	SPI1.setBitOrder(MSBFIRST);

	MAX35101_cmd(MAX35101_RESET);
	MAX35101_cmd(MAX35101_INIT); 
    MAX35101_dump_regs("init");
	delay(1000);

	previous_t = millis();
	meter_timer = previous_t + 50;
	print_timer = meter_timer + 500; 
	reset_timer = 0;
	
	delay(1000);
	Serial.println("setup complete");
	

}

This is our set up code.

While dumping the maxim values we are calling particle publish

void MAX35101_dump_regs(String type)
{
    Serial.println(type);
	int n = 0;
	char s[8];
	for (byte reg = 0xb0; reg > 0; reg++)
	{
		uint16_t ret = MAX35101_read(reg);
		if(n == 0)
		{
			sprintf(s, "0x%.2X", reg);
			Serial.println(" ");
			Serial.print(s);
			Serial.print("#");
// 			if(reg>=0xb8)
		    maximConfigDump+=String(s)+": ";	
		}
		sprintf(s, "%.4X", ret);
// 		if(reg>=0xb8)
		maximConfigDump+=String(s)+" ";
		Serial.print(" ");
		Serial.print(s);
		if(++n > 15) n = 0;
		if( strlen(maximConfigDump)>=220)
		{
		if(Particle.connected()){
    	     Particle.publish("sp-maxim-config-"+type,maximConfigDump,PRIVATE);
    	    maximConfigDump="";
    	    delay(600);
		}
		}
	}
	Particle.publish("sp-maxim-config-"+type,maximConfigDump,PRIVATE);
    maximConfigDump="";
	Serial.println();
	Serial.println();
}

Is this a problem?

In the loop section we are reading the data from MAXIM calculate the usage and publishing it.

But this was working fine for last 2 months and from the 3 days few of the devices are going offline.

In the code you had up a few moments ago, I saw that you were using String a lot, which may have contributed to the issue - although I’d be surprised if that was the cause, that you didn’t see the issue earlier (unless your deep-sleep-reconnect function or the AWD prevented that).


continuing via PM