<?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 Pstorage while BLE scanning</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/11773/using-pstorage-while-ble-scanning</link><description>Hi everyone, 
 I am using the following:
*nRF51422
*SDK11
*keil uVision 5.17
*s130 
 I have been working with nRF51 that scans beacons and stores it into persistent storage. 
 I tweaked an example code, called ble_app_uart_c in ble_central of SDK11</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 17 Feb 2016 13:01:00 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/11773/using-pstorage-while-ble-scanning" /><item><title>RE: using Pstorage while BLE scanning</title><link>https://devzone.nordicsemi.com/thread/44512?ContentTypeID=1</link><pubDate>Wed, 17 Feb 2016 13:01:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8ce5c1e2-9541-4826-bd25-70da7e15c55e</guid><dc:creator>run_ar</dc:creator><description>&lt;p&gt;As far as I can see you are not checking the error message returned by pstorage_update. Can you please check that this is NRF_SUCCESS, so that we know that the operation is actually queued.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: using Pstorage while BLE scanning</title><link>https://devzone.nordicsemi.com/thread/44511?ContentTypeID=1</link><pubDate>Mon, 08 Feb 2016 15:01:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9269c662-e74d-4080-baac-fb29cc635a72</guid><dc:creator>Jacob</dc:creator><description>&lt;p&gt;Yes, you are right. I am using sd_ble_gap_scan_start.&lt;/p&gt;
&lt;p&gt;Here is the code for the scan parameters:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#define SCAN_INTERVAL           0x00A0                          
#define SCAN_WINDOW             0x0050                         
#define SCAN_ACTIVE               1                              
#define SCAN_SELECTIVE          0                              
#define SCAN_TIMEOUT            0x01A4

static const ble_gap_scan_params_t m_scan_params = 
  {
    .active      = SCAN_ACTIVE,
    .selective   = SCAN_SELECTIVE,
    .p_whitelist = NULL,
    .interval    = SCAN_INTERVAL,
    .window      = SCAN_WINDOW,
    .timeout     = SCAN_TIMEOUT
  };
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;One thing that I tried is to call &lt;strong&gt;sd_ble_gap_scan_stop()&lt;/strong&gt; before using pstorage. And, it did not work that I expected.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: using Pstorage while BLE scanning</title><link>https://devzone.nordicsemi.com/thread/44510?ContentTypeID=1</link><pubDate>Mon, 08 Feb 2016 14:52:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:92659234-2357-424f-a2d7-4e35ffeac932</guid><dc:creator>run_ar</dc:creator><description>&lt;p&gt;What is your scan parameters?&lt;/p&gt;
&lt;p&gt;I assume you are using sd_ble_gap_scan_start? sd_ble_gap_connect has higher priority.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: using Pstorage while BLE scanning</title><link>https://devzone.nordicsemi.com/thread/44509?ContentTypeID=1</link><pubDate>Mon, 08 Feb 2016 14:41:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3ce09abc-6846-4a12-a2f3-5477ff60499a</guid><dc:creator>Jacob</dc:creator><description>&lt;p&gt;Thanks for sharing your idea, run_ar.&lt;/p&gt;
&lt;p&gt;I tried to increase SD_CMD_MAX_TRIES and to give it a delay, but no luck. it keeps looping the while loop.&lt;/p&gt;
&lt;p&gt;I am using a softdevice-s130_nrf51_2.0.0.7.alpha. Regarding your answer, is it possible to change pstorage priority higer?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: using Pstorage while BLE scanning</title><link>https://devzone.nordicsemi.com/thread/44508?ContentTypeID=1</link><pubDate>Mon, 08 Feb 2016 06:11:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6b3d0080-2704-417e-82d7-5f4213d8a27d</guid><dc:creator>run_ar</dc:creator><description>&lt;p&gt;Not sure which S130 version you are working with. But when you are using pstorage the Softdevice will calculate how much time flash operations need before granting it time in its scheduler. Update block means creating a swap block and erasing the main block before updating the block again. So I assume this is blocked as the softdevice is giving scanning priority. Consider updating the block after you are done scanning or increase SD_CMD_MAX_TRIES.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>