Skip to content

High Endurance EEPROM Library for megaAVR devices in Arduino platform

License

Notifications You must be signed in to change notification settings

shuvangkardas/RingEEPROM

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RingEEPROM

Build Status GitHub release GitHub commits MIT License LinkedIn

Hign Endurance EEEPROM

Atmega microcontrollers have a limited EEPROM write cycle of 100k. Using the library we can overcome this limit of 100k write cycles. Primarily I have developed the library for the Arduino platform. I will add the library to other platforms in the near future

Problem Statement

In many situation we need to write the EEPROM memory frequently.For an energy meter application, The energy parameter needs to update frequently in EEPROM to persist the value for a long time. Let's Think about a situation. I need to write energy value in eeprom after 10s interval.

  • total number of writes for one day would be 8640.
  • one month 259.2K

Atmel AVR microcontroller such as atmega328 ensures EEPROM data reliability upto 100k write/erase cycle. Oops!! That means we will cross that limit after 11 days. That is very sad.

One more thing we need to clarify that 100k write/erase cycle for each cell, not for a whole EEPROM memory segment. Here is the point we are going to play with.

RingEEPROM Arduino Library

Arduino EEPROM Endurance, EEPROM Ring buffer

For solving the eeprom wear out problem, I have developed an Arduino library RingEEPROM.

Solution

The idea is simple. As I cannot write/erase safely each cell more than 100k times. what if multiple cells is used for the same variable. To clarify more, Suppose I want to store a variable in EEPROM. What I will do is, at First I will write the variable in first location, second time I will write the variable in the second location.Third time I will write the variable in the third location, Fourth time I will write the variable in the first location. I am repeating the pattern after 3 locatons. Thus I am getting 3 times endurance for a single variable.

I will store my value in different cells in each write cycle. So let's consider our buffer size i 8. I am planning to write a byte in EEPROM. As I am using 8 cells for a single byte. Now I get 8*100k = 800k write cycles. That's huge. The bigger the buffer size is, the more write cycles I get.

In this library, I will not store a single variable, I have developed the library such a way so that I can handle any size of buffer.

So for saving value in eeprom, I need two types of buffer

  1. Parameter Buffer : This is the intended value we want to store in EEPROM
  2. Status Buffer: This buffer keeps track of my current location in buffer.

For more information please go through the Microchip application note

License

MIT

About

High Endurance EEPROM Library for megaAVR devices in Arduino platform

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages