Backup Ram Stopped working (Issue with 0.4.9) (updated)

I confirmed that the code below works correction on 0.4.7 but stopped working with 0.4.9. It appears that 0.4.9 has affected the way retained variables work


I had been using the back up ram via retained variables on a photon running successfully for a week. Then today I flashed the photon and now retained variables are no longer working. No matter what I try the values are no longer retained…

I simplified the code to:

STARTUP(System.enableFeature(FEATURE_RETAINED_MEMORY));

retained int value;

void setup() {
    Serial.begin(9600);
}

void loop() {
    Serial.println(value);
        Spark.publish("message-1",String(value),60,PRIVATE); delay(1000);
    value = 20;
    Serial.println(value);
    	     Spark.publish("message-2",String(value),60,PRIVATE); delay(5000);
    delay(1000); // Give the serial TX buffer a chance to empty
   System.sleep(SLEEP_MODE_DEEP, 10);

}

no matter what I do I get

message 1= 0
message 2=20
over and over gain.

prior to today I would have had:

Message 1=20
Message 2=20

Any suggestions?

Ping @mdma

It’s version “0.4.9”, to help people like me searching for this issue.

1 Like

Thanks for reporting this. We’ve identified and resolved the issue. Please recompile and flash your application to get the fix. The fix does not affect system firmware - only the application code needs to be flashed.

3 Likes

same issue right now on Electron?

STARTUP(System.enableFeature(FEATURE_RETAINED_MEMORY));

retained int value;

void setup() {
	Serial.begin(9600);
}

void loop() {
	Serial.println(value);
	// Spark.publish("message-1",String(value),60,PRIVATE); delay(1000);
	value++;
	Serial.println(value);
	// Spark.publish("message-2",String(value),60,PRIVATE); delay(5000);
	delay(3000); // Give the serial TX buffer a chance to empty
	System.sleep(SLEEP_MODE_DEEP, 5);
}

gives me on serial:

0
1
0
1

:frowning:

just to clarify: same sketch runs perfectly on photon

Yes, there was a bug introduced in 0.4.8 that was fixed for 0.4.9, so I believe this is what’s causing the issue on the electron, which is based on 0.4.8. We will be posting a new release in a few weeks, if not sooner.

In the meantime,you could try building using the local toolchain.

@joky did building using the local toolchain work in keeping retained values? Briefly what is the process? Thanks.

hi,
didn’t try yet, I’ve still 2 other open issues with my electrons, the first one is a real show-stopper right now:


I’ll try to compile the firmware tomorrow, maybe one or two of the other issues are gone too :smile:

regards

Hi @joky let us know how it goes.

sorry, had some issues compiling the firmware. When uploading user-firmware.bin or application.bin, the electron goes into magenta-breathing recovery mode,…

You’ll need to build from the modules folder rather than main, so that you update the system firmware too.

thanks,… got system-part1.bin, system-part2.bin and application.bin newly compiled. I flashed them OTA but again - just breathing magenta,…

try particle serial inspect it will tell you why.

Hi,
I put the electron in listening mode and entered particle serial inspect and got:

User module #1 - version 3, main location, 131072 bytes max size
  UUID: 7BC1D5F608F7E663AD75BF5E3BB26392347DAFF79B6193EFE92C7BFCC78020DB
  Integrity: PASS
  Address Range: PASS
  Platform: PASS
  Dependencies: FAIL
      System module #2 - version 11
  empty - factory location, 131072 bytes max size

Only “Dependencies” failed, the other modules are all PASS.

regards

looks like you haven’t managed to successfully update system firmware. Pressing ‘v’ in listening mode should show the version as 0.4.9.

right… system firmware version: 0.4.8-rc.6

flashed the same binaries (system-part1.bin, system-part2.bin and application.bin) again over serial and voila! Backup RAM works now! (using F/W 0.4.9)

thank you!