2012-05-15 10:31 AM
I wonder if someone could help me.
I need to save, to retain ''some'' variables of my applications, but the 4Kbytes from the Backup registers is too few for what I need. So I would like to ask if there is another way to make this possible. I can't lost this information while the power is OFF. I would like to store it in the Flash memory when the power goes back, and reload this variables when the power turns on. But I think that in the instant that the powers goes back, it it too late to store my variables in Flash. Best regards, A.Paiva2012-05-15 11:01 AM
This depends on the power supply hardware, but is a common problem. Flash (or EEPROM, which is basically just byte-adressable Flash), are really power hungry. After power-off, they easily suck your remaining capacity dry.
Either use a large capacity sufficient for an erase/write cycle, (we do it in commercial devices), use external battery-backed RAM, FRAM, or an uC which supports more battery-backed RAM internally.2012-05-15 11:09 AM
Yes, flash is probably useless to you, as it uses a charge pump to get to VPP, so lacking a source of electrons you're not going to write much, and it's pretty slow.
How active is this data, is it all dynamic, or do you have semi-permanent settings/configuration/calibration mixed in there? Can you separate these, or reduce the amount of state requiring preservation? Is the data compressable? How much data are you talking about? You could use an external SRAM with a battery/super-cap. You could use an auxiliary supply on the STM32, and detect a primary power failure, and quickly enter SLEEP or STOP mode after turning off peripherals and saving state.2012-05-15 11:21 AM
Thank you all,
This kind of data to be retained is all dynamic and I'm talking about 32Kbytes. I don't know how much time, and power consumption it takes to store 32Kbytes from RAM to Flash to calculate the super-cap. Regards, A.Paiva2012-05-15 11:43 AM
Quick back of the envelope for the STM32F2 you're looking at a typical time of around 100 ms, worst case approaching a second.
This assumes the sector(s) are erased, which would cost you a second or so. The STM32F2 can take a VPP supply which will speed things up significantly, but that's not viable here. I don't even see current number in the preliminary data sheet, but suspect it will be ugly.2012-05-15 12:45 PM
This kind of data to be retained is all dynamic
how dynamic? flash resilience is not infinite. anyhow if the nature of the data is so you can write it while things are nice, that might be a possibility] Erik
2012-05-15 07:06 PM
Better to use an external EEPROM or SPI flash. Or. use STM32-HD, STM32F2 / F4 and connect a battery backup RAM on FSMC.
The data is too large to be stored at power-Off. You will always have a challenge of Vdd falling and time reqd for saving the data. Better to keep it in external memory everytime there is update2012-05-16 12:48 AM
Hi,
Thanks for your suggestion. I would like to reduce the costs, and FRAM are too expensive. To write data to Flash while things are nice would be a possability if the Flash could support 10^12 write/read cycles. But the number of write/read cycles is about 10^6. When I choose a STM32F4 device, I thought that the Vbat could power the uC while the Vdd is turned off. But right now I see that the Vbat only supplies the Back-up domain. I also have no more peripheral avaiable to communicate with an external device. I see that I must use an slave uC. Regards, Almerindo Paiva2012-05-16 02:33 AM
You could add some static RAM externally, and back it with a battery, as soon as the power supply drops below a certain level. This requires some switch-over hardware near the RAMs, but is cheap compared to other solutions.
You still need to detect a failing power supply before that turn-over, to move your data into this battery-backed RAM before the 'loss of conscience'. (Or you accept the performance penalty and use this RAM with 16 Bit access for your application). > But the number of write/read cycles is about 10^6. Forget about FLASH / EEPROM. They are specified to reach 10^4 or 10^5 cycles max. > I see that I must use an slave uC. I can't see how that should help. It moves the problem to the slave uC.2012-05-16 03:53 AM
Hi Fm,
I told I must use an slave uC, only to have more peripherals for communication and get data. Thanks for your suggestion, A.Paiva