<?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>Write and read flash using sd_write_flash and sd_?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/69814/write-and-read-flash-using-sd_write_flash-and-sd_</link><description>I want to use the SoftDevice APIs to read and write flash on the nRF51822. Are there any examples of how to do this. I see all kinds of mixes between pstorage, NVIC (not sure what that stands for) and the softdevice APIs. I did read that if SoftDevice</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 11 Jan 2021 12:43:24 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/69814/write-and-read-flash-using-sd_write_flash-and-sd_" /><item><title>RE: Write and read flash using sd_write_flash and sd_?</title><link>https://devzone.nordicsemi.com/thread/288373?ContentTypeID=1</link><pubDate>Mon, 11 Jan 2021 12:43:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:18d2743f-e54d-437d-b42c-019588561a0c</guid><dc:creator>Marte Myrvold</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I saw you opened a new case about this issue, so this will be handled&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/70129/s110-sd_flash_write-works-in-debugger-when-stepping-line-by-line-fails-otherwise"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Marte&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Write and read flash using sd_write_flash and sd_?</title><link>https://devzone.nordicsemi.com/thread/287697?ContentTypeID=1</link><pubDate>Wed, 06 Jan 2021 11:20:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:650fad4a-1191-400c-a122-661343a6197f</guid><dc:creator>brianreinhold</dc:creator><description>&lt;p&gt;It is what I want. In addition, I have to go between s110 v5/6, s130&amp;nbsp; and s140v6 on nfr51822 and nrf52840. The SDK for writing to flash has changed dramatically between these different versions, but sd_flash_write and sd_flash_page_erase have not. Since I am porting the same functionality across these different platforms (a basic health device) I am sticking to sd_* calls and not the SDK.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;However, I have come across a major problem in s110 v5/6 that sd_flash_write does not work. Actually it does work if I step through the code line by line in the debugger. It does not if I run through it &amp;#39;normally&amp;#39; in the debugger or using no debugger. I have tried all combinations of &amp;#39;tricks&amp;#39;, checking for the busy and retrying, waiting on the flash event using the sd_ polling call. None work unless I step through line by line in the debugger. I am at a total loss.&lt;/p&gt;
&lt;p&gt;Admittedly when using the bond manager and the pstorage SDK APIs, it didn&amp;#39;t work either. Since they are so complicated I did not try and debug it. But the result is easy to test, encryption on a bonded reconnect fails because the long term keys are not saved by the flash write.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Write and read flash using sd_write_flash and sd_?</title><link>https://devzone.nordicsemi.com/thread/286446?ContentTypeID=1</link><pubDate>Wed, 23 Dec 2020 12:00:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3050378d-49e7-497b-acff-6e31a5176df9</guid><dc:creator>brianreinhold</dc:creator><description>&lt;p&gt;THAT was the missing link. Never saw that mentioned anywhere. Thank you.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Write and read flash using sd_write_flash and sd_?</title><link>https://devzone.nordicsemi.com/thread/286445?ContentTypeID=1</link><pubDate>Wed, 23 Dec 2020 11:57:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e4a565bd-687b-4f5e-b341-5acca4a5997d</guid><dc:creator>Marte Myrvold</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;You can read the data directly from flash using memcpy or similar.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Marte&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Write and read flash using sd_write_flash and sd_?</title><link>https://devzone.nordicsemi.com/thread/286441?ContentTypeID=1</link><pubDate>Wed, 23 Dec 2020 11:48:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0622a650-9367-42e7-9ef1-52e111b2200b</guid><dc:creator>brianreinhold</dc:creator><description>&lt;p&gt;YEs, that is clear. How about read? Its the missing link. I want to be able to read what I write.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Write and read flash using sd_write_flash and sd_?</title><link>https://devzone.nordicsemi.com/thread/286440?ContentTypeID=1</link><pubDate>Wed, 23 Dec 2020 11:47:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ccf585be-5a54-419e-a9df-7eee5170dd7c</guid><dc:creator>Marte Myrvold</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I&amp;#39;m afraid we don&amp;#39;t have any dedicated flash example using the Softdevice in SDK 12. However, the Softdevice API is rather simple if that&amp;#39;s what you want. You can use&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s130.api.v2.0.1/group___n_r_f___s_o_c___f_u_n_c_t_i_o_n_s.html?cp=5_7_2_2_2_7_2_9#ga8b49f2e72e97291aecc18ce396956eed"&gt;sd_flash_write&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s130.api.v2.0.1/group___n_r_f___s_o_c___f_u_n_c_t_i_o_n_s.html?cp=5_7_2_2_2_7_2_7#ga9c93dd94a138ad8b5ed3693ea38ffb3e"&gt;sd_flash_page_erase&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Marte&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Write and read flash using sd_write_flash and sd_?</title><link>https://devzone.nordicsemi.com/thread/286424?ContentTypeID=1</link><pubDate>Wed, 23 Dec 2020 10:23:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:96490538-49b0-42fb-9eb0-883eabbb6d30</guid><dc:creator>brianreinhold</dc:creator><description>&lt;p&gt;So what you are saying is that both fstorage and FDS are using SoftDevice to write to flash. I see how SoftDevice is writing to flash. There is a clear method for that.. What I don&amp;#39;t see is how SoftDevice reads from flash. Are there any examples using SoftDevice that write and read from flash? Just an example that writes a buffer of data to flash and then reads it would be nice.&lt;/p&gt;
&lt;p&gt;Again, this info probably exists in the documentation somewhere but the search engine is so minimal one will never find it. The search engine didn&amp;#39;t even find the word &amp;#39;wait&amp;#39; when it was right in the text on the very page I was viewing. So I have to post far too many questions in this forum.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Write and read flash using sd_write_flash and sd_?</title><link>https://devzone.nordicsemi.com/thread/286423?ContentTypeID=1</link><pubDate>Wed, 23 Dec 2020 09:54:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:723479d5-366f-4a9e-b157-7daeddb025fb</guid><dc:creator>Marte Myrvold</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;You can&amp;#39;t use NVMC directly when Softdevice is enabled. The explanation for this can be found in&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s130.sds/dita/softdevices/s130/flash_mem_api/flash_mem_api.html?cp=5_7_2_0_7"&gt;this documentation about Flash memory API&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;However, you can use &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v12.3.0/group__fstorage.html"&gt;fstorage&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v12.3.0/lib_fds.html"&gt;Flash Data Storage (FDS)&lt;/a&gt;&amp;nbsp;to write to flash. fstorage provides functionality to store data to flash and erase flash pages, and is used on top of Softdevice flash API. FDS is used on top of fstorage, and used to minimize the risk of data corruption, and it simplifies the interaction. With FDS, data will automatically be placed&amp;nbsp;at the end of flash (or under the bootloader if that&amp;#39;s programmed to the device).&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Marte&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Write and read flash using sd_write_flash and sd_?</title><link>https://devzone.nordicsemi.com/thread/286418?ContentTypeID=1</link><pubDate>Wed, 23 Dec 2020 09:32:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bb85d556-57b8-43dd-bc91-b83893a9bc7d</guid><dc:creator>brianreinhold</dc:creator><description>&lt;p&gt;I have read throughout this forum that the other methods will have conflicts if you use SoftDevice and BTLE (of which I use both), at least for the nRF51* series. It may no longer be true for the latest versions of the SDKs and the nrf52* series. The latest SoftDevice I can use is s130 and the latest SDK is 12.3.0&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Write and read flash using sd_write_flash and sd_?</title><link>https://devzone.nordicsemi.com/thread/286399?ContentTypeID=1</link><pubDate>Wed, 23 Dec 2020 01:59:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1410df46-34e2-4a79-b20b-31c413e32c7a</guid><dc:creator>Henry_Chou</dc:creator><description>&lt;p&gt;No need to use the SD ( softdevice) . Please refer the example code&amp;nbsp;&lt;/p&gt;
&lt;p&gt;\nRF5_SDK_17.0.2_d674dde\examples\peripheral\flashwrite&lt;/p&gt;
&lt;p&gt;You may access the NVIC by your own.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>