Persistent RAM

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Is it possible to preserve the value of a variable during a reset? This is obviously not always possible, for example if the power source is removed, but for other resets like hibernate (which I use to "power on" my device), it shouldn't be impossible. If so, how is this done?

0 Likes
1 Solution
ErBU_1372276
Level 2
Level 2
First like received

You can program variable in flash before go in hibernate mode.

View solution in original post

0 Likes
7 Replies
ErBU_1372276
Level 2
Level 2
First like received

You can program variable in flash before go in hibernate mode.

0 Likes
Anonymous
Not applicable

I was first of all interested in RAM. I just saw in the cy_boot datasheet that there is variable declaration macro CY_NOINIT, and the documentation for the function CySysPmHibernate() in the same datasheet actually says that variables declared as CY_NOINIT will be preserved. So that will probably be a fully answer to my question (?).

   

 

   

But I am also interested in Flash. When we did programming on a PSoC5LP, we had access to persistent EEPROM. The disadvantage was that its lifetime was limited; it had a maximal number of writes. How is Flash compared to EEPROM? Can I use Flash to store user specific data? Does Flash have a limited lifetime? Which disadvantages against EEPROM does Flash have? Thank you 🙂

0 Likes

Yes, in hibernate mode SRAM is retained, and variables are not initialised on wakeup or reset when declared as CY_NOINIT.

   

For PSOC4 flash endurance is 100K cycles erase/write. There is no EEPROM in PSoc4. For EEPROM that 1M cycle normally.

   

Eric

Anonymous
Not applicable

OK, so I can't use Flash more than 100K times? So if I am going to save user data each time my device powers off, the user will only be able to use the device 100K + 1 times; after this the user will have to put my device in the trash can?

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

When powering your device once a day, @100k cycles it would last for more than 250 years. Probably long enough for denying complaint files 😉

   

 

   

Bob

Anonymous
Not applicable

When talking about endurance: Is there any limitations on how many times the drive modes for GPIO pins can be changed? I change the drive mode in runtime because I think it will save power (I do this for my pins upon device shutdown (hibernate), but also frequently: before and after doing an ADC reading). And is it adviced to not change drive mode rapidly, does it takes a lot of time for a change?

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Drive mode (as all active configuration data) is not kept in flash but in a memory bank, so endurance is the same as for sram. At system power-up configuration is copied from flash into the sram area. Changing the drive mode will be as fast as CPU executes. When in doubt, connect a logic analyzer.

   

 

   

Bob