| Electronics > Beginners |
| Writing EEPROM, sudden battery loss, capacitor keep-alive calculation? |
| << < (3/6) > >> |
| sokoloff:
One strategy I've used is to write some signature bytes to know on the next startup if I got a valid write previously. You could have an A and B bank and a start/end signature byte. If the start and end bytes mismatch, that bank is invalid. If the start and end bytes match, take the bank with the higher incrementing counter as the good one and write to the other one next time (write the new start byte, then the data, then the end byte). It's not cryptographically secure nor error-correcting, but it seems to work well enough. |
| mariush:
--- Quote from: SL4P on October 12, 2018, 02:31:02 pm ---I have a dinky ATMEGA1284 project with some other stuff on the board... some fairly hungry I detect loss of the unregulated incoming supply, and have a primary 1000uF in front of the protection diode, and 470 after... before the regulators... The processor has enogh time to write at least 2 of EEPROM - before the board gets shut down. I work it this way because I keep a lot of transient variables which would wear down the EEPROM life,so only save it at shutdown or when power fails. --- End quote --- At some point, wouldn't it make more sense to add an i2c or spi based FRAM chip? You can buy them for around 1$ for 16 kbit and have 10^12 read/write operations per byte : https://www.fujitsu.com/uk/Images/MB85RS16N.pdf (random example) |
| jnz:
--- Quote from: mariush on October 12, 2018, 03:04:08 pm --- --- Quote from: SL4P on October 12, 2018, 02:31:02 pm ---I have a dinky ATMEGA1284 project with some other stuff on the board... some fairly hungry I detect loss of the unregulated incoming supply, and have a primary 1000uF in front of the protection diode, and 470 after... before the regulators... The processor has enogh time to write at least 2 of EEPROM - before the board gets shut down. I work it this way because I keep a lot of transient variables which would wear down the EEPROM life,so only save it at shutdown or when power fails. --- End quote --- At some point, wouldn't it make more sense to add an i2c or spi based FRAM chip? You can buy them for around 1$ for 16 kbit and have 10^12 read/write operations per byte : https://www.fujitsu.com/uk/Images/MB85RS16N.pdf (random example) --- End quote --- Cost, size, none I could find quickly were 5V, so I'd need a 3V rail and not certain a voltage divider would be a good idea which just means more size and more cost. However - I will give another look into them and see if an external memory solution might work. It's not a bad idea at all. |
| jnz:
--- Quote from: sokoloff on October 12, 2018, 02:55:14 pm ---One strategy I've used is to write some signature bytes to know on the next startup if I got a valid write previously. You could have an A and B bank and a start/end signature byte. If the start and end bytes mismatch, that bank is invalid. If the start and end bytes match, take the bank with the higher incrementing counter as the good one and write to the other one next time (write the new start byte, then the data, then the end byte). It's not cryptographically secure nor error-correcting, but it seems to work well enough. --- End quote --- Already doing. The issue is that I need the data that was attempted to be written. I'll be configuring the application to get the writing done while it's doing it's main tasks so as to keep the probability of the user disconnecting it to a minimum - but if there is corruption typically I'd lose important data or the module will stop working requiring an RMA, and really trying to avoid that! |
| jnz:
--- Quote from: SL4P on October 12, 2018, 02:31:02 pm ---I have a dinky ATMEGA1284 project with some other stuff on the board... some fairly hungry I detect loss of the unregulated incoming supply, and have a primary 1000uF in front of the protection diode, and 470 after... before the regulators... The processor has enogh time to write at least 2 of EEPROM - before the board gets shut down. I work it this way because I keep a lot of transient variables which would wear down the EEPROM life,so only save it at shutdown or when power fails. --- End quote --- Why one before the diode and one after? What does that accomplish? Also, just clarifying, 2 of eeprom? Two bytes? Two blocks? 2ms? |
| Navigation |
| Message Index |
| Next page |
| Previous page |