https://mat.midlight.eu/index.php?title=EEPROM_Wear_Leveling_(AVR101)&feed=atom&action=history
EEPROM Wear Leveling (AVR101) - Versionsgeschichte
2024-03-29T12:15:22Z
Versionsgeschichte dieser Seite in ProjectWiki
MediaWiki 1.31.0
https://mat.midlight.eu/index.php?title=EEPROM_Wear_Leveling_(AVR101)&diff=103&oldid=prev
Mat: /* Overview */
2013-02-26T00:45:26Z
<p><span dir="auto"><span class="autocomment">Overview</span></span></p>
<table class="diff diff-contentalign-left" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="de">
<td colspan="2" style="background-color: #fff; color: #222; text-align: center;">← Nächstältere Version</td>
<td colspan="2" style="background-color: #fff; color: #222; text-align: center;">Version vom 26. Februar 2013, 00:45 Uhr</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l1" >Zeile 1:</td>
<td colspan="2" class="diff-lineno">Zeile 1:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>== Overview ==</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>== Overview ==</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>This is an implementation of the algorithm described in the [http://www.atmel.com/Images/doc2526.pdf Appnote AVR101] by Atmel. Its purpose is to increase the write cycles for parameters in EEPROM.</div></td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>This is an implementation of the algorithm described in the [http://www.atmel.com/Images/doc2526.pdf Appnote AVR101] by Atmel. Its purpose is to increase the write cycles for parameters <ins class="diffchange diffchange-inline">stored </ins>in EEPROM.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>To achieve this, there are two ring buffers for each parameter: a status buffer, which keeps track of the last written index and the parameter buffer itself.</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>To achieve this, there are two ring buffers for each parameter: a status buffer, which keeps track of the last written index and the parameter buffer itself.</div></td></tr>
</table>
Mat
https://mat.midlight.eu/index.php?title=EEPROM_Wear_Leveling_(AVR101)&diff=102&oldid=prev
Mat am 24. Februar 2013 um 16:49 Uhr
2013-02-24T16:49:02Z
<p></p>
<table class="diff diff-contentalign-left" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="de">
<td colspan="2" style="background-color: #fff; color: #222; text-align: center;">← Nächstältere Version</td>
<td colspan="2" style="background-color: #fff; color: #222; text-align: center;">Version vom 24. Februar 2013, 16:49 Uhr</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l77" >Zeile 77:</td>
<td colspan="2" class="diff-lineno">Zeile 77:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Wearlevel_write 0</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Wearlevel_write 0</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Print "WRITE 0"</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>Print "WRITE 0"</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>End</pre></div></td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>End</div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> </div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">Random_values:</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">  Testbyte = Rnd(255)</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">  Testword = Rnd(65535)</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">  Testsingle = Testword</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">  Testsingle = Testsingle / 1000</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">  Testword = Rnd(65535)</ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">Return</ins></pre></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>== Download ==</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>== Download ==</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>[http://www.braunecker.at/downloads/wear_leveling_1_0.zip Download]</div></td><td class='diff-marker'> </td><td style="background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>[http://www.braunecker.at/downloads/wear_leveling_1_0.zip Download]</div></td></tr>
</table>
Mat
https://mat.midlight.eu/index.php?title=EEPROM_Wear_Leveling_(AVR101)&diff=101&oldid=prev
Mat: Created page with "== Overview == This is an implementation of the algorithm described in the [http://www.atmel.com/Images/doc2526.pdf Appnote AVR101] by Atmel. Its purpose is to increase the write..."
2013-02-24T16:41:27Z
<p>Created page with "== Overview == This is an implementation of the algorithm described in the [http://www.atmel.com/Images/doc2526.pdf Appnote AVR101] by Atmel. Its purpose is to increase the write..."</p>
<p><b>Neue Seite</b></p><div>== Overview ==<br />
This is an implementation of the algorithm described in the [http://www.atmel.com/Images/doc2526.pdf Appnote AVR101] by Atmel. Its purpose is to increase the write cycles for parameters in EEPROM.<br />
<br />
To achieve this, there are two ring buffers for each parameter: a status buffer, which keeps track of the last written index and the parameter buffer itself.<br />
Because the write cycles are distributed over several EEPROM cells, the life time is increased.<br />
<br />
== Usage ==<br />
Include the library at the top of your program:<br />
<pre>Const Wearlevel_count = [PARAMETER COUNT] ' number of parameters to store in eeprom (default: 1)<br />
' ring buffer size (estimated life time: 100.000 cell write cycles * wearlevel depth)<br />
'Const Wearlevel_depth = [BUFFER_SIZE] ' uncomment to define the buffer sizes (default: 8)<br />
'Const Wearlevel_start = [EEPROM_START] ' uncomment to set EEPROM start address (default: 1)<br />
$include "wear_leveling.inc"</pre><br />
<br />
Define the parameters stored in EEPROM and link them to a SRAM variable:<br />
<pre>Dim My_parameter As [TYPE]<br />
Wearlevel_pointer([PARAMETER_ID]) = Varptr(My_parameter) ' address of variable in SRAM<br />
Wearlevel_size([PARAMETER_ID]) = [TYPE_SIZE] ' byte size of the variable data type</pre><br />
<br />
Load all parameters stored in EEPROM:<br />
<pre>Wearlevel_read 0</pre><br />
<br />
Load specific parameter with ID:<br />
<pre>Wearlevel_read [PARAMETER_ID]</pre><br />
<br />
Save all parameters to EEPROM:<br />
<pre>Wearlevel_write 0</pre><br />
<br />
Save specific parameter with ID:<br />
<pre>Wearlevel_write [PARAMETER_ID]</pre><br />
<br />
== Sample ==<br />
<pre>$regfile = "m32def.dat"<br />
$crystal = 16000000<br />
$baud = 57600<br />
$framesize = 48<br />
<br />
Const Wearlevel_count = 3 ' number of parameters to store in eeprom (default: 1)<br />
' ring buffer size (estimated life time: 100.000 cell write cycles * wearlevel depth)<br />
'Const Wearlevel_depth = 10 ' uncomment to define the buffer sizes (default: 8)<br />
'Const Wearlevel_start = 20 ' uncomment to set EEPROM start address (default: 1)<br />
$include "wear_leveling.inc"<br />
<br />
' define the parameters<br />
Dim Testbyte As Byte<br />
Wearlevel_pointer(1) = Varptr(testbyte) ' address of variable in SRAM<br />
Wearlevel_size(1) = 1 ' byte size of the variable data type<br />
<br />
Dim Testword As Word<br />
Wearlevel_pointer(2) = Varptr(testword)<br />
Wearlevel_size(2) = 2<br />
<br />
Dim Testsingle As Single<br />
Wearlevel_pointer(3) = Varptr(testsingle)<br />
Wearlevel_size(3) = 4<br />
<br />
' load all parameter values stored in EEPROM (ID = 0), called usually during the initialisation<br />
Wearlevel_read 0<br />
Print "READ 0: [1] " ; Testbyte ; ", [2] " ; Testword ; ", [3] " ; Testsingle<br />
<br />
' assign some random values<br />
Gosub Random_values<br />
Print "RANDOM: [1] " ; Testbyte ; ", [2] " ; Testword ; ", [3] " ; Testsingle<br />
<br />
' just save paramter 2 (Testword)<br />
Wearlevel_write 2<br />
Print "WRITE 2"<br />
<br />
' load all again<br />
Wearlevel_read 0<br />
Print "READ 0: [1] " ; Testbyte ; ", [2] " ; Testword ; ", [3] " ; Testsingle<br />
<br />
' new random values<br />
Gosub Random_values<br />
Print "RANDOM: [1] " ; Testbyte ; ", [2] " ; Testword ; ", [3] " ; Testsingle<br />
' save all parameters (ID = 0)<br />
Wearlevel_write 0<br />
Print "WRITE 0"<br />
End</pre><br />
<br />
== Download ==<br />
[http://www.braunecker.at/downloads/wear_leveling_1_0.zip Download]</div>
Mat