<?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>xdata &amp;amp; sleep issue</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/32845/xdata-sleep-issue</link><description>Good morning, I want my nRF24LE1 to sleep &amp;amp; wake up (memory retention, timers on) while retaining data in xdata, but it&amp;#39;s not doing so. Please help!! Thanks, Mahesh 
 
 
 For example, there&amp;#39;s a 2D array, 
 
 uint8_t xdata _p_outbufs[5][32] 
 
 that does</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 24 Oct 2017 08:16:39 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/32845/xdata-sleep-issue" /><item><title>RE: xdata &amp; sleep issue</title><link>https://devzone.nordicsemi.com/thread/126277?ContentTypeID=1</link><pubDate>Tue, 24 Oct 2017 08:16:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6b2eb36b-3e9a-4218-8074-8090904cf650</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;quot;const&amp;quot; does not always mean that the variable is placed in flash in C, therefore the &amp;quot;code&amp;quot; is a 8051-specific keyword to force the value into flash.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;In your scenario, option 1 can be located in RAM, while option 2 shall be placed in flash.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: xdata &amp; sleep issue</title><link>https://devzone.nordicsemi.com/thread/126276?ContentTypeID=1</link><pubDate>Mon, 23 Oct 2017 15:53:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e9313fc6-8209-4fc2-b0d1-6aefe4d118f5</guid><dc:creator>mr_creosote</dc:creator><description>&lt;p&gt;Ahhhh... So&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;const int c[] = { 10,20,30};&lt;/p&gt;
&lt;p&gt;// means c, basically an int*, is read-only and stored in flash, BUT array contents are not, whereas,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;const code int c[] = { 10,20,30};&lt;/p&gt;
&lt;p&gt;// means c and array contents are both read-only and stored in flash.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Is my understanding correct?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks!!&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: xdata &amp; sleep issue</title><link>https://devzone.nordicsemi.com/thread/126275?ContentTypeID=1</link><pubDate>Mon, 23 Oct 2017 13:59:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9c23978f-ea09-4020-ade7-c7d3f918ac81</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You have 16kB of flash, and you have a lot less RAM.&lt;/p&gt;
&lt;p&gt;It is quite common to run out of RAM first, therefore; try placing most of your code in flash where you can (ie: arrays that are read-only for instance).&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: xdata &amp; sleep issue</title><link>https://devzone.nordicsemi.com/thread/126274?ContentTypeID=1</link><pubDate>Mon, 23 Oct 2017 13:41:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f0de9ca6-c190-4328-a5e6-6cca51407d11</guid><dc:creator>mr_creosote</dc:creator><description>&lt;p&gt;Hi Hakon, I hope all is well. what&amp;#39;s the value of putting code in flash? Thanks!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: xdata &amp; sleep issue</title><link>https://devzone.nordicsemi.com/thread/126273?ContentTypeID=1</link><pubDate>Mon, 27 Mar 2017 07:15:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a6bec4f3-2bbb-4cc4-9d34-e460ccc514e9</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi Mahesh,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You need to declare it as &amp;quot;const code&amp;quot; to place it in flash.&lt;/p&gt;
&lt;p&gt;Declaring a buffer like this will place it in xdata RAM:&lt;/p&gt;
&lt;p&gt;xdata uint8_t buf[size];&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: xdata &amp; sleep issue</title><link>https://devzone.nordicsemi.com/thread/126272?ContentTypeID=1</link><pubDate>Mon, 27 Mar 2017 07:12:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ee2bf38d-77e3-4a4f-b929-1c1e06916d28</guid><dc:creator>mr_creosote</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;Håkon,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;That&amp;#39;s what&amp;#39;s confusing. Code should be in flash. So what&amp;#39;s it doing in RAM? I understand the general way microcontrollers startup and hand off control to main(), but how does that involve code in RAM?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Mahesh&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: xdata &amp; sleep issue</title><link>https://devzone.nordicsemi.com/thread/126271?ContentTypeID=1</link><pubDate>Mon, 27 Mar 2017 06:24:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:94d35807-3208-4658-95dc-8de63c0c60d1</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi Mahesh,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Sorry for the late reply.&lt;/p&gt;
&lt;p&gt;Remember that your code in this case is placed in RAM, and RAM needs power to hold the content valid.&lt;/p&gt;
&lt;p&gt;Flash does not need power to hold it&amp;#39;s content.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;When you wake up, it depends on how your firmware is set up how you initialize values.&lt;/p&gt;
&lt;p&gt;You can read about startup code on keil&amp;#39;s website:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.keil.com/support/docs/1728.htm" target="_blank"&gt;http://www.keil.com/support/docs/1728.htm&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: xdata &amp; sleep issue</title><link>https://devzone.nordicsemi.com/thread/126270?ContentTypeID=1</link><pubDate>Wed, 22 Mar 2017 14:13:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f0cd9fb0-d4d1-4964-885f-e06afd519a2a</guid><dc:creator>mr_creosote</dc:creator><description>&lt;p&gt;Thanks Håkon! Also, why does code use a memory retentive block for? once the firmware is uploaded, isn&amp;#39;t it already retained? Thanks! Mahesh&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: xdata &amp; sleep issue</title><link>https://devzone.nordicsemi.com/thread/126269?ContentTypeID=1</link><pubDate>Wed, 22 Mar 2017 12:03:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cbca1304-6c60-4d05-9d48-98ccfb0bf338</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi Mahesh,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Only parts of the RAM is retained in memory retention mode (in order to save power), which is why you&amp;#39;ll need to place your buffer in the retained area of the RAM. If you want the full RAM to be powered in sleep, use RegisterRetention.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The RAM is powered off, then you cannot trust the content at all when it is powered on again, and you will get random values. I cannot give an explanation to why it was the same &amp;quot;garbage values&amp;quot;, but I suspect that if you add more functions or libraries, or change the behavior in any way, the &amp;quot;garbage values&amp;quot; would also change upon wakeup.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: xdata &amp; sleep issue</title><link>https://devzone.nordicsemi.com/thread/126268?ContentTypeID=1</link><pubDate>Wed, 22 Mar 2017 06:57:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:83fe886c-df49-4975-8544-cf7c9b8b4b4d</guid><dc:creator>mr_creosote</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Why does code need a memory retentive block? once the firmware is uploaded, isn&amp;#39;t it already retained?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;in the example i gave, prior to moving variables into the retentive area, all the values of&amp;nbsp;_p_outbufs[][] were set to 0x55, but were changed to a random-looking but specific data pattern (F4 F0 F0 F8...) which is always the same at every wake-up. what was actually happening? the pattern was not random.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;thanks,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;mahesh&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: xdata &amp; sleep issue</title><link>https://devzone.nordicsemi.com/thread/126267?ContentTypeID=1</link><pubDate>Tue, 21 Mar 2017 07:57:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:97e755c2-da82-4151-9ceb-0e6aebc0b765</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;B &amp;amp; C:&lt;/p&gt;
&lt;p&gt;Only half of the RAM (512 bytes of a total 1k) is retained in &amp;quot;memory retention&amp;quot;:&lt;/p&gt;
&lt;p&gt;&lt;em&gt;A special feature of the nRF24LE1 SRAM block is that it is composed of two physical 512 byte blocks called DataRetentive (lower 512 bytes) and DataNonRetentive.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;DataRetentive, in contrast to DataNonRetentive, keeps its memory content during the Memory Retention power down modes (see chapter 11 onpage 105).&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;DataRetentive is the retained block (powered block in PWRDWN=2 or 3), while the upper 512 bytes are turned off to lower power consumption.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you want all the RAM powered in sleep, I&amp;#39;d recommend to use &amp;quot;register retention&amp;quot; (PWRDWN=4;).&lt;/p&gt;
&lt;p&gt;RegisterRetention does not cause a reset upon wakeup either, which can be beneficial.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;E:&lt;/p&gt;
&lt;p&gt;The compiler should give you a warning, or possibly a linker error, if you try to do this.&lt;/p&gt;
&lt;p&gt;This would be the same as this:&lt;/p&gt;
&lt;p&gt;uint8_t xdata a[2] = {0xFF, EE};&lt;/p&gt;
&lt;p&gt;uint16_t xdata *b = a;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;And that should give b=0xEEFF.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The linker will organize your data to ensure that variables with the _at_ keyword is not conflicting with variables declared without it.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: xdata &amp; sleep issue</title><link>https://devzone.nordicsemi.com/thread/126266?ContentTypeID=1</link><pubDate>Tue, 21 Mar 2017 06:05:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dc055b01-8d4c-4517-9667-e4a081dc0843</guid><dc:creator>mr_creosote</dc:creator><description>&lt;p&gt;Hi, I was able to get retention using the _at_ keyword and moving variables, thanks!!! even so, could you still give me answers to the questions above? i believe the answers are:&lt;/p&gt;
&lt;p&gt;A. Yes.&lt;/p&gt;
&lt;p&gt;B. Yes.&lt;/p&gt;
&lt;p&gt;B. (should be C). i don&amp;#39;t know the answer to this -- why does code need a memory retentive block? isn&amp;#39;t all code already retained?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;C. why does this happen?&lt;/p&gt;
&lt;p&gt;D. Yes, that was the problem.&lt;/p&gt;
&lt;p&gt;E. if there&amp;#39;s an overlap between absolute placement of variables, the compiler raises a warning. does this mean that i could deliberately superimpose two variables, e.g.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;uint8_t xdata a[2] _at_ 0x004;&lt;/p&gt;
&lt;p&gt;uint16_t xdata b _at_ 0x004;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;a[0]=0xFF;&lt;/p&gt;
&lt;p&gt;a[1]=0xEE;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;the value of b will be 0xEEFF. is that correct?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: xdata &amp; sleep issue</title><link>https://devzone.nordicsemi.com/thread/126265?ContentTypeID=1</link><pubDate>Mon, 20 Mar 2017 18:14:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f868deab-4927-4d9c-aef1-0f2e155d40d6</guid><dc:creator>mr_creosote</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;Håkon,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;A. does Fig. 37 &amp;amp; table 26 mean that the 2 data blocks are *always* contiguous?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;B. please confirm: the blocks can be set to be EITHER location; there are NOT two sets of blocks at both 0x0000 - 0x03FF AND 0x8000 - 0x83FF. i have to choose one of the two.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;B. isn&amp;#39;t code already stored in non-volatile memory? what is the use of marking the SRAM data blocks as code?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;C. in the example i gave, all the values of&amp;nbsp;_p_outbufs[][] are set to 0x55, but get changed to a different data pattern (F4 F0 F0 F8...) which is always the same at every wake-up. it isn&amp;#39;t a random loss of memory. any idea what is actually happening?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;D. _p_outbufs starts at 0x020C in the .M51 file, which is outside the retentive range of 0x0000-0x01FF, if SRAM starts at 0x0000 by default. this might be my problem.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;E. i was looking at the _at_ keyword yesterday :-). please confirm: if i use the _at_ keyword, i&amp;#39;m responsible for any conflicts between THOSE variables. the compiler will handle the rest. so if i have two variables at the same absolute location, it won&amp;#39;t flag an error. this might be useful for union-like behavior.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Mahesh&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: xdata &amp; sleep issue</title><link>https://devzone.nordicsemi.com/thread/126264?ContentTypeID=1</link><pubDate>Mon, 20 Mar 2017 14:51:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:639fcb36-3ef9-4c45-9832-a13904fcfc83</guid><dc:creator>mr_creosote</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;Håkon,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;What is the memory range that&amp;#39;s retained? Could you take a look at the .M51 file i sent and see if the storage area for&amp;nbsp;_p_outbufs falls within that range?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Also, could you give me an example of using the _at_ keyword that falls within the retention range?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Mahesh&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: xdata &amp; sleep issue</title><link>https://devzone.nordicsemi.com/thread/126263?ContentTypeID=1</link><pubDate>Mon, 20 Mar 2017 11:44:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6d93a6e2-2a2e-43f6-82c6-e10baabba5e0</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Memory retention retains only the first 512 byte block of memory, while the upper 512 bytes are powered off. Here&amp;#39;s a snippet from chapter 7 in the PS:&lt;/p&gt;
&lt;p&gt;&lt;em&gt;A special feature of the nRF24LE1 SRAM block is that it is composed of two physical 512 byte blocks called DataRetentive (lower 512 bytes) and DataNonRetentive. &lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;DataRetentive, in contrast to DataNonRetentive, keeps its memory content during the Memory Retention power down modes (see chapter 11 onpage 105).&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Could you try absolute placement on the buffers that you need retained (using the &lt;a href="http://www.keil.com/support/man/docs/c51/c51_ap_at.htm" target="_blank"&gt;_at_ keyword&lt;/a&gt;)?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Cheers,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>