<?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>Can I do pstorage store whit S120 scan start?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/6781/can-i-do-pstorage-store-whit-s120-scan-start</link><description>static void ble_evt_dispatch(ble_evt_t * p_ble_evt)
{
 uint32_t err_code;
 const ble_gap_evt_t * p_gap_evt = &amp;amp;p_ble_evt-&amp;gt;evt.gap_evt;
 switch (p_ble_evt-&amp;gt;header.evt_id)
 {
 case BLE_GAP_EVT_ADV_REPORT:
 {
 pstorage_handle_t flash_handle;	
 pstorage_block_identifier_get</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 11 May 2015 13:59:55 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/6781/can-i-do-pstorage-store-whit-s120-scan-start" /><item><title>RE: Can I do pstorage store whit S120 scan start?</title><link>https://devzone.nordicsemi.com/thread/23828?ContentTypeID=1</link><pubDate>Mon, 11 May 2015 13:59:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1a1187b4-6fad-4baf-b5da-785cd2623bb8</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;did you have any progress in this YeLun? just curious&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can I do pstorage store whit S120 scan start?</title><link>https://devzone.nordicsemi.com/thread/23834?ContentTypeID=1</link><pubDate>Fri, 08 May 2015 07:29:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:072c4e31-d8bc-4898-ba8a-4abbc61a5673</guid><dc:creator>YeLun</dc:creator><description>&lt;p&gt;What cause this problem is  the pstorage_clear. While the S120  scanning pstorage_clear get error.
Pstorage_stroe work OK whit no error in SD120 V2.0, but wrong in V1.0 also no error code back.&lt;/p&gt;
&lt;p&gt;Mark here, hope V3.0 have this twins OK.&lt;/p&gt;
&lt;p&gt;Thanks Aryan.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can I do pstorage store whit S120 scan start?</title><link>https://devzone.nordicsemi.com/thread/23827?ContentTypeID=1</link><pubDate>Thu, 30 Apr 2015 13:03:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3f33d529-1f01-462d-acd9-088f8031e3ac</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;uploaded a file in my answer, note that I have modified this beacon app to use S120 but not as central. It is initialized as pheripheral. It should not really matter in our case which role it is, agree?&lt;/p&gt;
&lt;p&gt;to make life easy, i have commented out sd_flash_page_erase inside pstorage_init function. What this will do is that when you connect to this device and when the app get CONNECTED event, the pstorage store function we want to test is the first flash operation. You can set a breakpoint in sys_evt_dispatch function and it should hit (with pstorage success return) after you get connected.you can use master control panel to connect to this app.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can I do pstorage store whit S120 scan start?</title><link>https://devzone.nordicsemi.com/thread/23826?ContentTypeID=1</link><pubDate>Thu, 30 Apr 2015 10:26:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4e25df5f-b6aa-4cab-b1d5-94920a975882</guid><dc:creator>YeLun</dc:creator><description>&lt;p&gt;Can you give your simple app to me? Let me try it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can I do pstorage store whit S120 scan start?</title><link>https://devzone.nordicsemi.com/thread/23825?ContentTypeID=1</link><pubDate>Thu, 30 Apr 2015 09:53:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c462d515-ebb2-4cb1-be7c-4de41fa70166</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Hi YeLun,&lt;/p&gt;
&lt;p&gt;I spent a lot of time on this and I just verified by a simple app that scan and uses pstorage. It works just fine as intended. It should not matter if you call from event interrupt handler as long as you are using APP_PRIORITY_LOW for it. I do not know why your code does not work, but I would recommend you to check for error returns for all function calls that might fail with error. You are not doing this at many places.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can I do pstorage store whit S120 scan start?</title><link>https://devzone.nordicsemi.com/thread/23818?ContentTypeID=1</link><pubDate>Thu, 30 Apr 2015 03:50:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:53d3d574-e834-46f9-b0bd-df78a4ecbf1c</guid><dc:creator>YeLun</dc:creator><description>&lt;p&gt;&lt;strong&gt;I suspect something about  SW12 interrupt priority, in ble event handle process the SW12 interrupt has been closed. So will be no sys event happen when ble event handle is running.
Today, in order to prove the guess, I try to get pstorage_stat(count), then I got a Continued growth count. That mean all pstorage operation stay in queue, nothing be implemented, no sys event handle be implemented.&lt;/strong&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can I do pstorage store whit S120 scan start?</title><link>https://devzone.nordicsemi.com/thread/23817?ContentTypeID=1</link><pubDate>Wed, 29 Apr 2015 14:49:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:578041fb-63e1-4dc8-be17-e7777ed1bcf7</guid><dc:creator>YeLun</dc:creator><description>&lt;p&gt;I don&amp;#39;t know what time is now your area. You have payed attention for this question all day.
Thanks a lot!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can I do pstorage store whit S120 scan start?</title><link>https://devzone.nordicsemi.com/thread/23816?ContentTypeID=1</link><pubDate>Wed, 29 Apr 2015 14:32:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bfbfd0fb-274d-41dc-b02a-40a9a810eb30</guid><dc:creator>YeLun</dc:creator><description>&lt;p&gt;Yes, the program run ok without  pstorage.
This the link of my code in &lt;a href="https://github.com/l1117/BLE_central_sim900A"&gt;github&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can I do pstorage store whit S120 scan start?</title><link>https://devzone.nordicsemi.com/thread/23824?ContentTypeID=1</link><pubDate>Wed, 29 Apr 2015 13:01:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ab21ad57-7f8f-439a-8751-660159084603</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;have you initialized softdevice_handler module using SOFTDEVICE_HANDLER_INIT or oftdevice_handler_init?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can I do pstorage store whit S120 scan start?</title><link>https://devzone.nordicsemi.com/thread/23823?ContentTypeID=1</link><pubDate>Wed, 29 Apr 2015 12:08:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:596cfa0c-d002-4e44-8bfe-e99534af433b</guid><dc:creator>YeLun</dc:creator><description>&lt;p&gt;I have this pstorage can not work with in ble-evt-dispatch problem a long time from sdk7 - 8.
When pstorage in ble-evt will not cause sys-evt handle call. So nothing stored in flash. The pstorage queue not work.
In this situation no sys event call happen, I get know this with debug traced the program.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can I do pstorage store whit S120 scan start?</title><link>https://devzone.nordicsemi.com/thread/23822?ContentTypeID=1</link><pubDate>Wed, 29 Apr 2015 12:01:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e059e558-7881-4414-a9d4-d4dab657cb0d</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;I did not understand your last comment, are you trying to tell me if there is some problem in the code you mentioned?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can I do pstorage store whit S120 scan start?</title><link>https://devzone.nordicsemi.com/thread/23821?ContentTypeID=1</link><pubDate>Wed, 29 Apr 2015 11:47:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:53367894-111f-4fb4-a673-fc4c39b431c8</guid><dc:creator>YeLun</dc:creator><description>&lt;p&gt;If s120 scan need flash exclusivly? Referenc example codes.&lt;/p&gt;
&lt;p&gt;// 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;
}

// Initialize whitelist parameters.
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can I do pstorage store whit S120 scan start?</title><link>https://devzone.nordicsemi.com/thread/23820?ContentTypeID=1</link><pubDate>Wed, 29 Apr 2015 09:15:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fc04fad3-08be-4b71-8d15-57d1fe0a9cb4</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;you have not initialized the softdevice handler
This has to be called&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;SOFTDEVICE_HANDLER_INIT(NRF_CLOCK_LFCLKSRC_XTAL_20_PPM, NULL);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;before you call sd_ble_enable ofcourse with the whatever clock you want to select.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can I do pstorage store whit S120 scan start?</title><link>https://devzone.nordicsemi.com/thread/23819?ContentTypeID=1</link><pubDate>Wed, 29 Apr 2015 09:03:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6fcf54a2-2a74-43d0-b3f6-1e3df84f0949</guid><dc:creator>YeLun</dc:creator><description>&lt;p&gt;left here.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can I do pstorage store whit S120 scan start?</title><link>https://devzone.nordicsemi.com/thread/23833?ContentTypeID=1</link><pubDate>Wed, 29 Apr 2015 08:50:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9058816a-b5a7-4a44-bfa1-579dd34504ab</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;can you please add your main.c file&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can I do pstorage store whit S120 scan start?</title><link>https://devzone.nordicsemi.com/thread/23832?ContentTypeID=1</link><pubDate>Wed, 29 Apr 2015 08:48:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b9232437-4753-4a1a-b501-3e6732049f00</guid><dc:creator>YeLun</dc:creator><description>&lt;p&gt;Yes sure all those INIT codes have been added. And I tried pstorage store work will out of the ble_evt_dispatch().
Like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;static void weakup_meantimeout_handler(void * p_context)
{
    UNUSED_PARAMETER(p_context);
		pstorage_handle_t 		flash_handle;
		while (rx_count&amp;gt;=32){
						rx_count -= 32 ;
						pstorage_block_identifier_get(&amp;amp;flash_base_handle,pstorage_block_id, &amp;amp;flash_handle);
						if (!(flash_handle.block_id % 1024)) {
								err_code = pstorage_clear(&amp;amp;flash_handle,1024);
							}
						err_code = pstorage_store(&amp;amp;flash_handle, (uint8_t * )&amp;amp;tx_data+rx_count, 32, 0);
						pstorage_block_id++ ;
			}
}
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can I do pstorage store whit S120 scan start?</title><link>https://devzone.nordicsemi.com/thread/23831?ContentTypeID=1</link><pubDate>Wed, 29 Apr 2015 08:39:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e6d172ff-6387-4761-bfe8-89f03ae3b4fa</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;if pstorage_store returned without any errors and if you have registered your event handler for it, then it should work. Can you post the code where you register your event handler.
Have you done this&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;static void sys_evt_dispatch(uint32_t sys_evt)
{
    pstorage_sys_event_handler(sys_evt);
}

// Initialize SoftDevice
SOFTDEVICE_HANDLER_INIT(NRF_CLOCK_LFCLKSRC_XTAL_20_PPM, false);

// 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;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can I do pstorage store whit S120 scan start?</title><link>https://devzone.nordicsemi.com/thread/23830?ContentTypeID=1</link><pubDate>Wed, 29 Apr 2015 08:33:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:718add49-1db7-434e-ab90-7a6bf64f02b1</guid><dc:creator>YeLun</dc:creator><description>&lt;p&gt;Thanks,  But the pstorage_store cause nothing written in flash. No sys_evt happen, I trace the sys_evt_dispatch() . No faults.&lt;/p&gt;
&lt;p&gt;ANd if I move this codes out ble_evt_dispatch（）， then everything OK.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can I do pstorage store whit S120 scan start?</title><link>https://devzone.nordicsemi.com/thread/23829?ContentTypeID=1</link><pubDate>Wed, 29 Apr 2015 08:29:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:df0d223e-c931-493a-a85c-502d453d8867</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;yes you can without any problem. The dispatch is happening at SWI2 interrupt priority, just make sure that it is not using APP_PRIORITY_HIGH otherwise the SVC calls within pstorage will cause hardfaults.&lt;/p&gt;
&lt;h2&gt;update:&lt;/h2&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/4606.ble_5F00_app_5F00_beacon.zip"&gt;ble_app_beacon.zip&lt;/a&gt;
I have used this app to verify that pstorage event callbacks really occur even if you request them from the event handler.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>