S7G2 writing to internal data flash during power off

I am just curious to know if there is a way on S7G2 to detect Power OFF condition to write couple of variables to internal data flash, and if there is a way to do that, the next question is would it have enough time to write 8 bytes before quitting.

If there is way then I don't have to worry about designing a super cap board/Circuitry that can hold the charge for 3-5 secs on power OFF.

I have a requirement to keep track some variables every 0.1 changes, and I don't want to write to memory every 0.1 change as I would hit the upper limit of 100,000 erase/write cycles in a couple of months.

Any input on this is much appreciated.

 

Thanks,

Sam

Parents
  • Hi Sam,

    Just a couple of thoughts.

    If you are using a battery for the RTC you might be able to get a few bytes from the alarm registers which are non volatile, and you can R/W as often as you wish before the power down occurs.

    Again if you have a battery, you can put on a small spi device, we use 23LCV1024 (128k) and modified the sample driver and put FileX on it.

    I think there is Wear levelling code available for the DataFlash I don't know how much this extends the write cycles .

    As most application use almost no dataflash, you might be able to write your own very inefficient / wasteful memory code to use the 64K memory for your data. A minimum BLOCK size is 64 so you have 1000 of them, you get 100K writes but unlimited reads, so the first 2 blocks give you 992 bits which you set to 1 and goes to 0 when a data block is used. A counter in each of your data blocks counts to 100k so you know when to use the next block. This should give you 100M Read / Writes.

    Best Regards,
    Alan..
Reply
  • Hi Sam,

    Just a couple of thoughts.

    If you are using a battery for the RTC you might be able to get a few bytes from the alarm registers which are non volatile, and you can R/W as often as you wish before the power down occurs.

    Again if you have a battery, you can put on a small spi device, we use 23LCV1024 (128k) and modified the sample driver and put FileX on it.

    I think there is Wear levelling code available for the DataFlash I don't know how much this extends the write cycles .

    As most application use almost no dataflash, you might be able to write your own very inefficient / wasteful memory code to use the 64K memory for your data. A minimum BLOCK size is 64 so you have 1000 of them, you get 100K writes but unlimited reads, so the first 2 blocks give you 992 bits which you set to 1 and goes to 0 when a data block is used. A counter in each of your data blocks counts to 100k so you know when to use the next block. This should give you 100M Read / Writes.

    Best Regards,
    Alan..
Children
No Data