<?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>Flash write with SDK 4.4.2 + S110 5.2.1</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/16687/flash-write-with-sdk-4-4-2-s110-5-2-1</link><description>Hello everyone, 
 I have inherited a project from my coworker. It uses NRF51822 QFAAH0 , SDK 4.4.2 and S110 5.2.1 . My device is scheduled to: advertise, collect the data from a sensor. 
 Now I would like to store sensor data in flash then transfer</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 29 Sep 2016 14:14:48 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/16687/flash-write-with-sdk-4-4-2-s110-5-2-1" /><item><title>RE: Flash write with SDK 4.4.2 + S110 5.2.1</title><link>https://devzone.nordicsemi.com/thread/63852?ContentTypeID=1</link><pubDate>Thu, 29 Sep 2016 14:14:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6e57a75f-77cd-4653-bb5d-a57d5252d520</guid><dc:creator>Quoc Khanh</dc:creator><description>&lt;p&gt;Thank you for spending time.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash write with SDK 4.4.2 + S110 5.2.1</title><link>https://devzone.nordicsemi.com/thread/63853?ContentTypeID=1</link><pubDate>Thu, 29 Sep 2016 13:22:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:047a9fee-6422-4436-83cf-2075d9c7aec7</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;Np :)&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Just stop advertising.&lt;/li&gt;
&lt;li&gt;That is right.&lt;/li&gt;
&lt;/ol&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash write with SDK 4.4.2 + S110 5.2.1</title><link>https://devzone.nordicsemi.com/thread/63851?ContentTypeID=1</link><pubDate>Thu, 29 Sep 2016 13:07:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:eca34d82-a66f-450f-9c4a-82eb5d36cd6f</guid><dc:creator>Quoc Khanh</dc:creator><description>&lt;p&gt;Thank you so much for your very clear answer! It&amp;#39;s really helpful. I just have two small questions:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Do I need to disable the SD or just need to stop advertising before writing to flash?&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;If I have a bootloader (reserved from 0x3C800 which equals to 14 pages), the bond manager will reserve from 239~241. Is that right?&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash write with SDK 4.4.2 + S110 5.2.1</title><link>https://devzone.nordicsemi.com/thread/63850?ContentTypeID=1</link><pubDate>Thu, 29 Sep 2016 10:10:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6a85f767-6c18-4e49-b49c-13475e627c90</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;You cannot use pstorage or fstorage, these are accessing flash through the SoftDevice, with functions like sd_flash_write() and sd_flash_page_erase(). These do not exist in SD 110 5.2.1.&lt;/p&gt;
&lt;p&gt;With SD 110 5.2.1 the application has to access Non-Volatile Memory Controller registers directly, which doesn&amp;#39;t have to be a problem, but writing to flash will halt the CPU for a given period of time (depending on how much data you write). When it is finished, the flash is written, the CPU will return (just like a normal function call). BLE connections have strict timing, so if the CPU is halted when the stack requires the CPU it will cause problems. A flash page erase takes 22 ms.&lt;/p&gt;
&lt;p&gt;The simplest/safest way to do this is to not use the radio when you write/erase flash, so stop advertising, write/erase flash then start advertising again, and never write/erase flash while in a connection.&lt;/p&gt;
&lt;p&gt;You can use the Flash Manager library. You can find it&amp;#39;s documentation in SDK documentation. Modules-&amp;gt;nRF51822-&amp;gt;Libraries-&amp;gt;Bluetooth Libraries-&amp;gt;Flash Manager. If you have specific questions regarding the library I think you should add a new question and explain more about what is unclear.&lt;/p&gt;
&lt;p&gt;You have to have control over which flash pages are used by SoftDevice, application, and bond manager, and which that are available. QFAAH0 has 256 flash pages, the SD 110 5.2.1 uses 0-79. You application is in 80-x, while the bond manager typically reserves 253-255. So you should be free to use any page between x and 253.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash write with SDK 4.4.2 + S110 5.2.1</title><link>https://devzone.nordicsemi.com/thread/63848?ContentTypeID=1</link><pubDate>Wed, 28 Sep 2016 11:27:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a77cc032-26ce-4cae-8f8a-9d5bb0607786</guid><dc:creator>Quoc Khanh</dc:creator><description>&lt;p&gt;Now my fixed boards are incompatible with SDK and SD version. They are NRF51822 QFAAH0, and using SDK 4.4.2 and SD110 5.2.1. Until now I didn&amp;#39;t find any big problem. Maybe my application is not so complicated so they are still working fine. There are some small problems such as some SD functions didn&amp;#39;t work (maybe). At that time I just suspected that my code was not perfect.&lt;/p&gt;
&lt;p&gt;Back to my question, instead of using latest SDK/SD, can I still use flash_word/page_write functions (as in flashwrite_example folder in SDK 4.4.2 folder)? This example wrote data to flash without considering the BT communication. Therefore, in my case, do I need to disable the SD before writing and then enable it again after writing or just wait until the BT communication is disconnected? BT communication also write some data in flash so how can I manage that data area? I don&amp;#39;t want it to be stored in my data area.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash write with SDK 4.4.2 + S110 5.2.1</title><link>https://devzone.nordicsemi.com/thread/63849?ContentTypeID=1</link><pubDate>Wed, 28 Sep 2016 10:43:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a3507dec-f320-4f64-8060-8e54c00ffcd1</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;It is hard to say. If revisions and SDK/SD are incompatible it means that we haven&amp;#39;t tested them together. It doesn&amp;#39;t have to be a problem, but it could be. The bootloader in SDK 4.4.2 only supports application update. SDK 6.1.0 and later supports update of SD/BL/APP. Do the fixed boards have chips with the same revision?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash write with SDK 4.4.2 + S110 5.2.1</title><link>https://devzone.nordicsemi.com/thread/63847?ContentTypeID=1</link><pubDate>Wed, 28 Sep 2016 09:46:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f2e1f17a-30dc-47eb-8b28-6bb3fcd76c8f</guid><dc:creator>Quoc Khanh</dc:creator><description>&lt;p&gt;Thank you for your reply. What is the risk of using incompatible SDK and SD for chip revision? I&amp;#39;m sorry for this question since I&amp;#39;m really new for Nordic chip.&lt;/p&gt;
&lt;p&gt;One more question is: Can I upgrade the SoftDevice and Bootloader over the air? Some boards are now fixed in the machine so I can&amp;#39;t plug it out to upgrade SD and botloader. It&amp;#39;s the reason why I have to use current SDK and SD.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Flash write with SDK 4.4.2 + S110 5.2.1</title><link>https://devzone.nordicsemi.com/thread/63846?ContentTypeID=1</link><pubDate>Wed, 28 Sep 2016 09:30:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9133e5d0-759b-4c11-97f9-35389e4cf522</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;SDK 4.4.2 and S110 5.2.1 is really old. QFAAH0 is a revision 3 chip, see &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf51/dita/nrf51/compatibility_matrix/nRF51822_ic_revision_overview.html?cp=3_0_1"&gt;this&lt;/a&gt;, and is not even compatible with these, see &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf51/dita/nrf51/compatibility_matrix/nRF51422_nRF51822_ic_rev_sdk_sd_comp_matrix.html?cp=3_0_4"&gt;this&lt;/a&gt;. Why not use the latest SDK and SoftDevice?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>