<?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>When could I write the flash???</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/1998/when-could-i-write-the-flash</link><description>Hi, 
 I know the flash operation, including earse and write, should be excuted when the radio is inactive.
So, I put the flash earse and write operation into the function &amp;#39;ble_flash_on_radio_active_evt&amp;#39; and only do it when the m_radio_active == false</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 28 Mar 2014 16:54:57 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/1998/when-could-i-write-the-flash" /><item><title>RE: When could I write the flash???</title><link>https://devzone.nordicsemi.com/thread/8565?ContentTypeID=1</link><pubDate>Fri, 28 Mar 2014 16:54:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:38461cf4-16c9-4e71-954f-da6d8d35cfa9</guid><dc:creator>jimlin</dc:creator><description>&lt;p&gt;Thanks again for your great help :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: When could I write the flash???</title><link>https://devzone.nordicsemi.com/thread/8564?ContentTypeID=1</link><pubDate>Fri, 28 Mar 2014 16:33:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:811042ed-1c20-4db0-bcd8-6ed2f67dc563</guid><dc:creator>Ole Morten</dc:creator><description>&lt;p&gt;It&amp;#39;s impossible to say for sure without seeing your code, but a typical cause of hardfaults is unaligned access. On Cortex M0, you can only access word-aligned addresses directly.&lt;/p&gt;
&lt;p&gt;However, this is really very unrelated, so if you have further problems with this, please post it separately. I&amp;#39;d also be happy if you could accept my reply as an answer, to clear up this question.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: When could I write the flash???</title><link>https://devzone.nordicsemi.com/thread/8563?ContentTypeID=1</link><pubDate>Fri, 28 Mar 2014 14:48:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e45c7d7b-84de-4473-9aee-9a3f7b56807c</guid><dc:creator>jimlin</dc:creator><description>&lt;p&gt;oh~~~thanks for your remind and done the disconnect operation.
Meanwhile, I found the flash_word_write cause hardfault when full speed run instead of step by step after a breakpoint. Anything need to be careful?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: When could I write the flash???</title><link>https://devzone.nordicsemi.com/thread/8562?ContentTypeID=1</link><pubDate>Fri, 28 Mar 2014 10:35:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:81bc6738-c684-4964-b6c3-881b59fea596</guid><dc:creator>Ole Morten</dc:creator><description>&lt;p&gt;I&amp;#39;m not sure I see the problem with power-on; you&amp;#39;d just loop through the flash and use the most recent value. However, this is for you to decide.&lt;/p&gt;
&lt;p&gt;You must obviously use the correct connection handle for the connection in question, which you get in the connected event. In the example applications it&amp;#39;s also typically stored in the m_conn_handle variable.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: When could I write the flash???</title><link>https://devzone.nordicsemi.com/thread/8561?ContentTypeID=1</link><pubDate>Fri, 28 Mar 2014 10:33:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5286d728-e108-4f5b-93df-a3d707d53b5e</guid><dc:creator>jimlin</dc:creator><description>&lt;p&gt;I don&amp;#39;t think write flash with new address increasely is acceptable for it need to reload when power on.
I try to disconnect it first but not clear what m_conn_handle should I write.
Could you guide me ?
Thanks.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: When could I write the flash???</title><link>https://devzone.nordicsemi.com/thread/8560?ContentTypeID=1</link><pubDate>Fri, 28 Mar 2014 10:21:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cc899518-e37a-44c0-9ab2-e197000751b2</guid><dc:creator>Ole Morten</dc:creator><description>&lt;p&gt;If you just need to store a single value, one possibility is to just keep writing to a new address while you are in a connection, and then erase the page and write the new value at the bottom of the page when the link is disconnected for some other reason. If you write a single uint32_t, you would be able to change it 256 times before a page is full, and if you use multiple pages, you could make this number much bigger if needed.&lt;/p&gt;
&lt;p&gt;It isn&amp;#39;t really feasible to use a longer connection interval with a mouse, since that will cause the movement to be noticeably laggy.&lt;/p&gt;
&lt;p&gt;Finally, the recommendation to upgrade your softdevice, SDK and chip revision still stands, and will be the definitely easiest way to solve your problem.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: When could I write the flash???</title><link>https://devzone.nordicsemi.com/thread/8559?ContentTypeID=1</link><pubDate>Fri, 28 Mar 2014 08:53:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a491f7c3-99a5-440c-a840-7b1834808dfb</guid><dc:creator>jimlin</dc:creator><description>&lt;p&gt;I try to find another way: disconnect the link then write the flash, and re-connect as followed:
//==============================================
// Enter main loop.
for (;;)
{
app_sched_execute();
power_manage();
if(bind_info_clear == true)
NVIC_SystemReset();
if(dpi_level_store == true)
{
if(ble_connected == true)
{
err_code = sd_ble_gap_disconnect(0, BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);
APP_ERROR_CHECK(err_code);	
}
err_code = ble_flash_page_erase(FLASH_PAGE_DPI);
APP_ERROR_CHECK(err_code);
m_advertising_mode = BLE_DIRECTED_ADV;
m_direct_adv_cnt   = APP_DIRECTED_ADV_TIMEOUT;
advertising_start();
dpi_level_store = false;
}
}
//==============================================
But another question is what the right value of m_conn_handle?Only 0xffff is for invalid.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: When could I write the flash???</title><link>https://devzone.nordicsemi.com/thread/8558?ContentTypeID=1</link><pubDate>Fri, 28 Mar 2014 05:18:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ec8d61a3-efef-4c6f-9beb-084beea64823</guid><dc:creator>jimlin</dc:creator><description>&lt;p&gt;the parameters I set are:
MIN_CONN_INTERVAL = 7.5
MAX_CONN_INTERVAL = 15
SLAVE_LATENCY = 25
CONN_SUP_TIMEOUT = 3000&lt;/p&gt;
&lt;p&gt;Does it mean the connection interval is between 7.5 and 15ms?
As SPEC described, the CONN_INTERVAL is between 7.5ms to 4s.If want the longer interval, could I set the MAX_CONN_INTERVAL directly?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: When could I write the flash???</title><link>https://devzone.nordicsemi.com/thread/8557?ContentTypeID=1</link><pubDate>Fri, 28 Mar 2014 03:19:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cf352fc9-3857-4beb-9cf6-56bcb8c5590d</guid><dc:creator>jimlin</dc:creator><description>&lt;p&gt;Hi Morten,&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Thanks for your answer.

My application is to store the DPI setting into flash once the DPI button pressed when connecting. As you said, the only way is to do it when disconnected, which is safety for I am not sure how long the connection interval is. But, I do not think it is reasonable for mouse application to disconnect it for flash operation. It is bad experience for user. What&amp;#39;s your suggustion?
Do you have any demo on flash operation during connection?
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Thanks.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: When could I write the flash???</title><link>https://devzone.nordicsemi.com/thread/8556?ContentTypeID=1</link><pubDate>Thu, 27 Mar 2014 16:55:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:55d88d4d-2b71-4c18-bee8-abb27e198aec</guid><dc:creator>Ole Morten</dc:creator><description>&lt;p&gt;First, I&amp;#39;d strongly recommend you to upgrade to S110 version 6.0.0. For production you&amp;#39;ll most likely end up getting second revision chips anyway, and for these S110 version 6.0.0 is the recommended solution. For development, you can also use 6.0.0 on your first revision chip, as long as you don&amp;#39;t go into production with this combination. As explained &lt;a href="https://devzone.nordicsemi.com/index.php/0xdeadbeef,-722,-src-ll_adv-c"&gt;here&lt;/a&gt;, there is (at least) one known assert with this combination.&lt;/p&gt;
&lt;p&gt;Doing a flash erase will typically take 21 ms, as specified in the PS, so you need to make sure to do it at a time the softdevice won&amp;#39;t need to run anything for (at least) that period. If the connection (or advertising) interval is short, it may not be possible to do while in a connection (or while advertising). In that case, the only time you can do it is while disconnected.&lt;/p&gt;
&lt;p&gt;However, if you make sure that the connection (or advertising) interval is long, there should be sufficient time to do it right after a radio event, as you say you do now. If you can&amp;#39;t get this working, can you please upload the compelte source code your working with, so I can take a look?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>