<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Using nrf52840 Flash block as EEPROM</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/75217/using-nrf52840-flash-block-as-eeprom</link><description>Hi, 
 
 What is the best approach to use a block of flash in nrf52840 as EEPROM. Are there any pre-existing library support for the same? 
 Also which is the best flash operation that I should use for this particular feature? 
 nrf provides multiple APIs</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 20 May 2021 13:14:36 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/75217/using-nrf52840-flash-block-as-eeprom" /><item><title>RE: Using nrf52840 Flash block as EEPROM</title><link>https://devzone.nordicsemi.com/thread/310768?ContentTypeID=1</link><pubDate>Thu, 20 May 2021 13:14:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c69f6dad-2067-45c9-922c-f879245740bd</guid><dc:creator>Manjunath S</dc:creator><description>&lt;p&gt;Hey, Thanks for your reply.&lt;/p&gt;
&lt;p&gt;Did some exploring in the nordic forum and found the reason for that. now I wait in the same function after write call until I get a write/update event in the callback. That seems to solve the problem.&lt;/p&gt;
&lt;p&gt;Thanks to &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/67607/fds-update-returning-fds_err_crc_check_failed-in-event-handler" rel="noopener noreferrer" target="_blank"&gt;this post&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using nrf52840 Flash block as EEPROM</title><link>https://devzone.nordicsemi.com/thread/310748?ContentTypeID=1</link><pubDate>Thu, 20 May 2021 12:29:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8c6d2df1-bce5-420b-b6ed-39f652e04367</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;I have problems explaining that. Can you reproduce this with a piece of code that I can run on a DK so that I can test on my side? Of second best upload the code so that I can see exactly how you are doing this?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using nrf52840 Flash block as EEPROM</title><link>https://devzone.nordicsemi.com/thread/310589?ContentTypeID=1</link><pubDate>Thu, 20 May 2021 02:10:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3e5c04a7-2379-4b57-8f1f-083b61f071ba</guid><dc:creator>Manjunath S</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Thanks. I was able to use FDS library&amp;nbsp;which fulfills my requirements. But I see one problem.&lt;/p&gt;
&lt;p&gt;I am writing a record with key 0x1001 with 1 byte of data and update it periodically and read back.&lt;/p&gt;
&lt;p&gt;I start from value 0x00 and update till 0xF6 by incrementing 0x06 at a time and again back from 0.&lt;/p&gt;
&lt;p&gt;It works fine till 0xF0 When I write 0xF6 the update call returns success, but the next read returns CRC CHECK ERROR.&lt;/p&gt;
&lt;p&gt;I see the flash stats and it is as below&lt;/p&gt;
&lt;p&gt;INF:total pages: 3&lt;br /&gt;total records: 81&lt;br /&gt;valid records: 2&lt;br /&gt;dirty records: 79&lt;br /&gt;largest contig: 1022&lt;br /&gt;freeable words: 355 (1420 bytes)&lt;/p&gt;
&lt;p&gt;Could you please help me why and when this CRC error could possibly come?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using nrf52840 Flash block as EEPROM</title><link>https://devzone.nordicsemi.com/thread/310256?ContentTypeID=1</link><pubDate>Tue, 18 May 2021 18:06:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1a9f258a-25ac-4ced-9a6a-5561e64b573e</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;What exactly do you mean by using as EEPROM? Using in to persistently store application data, or something more specific? Which approach and library to use depends on the use case, but in most cases the &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.2/lib_fds.html"&gt;FDS library&lt;/a&gt; is a good option. It allows you to write arbitrary size records (within a page size less overhead), and has basic wear leveling etc. It is used by key SDK modules such as the peer manger. The &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.2/lib_fstorage.html"&gt;fstorage library&lt;/a&gt; is a lower level library which provides basic functions to write and erase flash in a generic way that works both with and without a SoftDevice, and is used by the peer manger, though it can also be used directly.&lt;/p&gt;
&lt;p&gt;As a side note, the reason the SoftDevice is relevant here is that while a SoftDevice is used, flash write and erase operations must be done using SoftDevice APIs, and that is handled by the fstorage library (and thus also FDS). You can also use SoftDevice flash API-s directly, or nrf_nvmc API&amp;#39;s if not using a SoftDevice and you want simple low level write and erase support.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>