7 Replies Latest reply on Jun 15, 2016 6:31 AM by user_1377889

    Persistent RAM

    cjoachim_1597296

      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?

        • 1. Re: Persistent RAM
          user_505436374

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

          • 2. Re: Persistent RAM
            cjoachim_1597296

            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 :)

            • 3. Re: Persistent RAM
              user_505436374

              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

              1 of 1 people found this helpful
              • 4. Re: Persistent RAM
                cjoachim_1597296

                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?

                • 5. Re: Persistent RAM
                  user_1377889

                  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

                  1 of 1 people found this helpful
                  • 6. Re: Persistent RAM
                    cjoachim_1597296

                    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?

                    • 7. Re: Persistent RAM
                      user_1377889

                      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

                      1 of 1 people found this helpful