<?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>S120 Persistent storage initial clear command never executes</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/5568/s120-persistent-storage-initial-clear-command-never-executes</link><description>I am using S120 v2 with SDK 6.
Initialization of the softdevice and device manager return no errors.
However when I want to start a scan for devices, the function checks the status of pstorage with
pstorage_access_status_get and finds that the initial</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 25 Feb 2015 10:06:25 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/5568/s120-persistent-storage-initial-clear-command-never-executes" /><item><title>RE: S120 Persistent storage initial clear command never executes</title><link>https://devzone.nordicsemi.com/thread/19524?ContentTypeID=1</link><pubDate>Wed, 25 Feb 2015 10:06:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:876d1fe6-8895-428e-884f-f771f277cd74</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Leon,&lt;/p&gt;
&lt;p&gt;I would suggest you to go through some steps for debugging:&lt;/p&gt;
&lt;p&gt;For S120 v1.0 that you got a disconnection after 1 minute:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Get a &lt;a href="https://www.nordicsemi.com/eng/Products/Bluetooth-Smart-Bluetooth-low-energy/nRF-Sniffer/(language)/eng-GB"&gt;sniffer&lt;/a&gt; trace to see what happens over the air.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Add a break point when the disconnected event occurs and check what the reason of the disconnection.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For the S120 v2.0:&lt;/p&gt;
&lt;p&gt;Try to avoid device manager to erase the bond information, so you don&amp;#39;t have the queue for pstorage, or you can manually remove the check for count in pstorage_access_status_get(&amp;amp;count); in scan_start().&lt;/p&gt;
&lt;p&gt;You can also test pstorage by creating a fresh project and only test pstorage if you can erase &amp;amp; write something to flash.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: S120 Persistent storage initial clear command never executes</title><link>https://devzone.nordicsemi.com/thread/19523?ContentTypeID=1</link><pubDate>Tue, 24 Feb 2015 12:22:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9e38808b-a6e7-477c-b09f-83df1fb553f9</guid><dc:creator>Leon Schmetz</dc:creator><description>&lt;p&gt;I can understand that you have not tested it on older hardware. However I would like to gain some insight about what can be done because as it happens we have that hardware. We are inquiring with RF Digital if they have more recent hardware in the models sold at the moment. Until then I must do with what I have. I have a working application on the same hardware with softdevice 1.01. That would be the end of it if not for the fact that this version breaks the connection after 1 minute. So if you can help get that resolved, I am happy too. Still there must be something you can tell me why the same code (except for the necessary changes) would make it possible to scan for devices on s120 v1 and not on v2. It looks like I am not getting any events from the softdevice. I suspect something with the vector table but I cannot find what I should add or change to get it working.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: S120 Persistent storage initial clear command never executes</title><link>https://devzone.nordicsemi.com/thread/19522?ContentTypeID=1</link><pubDate>Thu, 19 Feb 2015 16:17:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:efde4d06-492a-49e6-9912-2fd64c54e254</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;@Leon: For the differences between S120 v2.0 vs S110 v1.0 you can have a look at the release note in the S120 v2.0 zip file.&lt;/p&gt;
&lt;p&gt;We haven&amp;#39;t tested the S120 on XLR1 so we actually don&amp;#39;t know about the behaviour when you run S120 on the chip. Some functions may work some may not, and glitch may occurs at some point when running.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: S120 Persistent storage initial clear command never executes</title><link>https://devzone.nordicsemi.com/thread/19521?ContentTypeID=1</link><pubDate>Wed, 18 Feb 2015 15:45:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:06df5b40-2688-4894-aa85-d1ce9761e441</guid><dc:creator>Leon Schmetz</dc:creator><description>&lt;p&gt;Tried setting clear_persistent_data = false to no avail. It seems I am not getting any callbacks from the softdevice. Can that be?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: S120 Persistent storage initial clear command never executes</title><link>https://devzone.nordicsemi.com/thread/19520?ContentTypeID=1</link><pubDate>Wed, 18 Feb 2015 14:58:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6726025f-7eeb-4df5-ab64-c22a5ee8a8a8</guid><dc:creator>Leon Schmetz</dc:creator><description>&lt;p&gt;Still I would like answers to the questions above.
If possible I will move to newer versions of the chip, but for now I am just interested in getting the job done.
My most pressing question is where do s120v1.01 and s120 v2.0 differ because I can get scanning to work with s120 v1.01.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: S120 Persistent storage initial clear command never executes</title><link>https://devzone.nordicsemi.com/thread/19519?ContentTypeID=1</link><pubDate>Wed, 18 Feb 2015 14:54:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9a64bd71-d0d0-4174-a067-5f5c616d8dad</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Leon,&lt;/p&gt;
&lt;p&gt;As I mentioned earlier, if you avoid the button 1 (Bond erase button) being set, you should be able to skip the pstorage bond erasing (this part of the code in device_manager_init()
// Clear all bonded devices if user requests to.
init_param.clear_persistent_data =
((nrf_gpio_pin_read(BOND_DELETE_ALL_BUTTON_ID) == 0)? true: false);&lt;/p&gt;
&lt;p&gt;Then you can try to use the S120 to scan, connect, read attribute as you want.
But there is no guarantee that the S120 stack would work properly on your XLR1 chip. I would suggest you to get hold of new development kit, such as the nRF51 DK which has XLR3+.&lt;/p&gt;
&lt;p&gt;XLR1 is discontinuted and for production you will need to use XLR3 anyway.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: S120 Persistent storage initial clear command never executes</title><link>https://devzone.nordicsemi.com/thread/19518?ContentTypeID=1</link><pubDate>Wed, 18 Feb 2015 10:50:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f2575e94-41fe-4af8-a1a7-e30dd01eda07</guid><dc:creator>Leon Schmetz</dc:creator><description>&lt;p&gt;On second thought, with s120 v1.01 scanning works and in v1.01 pstorage and device manager are already used. So what makes it different s120 v2.0?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: S120 Persistent storage initial clear command never executes</title><link>https://devzone.nordicsemi.com/thread/19517?ContentTypeID=1</link><pubDate>Tue, 17 Feb 2015 15:09:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f39f47b1-b9a6-4e82-81ba-d93f27bb7982</guid><dc:creator>Leon Schmetz</dc:creator><description>&lt;p&gt;nrfjprog.exe --memrd 0x1000005c, returns FFFF001D which suggests it is a revision 1 chip.
So if I understand you correctly, I will not be able to get this to work correctly. I would be happy if you could help me get things working correctly with either s120 v1.01 or v2.0. I do not require much, just be able to scan and connect and read/write 2 attributes.
As I already mentioned, everything works fine on s120 v1.01 except that the connection resets after 1 minute (connection parameters negotiation ??)
Could I do without pstorage?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: S120 Persistent storage initial clear command never executes</title><link>https://devzone.nordicsemi.com/thread/19511?ContentTypeID=1</link><pubDate>Tue, 17 Feb 2015 14:56:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d443b222-24ea-44b1-8ea0-3fbb75bebe1e</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Leon,&lt;/p&gt;
&lt;p&gt;I would suggest you to also post the question on &lt;a href="http://forum.rfduino.com/"&gt;http://forum.rfduino.com/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;If the chip inside the module &amp;#39;s the first version of the chip (XLR1) it won&amp;#39;t work properly with S120.
You can have a look at this &lt;a href="https://www.nordicsemi.com/eng/nordic/Products/nRF51822/ATTN-51/41917"&gt;matrix table&lt;/a&gt;.
To be able to know which chip version the board is you can use nrfjprog with this command:
nrfjprog.exe --memrd 0x1000005c
It will readout the HWID that you can find at Table 2 in the matrix table pdf file.&lt;/p&gt;
&lt;p&gt;Do you have any problem running the S120 without holding the bond erase button (no page erasing will be queued) ?&lt;/p&gt;
&lt;p&gt;I would suggest you to make some simple test with pstorage to see if you can write &amp;amp; erase a page.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: S120 Persistent storage initial clear command never executes</title><link>https://devzone.nordicsemi.com/thread/19516?ContentTypeID=1</link><pubDate>Tue, 17 Feb 2015 14:18:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7abe1e2e-7918-41a9-b548-f41c94602001</guid><dc:creator>Leon Schmetz</dc:creator><description>&lt;p&gt;In my application a RFDigital 22301module is used. I cannot read the markings unless I open one. With S120 v1.01 everything works except that the connection is dropped after 1 minute. So I thought it best to move to v2.0. I have not tested pstorage with s110.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: S120 Persistent storage initial clear command never executes</title><link>https://devzone.nordicsemi.com/thread/19515?ContentTypeID=1</link><pubDate>Tue, 17 Feb 2015 14:07:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:82837220-066e-44d6-aa76-d731c142c69d</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;@Leon: Which board are you testing on ? Could you read the laser marking on top of the chip ?
Would the S120 run if you don&amp;#39;t press button 1 (no flash erasing) when booting up ?
Have you experience any issue with the examples for S110 ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: S120 Persistent storage initial clear command never executes</title><link>https://devzone.nordicsemi.com/thread/19513?ContentTypeID=1</link><pubDate>Mon, 16 Feb 2015 15:45:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:829617cd-b771-4372-887a-e82a2b0f5ee5</guid><dc:creator>Leon Schmetz</dc:creator><description>&lt;p&gt;I made an error in the build. I can flash now and debug.
It turns out that this results in exact the same error!&lt;/p&gt;
&lt;p&gt;In scan_start, pstorage_access_status_get(&amp;amp;count) returns count=1.
And also no sys_evt NRF_EVT_FLASH_OPERATION_SUCCESS or NRF_EVT_FLASH_OPERATION_ERROR occurs&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: S120 Persistent storage initial clear command never executes</title><link>https://devzone.nordicsemi.com/thread/19514?ContentTypeID=1</link><pubDate>Mon, 16 Feb 2015 15:38:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0038c832-11dd-4e17-9317-24a34fe2f1c8</guid><dc:creator>Leon Schmetz</dc:creator><description>&lt;p&gt;Thank you for looking into this.&lt;/p&gt;
&lt;p&gt;I have copied the ble_app_hrs_c project from the SDK
I copied the include files from S120 include folder to the project include folder for s120
I changed device_manager_central because the interface for sd_ble_gatts_sys_attr_set /get has changed. I have added value 0 as last parameter.
I have added call to sd_ble_enable in main\ble_stack_init and changed the SOFTDEVICE_HANDLER_INIT to use my clock
I have also added app_scheduler to the project (was missing).&lt;/p&gt;
&lt;p&gt;I cannot flash this project from Keil. Using NrfGo shows why&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/5050.Nrfgo_5F00_error.png" alt="image description" /&gt;
I made no other changes than the ones mentioned above.
The same holds for my actual project. I just added my application code.&lt;/p&gt;
&lt;p&gt;Hope you can help me&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: S120 Persistent storage initial clear command never executes</title><link>https://devzone.nordicsemi.com/thread/19512?ContentTypeID=1</link><pubDate>Mon, 16 Feb 2015 13:37:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1eccbebc-eb49-46fb-9b3b-0518782df2b6</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;@Leon: Do you have the same issue when testing with our stock example (ble_app_hrs_c project for example) ?&lt;/p&gt;
&lt;p&gt;When holding button 1 when start up, we will try to clear the bond information page. There should be an system event after the page is erased. As I&amp;#39;m testing here I got an system event back (pstorage_sys_event_handler()) with NRF_EVT_FLASH_OPERATION_SUCCESS code and op_code = 0x04 means PSTORAGE_CLEAR_OP_CODE.&lt;/p&gt;
&lt;p&gt;And the nRF51 continued to scan and report the advertising packet back.&lt;/p&gt;
&lt;p&gt;Please make sure you have update the API header files for S120 v2.0 to the SDK. Because SDK v6.x came with the API for the S120 v1.0.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: S120 Persistent storage initial clear command never executes</title><link>https://devzone.nordicsemi.com/thread/19510?ContentTypeID=1</link><pubDate>Mon, 16 Feb 2015 10:06:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0dde3d2a-35e9-49e3-ab33-820d0e4ae5b2</guid><dc:creator>Leon Schmetz</dc:creator><description>&lt;p&gt;static void scan_start(void)
{
uint32_t err_code;
uint32_t count;
// Verify if there is any flash access pending, if yes delay starting scanning until
// it&amp;#39;s complete.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;  err_code = pstorage_access_status_get(&amp;amp;count);
  APP_ERROR_CHECK(err_code);

if (count != 0)
{
    m_memory_access_in_progress = true;
    return;
}
	
err_code = sd_ble_gap_scan_start(&amp;amp;m_scan_param);
APP_ERROR_CHECK(err_code);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;/**@brief Function for initializing the BLE stack.
*&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;@details Initializes the SoftDevice and the BLE event interrupt.
*/
static void ble_stack_init(void)
{
uint32_t err_code;
ble_enable_params_t ble_enable_params;&lt;/p&gt;
&lt;p&gt;// Initialize the SoftDevice handler module.
//SOFTDEVICE_HANDLER_INIT(NRF_CLOCK_LFCLKSRC_XTAL_20_PPM, false);
//SOFTDEVICE_HANDLER_INIT(NRF_CLOCK_LFCLKSRC_RC_250_PPM_4000MS_CALIBRATION, false);
SOFTDEVICE_HANDLER_INIT(NRF_CLOCK_LFCLKSRC_RC_250_PPM_4000MS_CALIBRATION, true);&lt;/p&gt;
&lt;p&gt; // Enable BLE stack
memset(&amp;amp;ble_enable_params, 0, sizeof(ble_enable_params));
ble_enable_params.gap_enable_params.role = BLE_GAP_ROLE_CENTRAL;
ble_enable_params.gatts_enable_params.service_changed = 0;
err_code = sd_ble_enable(&amp;amp;ble_enable_params);
APP_ERROR_CHECK(err_code);&lt;/p&gt;
&lt;p&gt; // Register with the SoftDevice handler module for BLE events.
err_code = softdevice_ble_evt_handler_set(ble_evt_dispatch);
APP_ERROR_CHECK(err_code);&lt;/p&gt;
&lt;p&gt;// Register with the SoftDevice handler module for System events.
err_code = softdevice_sys_evt_handler_set(sys_evt_dispatch);
APP_ERROR_CHECK(err_code);
}&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;/**@brief Function for initializing the Device Manager.
*&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;@details Device manager is initialized here.
*/
static void device_manager_init(void)
{
dm_application_param_t param;
dm_init_param_t        init_param;&lt;/p&gt;
&lt;p&gt;uint32_t err_code;&lt;/p&gt;
&lt;p&gt;err_code = pstorage_init();
APP_ERROR_CHECK(err_code);&lt;/p&gt;
&lt;p&gt;// Clear all bonded devices if user requests to.
init_param.clear_persistent_data = true;
//        ((nrf_gpio_pin_read(BOND_DELETE_ALL_BUTTON_ID) == 0)? true: false);&lt;/p&gt;
&lt;p&gt;err_code = dm_init(&amp;amp;init_param);
APP_ERROR_CHECK(err_code);&lt;/p&gt;
&lt;p&gt;memset(&amp;amp;param.sec_param, 0, sizeof (ble_gap_sec_params_t));&lt;/p&gt;
&lt;p&gt;// Event handler to be registered with the module.
param.evt_handler            = device_manager_event_handler;&lt;/p&gt;
&lt;p&gt;// Service or protocol context for device manager to load, store and apply on behalf of application.
// Here set to client as application is a GATT client.
param.service_type           = DM_PROTOCOL_CNTXT_GATT_CLI_ID;&lt;/p&gt;
&lt;p&gt;// Secuirty parameters to be used for security procedures.
param.sec_param.bond         = SEC_PARAM_BOND;
param.sec_param.mitm         = SEC_PARAM_MITM;
param.sec_param.io_caps      = SEC_PARAM_IO_CAPABILITIES;
param.sec_param.oob          = SEC_PARAM_OOB;
param.sec_param.min_key_size = SEC_PARAM_MIN_KEY_SIZE;
param.sec_param.max_key_size = SEC_PARAM_MAX_KEY_SIZE;
param.sec_param.kdist_periph.enc = 1;
param.sec_param.kdist_periph.id  = 1;&lt;/p&gt;
&lt;p&gt;err_code = dm_register(&amp;amp;m_dm_app_id,&amp;amp;param);
APP_ERROR_CHECK(err_code);
}&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;/**@brief Initialize the scheduler.
*/&lt;/p&gt;
&lt;p&gt;static void scheduler_init(void)
{
APP_SCHED_INIT(SCHED_MAX_EVENT_DATA_SIZE, SCHED_QUEUE_SIZE);
}&lt;/p&gt;
&lt;p&gt;/**@brief Function for application main entry.
*/
int main(void)
{
uint32_t err_code;
memset(m_dlt_list, 0, sizeof(m_dlt_list));&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;// Initialization of various modules.
scheduler_init();

ble_stack_init();
client_handling_init();
device_manager_init();

	err_code = serial_port_init(on_serial_message);

  for (;;)
{
    app_sched_execute();
			err_code = sd_app_evt_wait();
    APP_ERROR_CHECK(err_code);
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;}&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>