<?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>pstorage_register return error when I try with more than 1024 bytes (block_size * block_count)</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/9172/pstorage_register-return-error-when-i-try-with-more-than-1024-bytes-block_size-block_count</link><description>my chip : NRF51822 (256kb)
SDK : 6.1 
 Hi. 
 devzone.nordicsemi.com/.../ 
 according to this example code, I could have stored data and it works great. 
 but problem is, I need to store more storage.
but it gives NRF_ERROR_INVALID_PARAM error-code</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 11 Sep 2015 13:39:47 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/9172/pstorage_register-return-error-when-i-try-with-more-than-1024-bytes-block_size-block_count" /><item><title>RE: pstorage_register return error when I try with more than 1024 bytes (block_size * block_count)</title><link>https://devzone.nordicsemi.com/thread/33802?ContentTypeID=1</link><pubDate>Fri, 11 Sep 2015 13:39:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bbc09d19-7406-4deb-a8bc-4727e80236a1</guid><dc:creator>benevbright</dc:creator><description>&lt;p&gt;Thanks all you guys. have a good day!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: pstorage_register return error when I try with more than 1024 bytes (block_size * block_count)</title><link>https://devzone.nordicsemi.com/thread/33801?ContentTypeID=1</link><pubDate>Fri, 11 Sep 2015 13:29:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fedcc550-3135-4925-9a97-28770caef342</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;totally depends on how much persistant memory your application needs.
PSTORAGE_MAX_APPLICATIONS boils down to &amp;quot;number of pages your application needs&amp;quot;.
So if your application needs X*1024 bytes of memory, then PSTRORAGE_MAX_APPLICATIONS must be set to X.&lt;/p&gt;
&lt;p&gt;It is not safe to set it to higher value if you do not need it, that might hide your application bugs and even corrupt the memory without pstorage library being able to detect it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: pstorage_register return error when I try with more than 1024 bytes (block_size * block_count)</title><link>https://devzone.nordicsemi.com/thread/33800?ContentTypeID=1</link><pubDate>Fri, 11 Sep 2015 13:09:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f9ae1f4f-b5cb-413e-9bdc-2cc3c5dde70c</guid><dc:creator>benevbright</dc:creator><description>&lt;p&gt;and I finally discovered. PSTORAGE_MAX_APPLICATIONS caused all.
it&amp;#39;s value set as 1. and I changed it like 20.
and I could call pstorage_register with more data.
now my questions is what&amp;#39;s the safe number of PSTORAGE_MAX_APPLICATIONS?&lt;/p&gt;
&lt;p&gt;Thanks.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: pstorage_register return error when I try with more than 1024 bytes (block_size * block_count)</title><link>https://devzone.nordicsemi.com/thread/33799?ContentTypeID=1</link><pubDate>Fri, 11 Sep 2015 12:40:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a9c9b401-e4b0-47f2-8b8d-4e704e6199a7</guid><dc:creator>benevbright</dc:creator><description>&lt;p&gt;RK, Thanks for your advice.
as you said, I looked code and found what makes return error.&lt;/p&gt;
&lt;p&gt;there is&lt;/p&gt;
&lt;p&gt;BLOCK_COUNT_CHECK(COUNT, SIZE)                                                            &lt;br /&gt;
if (((COUNT) == 0) || ((m_next_page_addr + ((COUNT) *(SIZE)) &amp;gt; PSTORAGE_DATA_END_ADDR)))  &lt;br /&gt;
{                                                                                         &lt;br /&gt;
return NRF_ERROR_INVALID_PARAM;                                                       &lt;br /&gt;
}&lt;/p&gt;
&lt;p&gt;------ I debug it.
m_next_page_addr : 260096
PSTORAGE_DATA_END_ADDR : 261120&lt;/p&gt;
&lt;p&gt;that was why.
it&amp;#39;s very small.
It there any option to make more room for pStorage?&lt;/p&gt;
&lt;p&gt;Thanks.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: pstorage_register return error when I try with more than 1024 bytes (block_size * block_count)</title><link>https://devzone.nordicsemi.com/thread/33798?ContentTypeID=1</link><pubDate>Fri, 11 Sep 2015 07:44:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:be39c5f3-cb1c-4cbd-aeac-b3dcbc8783ac</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;well step through the code into the pstorage_register() function and see where it&amp;#39;s returning the param error, it&amp;#39;s only 20 lines long.&lt;/p&gt;
&lt;p&gt;Page aligned means that one page must be an integral number of blocks, ie no block spans two pages. Since a page is 1024 bytes, a block size of 16 is page-aligned.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: pstorage_register return error when I try with more than 1024 bytes (block_size * block_count)</title><link>https://devzone.nordicsemi.com/thread/33796?ContentTypeID=1</link><pubDate>Fri, 11 Sep 2015 06:31:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ab84f909-5d94-481d-b842-f8db65d15a8e</guid><dc:creator>benevbright</dc:creator><description>&lt;p&gt;above link says &amp;quot;Also, when registering for more than a single page, registered blocks must be page aligned.&amp;quot;
What does this mean?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: pstorage_register return error when I try with more than 1024 bytes (block_size * block_count)</title><link>https://devzone.nordicsemi.com/thread/33797?ContentTypeID=1</link><pubDate>Fri, 11 Sep 2015 05:55:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:54bf75d2-199c-40ce-8560-84a632d18ed5</guid><dc:creator>benevbright</dc:creator><description>&lt;p&gt;Hi, Thanks for your answer.
but sample code from link I attached is registering 128 * 12 byte size. (In my case, that size returns error)
and there is no difference between my code.
I don&amp;#39;t understand how this possible.&lt;/p&gt;
&lt;p&gt;as you said. There is comment &amp;quot;multiple page&amp;quot; something on sample code.&lt;/p&gt;
&lt;p&gt;but I found nothing special from sample code.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: pstorage_register return error when I try with more than 1024 bytes (block_size * block_count)</title><link>https://devzone.nordicsemi.com/thread/33795?ContentTypeID=1</link><pubDate>Fri, 11 Sep 2015 05:28:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d73648d2-a3b2-49c9-b3b1-417ad3f1488a</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;You just need to look at the pstorage code. The maximum block size is the same as the maximum amount which can be written by sd_flash_write() which is 256 x 32 bit words which is 1024. That&amp;#39;s also the size of one page in the nrf51.&lt;/p&gt;
&lt;p&gt;So if you want to write more data, you&amp;#39;ll need to chunk it up into multiple writes.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>