<?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>RAM retention issue</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/45106/ram-retention-issue</link><description>Hi, 
 I am using NRF52832 with softdevice s112 and SDK 15.3. I have 20 bytes of data which I want to retain in RAM during system off. I use the following code so that the data is not initialized. 
 uint8_t m_addl_adv_manuf_data[ADV_ADDL_MANUF_DATA_LEN</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 21 Mar 2019 17:37:36 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/45106/ram-retention-issue" /><item><title>RE: RAM retention issue</title><link>https://devzone.nordicsemi.com/thread/177676?ContentTypeID=1</link><pubDate>Thu, 21 Mar 2019 17:37:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e1acc805-e4f9-43e3-8ce2-ebf250eb8fa5</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi Jyoti,&lt;/p&gt;
[quote user="Jyoti"]But I do have the Segger RTT Viewer open to look at the log. Does that mean the program is running in debug interface mode?[/quote]
&lt;p&gt;Yes, RTT goes through the debug interface.&lt;/p&gt;
[quote user="Jyoti"]Also, I have evaluation version of keil, so I think scatter file will not work[/quote]
&lt;p&gt;That&amp;#39;s correct. You can&amp;#39;t edit the scatter file in the lite version. This is why I didn&amp;#39;t use the scatter file in the example I sent you.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;For&amp;nbsp;IAR it shouldn&amp;#39;t be necessary to create a new linker section. You can try to define your variable like this:&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;__no_init uint8_t&amp;nbsp;m_addl_adv_manuf_data[ADV_ADDL_MANUF_DATA_LEN]&lt;/span&gt;&lt;span&gt;&amp;nbsp;@ &amp;lt;RAM address&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;; (&lt;a href="https://www.iar.com/support/tech-notes/compiler/linker-error-for-absolute-located-variable/"&gt;IAR doc&lt;/a&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;Or if you chose to use Segger embedded Studio:&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;uint8_t m_addl_adv_manuf_data[ADV_ADDL_MANUF_DATA_LEN]&amp;nbsp; __attribute__&lt;/span&gt;&lt;span&gt;((&lt;/span&gt;&lt;span&gt;section&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&amp;quot;.non_init&amp;quot;&lt;/span&gt;&lt;span&gt;)));&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: RAM retention issue</title><link>https://devzone.nordicsemi.com/thread/177663?ContentTypeID=1</link><pubDate>Thu, 21 Mar 2019 16:11:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:137b31a4-b292-47fd-8748-5a752bf8c940</guid><dc:creator>Jyoti</dc:creator><description>&lt;p&gt;Hi Vidar,&lt;/p&gt;
&lt;p&gt;Thanks for the response and the example. I have not defined DEBUG in the project settings and I am not debugging the project from the IDE. But I do have the Segger RTT Viewer open to look at the log. Does that mean the program is running in debug interface mode?&lt;/p&gt;
&lt;p&gt;Also, I have evaluation version of keil, so I think scatter file will not work. How do I do the similar thing of creating IRAM2 in IAR?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Jyoti&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: RAM retention issue</title><link>https://devzone.nordicsemi.com/thread/177506?ContentTypeID=1</link><pubDate>Thu, 21 Mar 2019 09:13:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ab952297-f775-4ba4-aa02-ec43b087472a</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;Jyoti,&lt;/p&gt;
[quote user="Jyoti"]Thanks for the response. Does that mean that we do not need ram retention if&amp;nbsp;NRF52&amp;nbsp;just waking up from system off mode. As the RAM is not reset when waking up from system off then I can expect for it to retain it&amp;#39;s content.[/quote]
&lt;p&gt;Sorry, I meant to say that the RAM power settings are retained, not the RAM itself. RAM blocks are power gated in system OFF so you cannot expect data to be kept&amp;nbsp;without retention enabled.&amp;nbsp;Also, note that in debug interface mode the device will enter emulated system OFF mode, which means that RAM will remain&amp;nbsp;on. That could be another reason for why you didn&amp;#39;t have to enable retention in your test.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I have made an example based on the ble_app_uart project in sdk 15.3.0 with a &amp;quot;noinit&amp;quot; section placed at the end of RAM. The project is attached below along with some screenshots showing relevant project settings. Hope this helps.&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Adding IRAM2 for NoInit data:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x240/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-cd323c1c465247739237e44df06ccf34/new-RAM-section-for-to-keep-non-initalized-data.PNG" /&gt;&lt;/p&gt;
&lt;p&gt;I have not found a way to selectively chose which variables to place in NoInit without touching the Scatter file so&amp;nbsp; l defined the&amp;nbsp;&lt;span&gt;m_addl_adv_manuf_data variable in a separate source file:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x240/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-cd323c1c465247739237e44df06ccf34/place-zero-initialized-data-in-IRAM2.PNG" /&gt;&lt;/p&gt;
&lt;p&gt;And the *.map file confirms that m_addl_adv_manuf_data got placed in IRAM2&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-cd323c1c465247739237e44df06ccf34/map-file.PNG" /&gt;&lt;/p&gt;
&lt;p&gt;Example project.&amp;nbsp;You can test it by performing the following steps:&lt;/p&gt;
&lt;p&gt;1.&amp;nbsp;Extract zip and copy it to&amp;nbsp;\nRF5_SDK_15.3.0_59ac345\examples\ble_peripheral. Compile and program&lt;/p&gt;
&lt;p&gt;2. Power cycle the board to ensure that the chip goes out of debugging mode&lt;/p&gt;
&lt;p&gt;3. Open a serial client and open the Jlink COM port (assuming you have a DK)&lt;/p&gt;
&lt;p&gt;4. The app will enter system OFF mode after 5 seconds of advertising&lt;/p&gt;
&lt;p&gt;5. Wait 5 seconds and press button 1 on the DK for wake-up&lt;/p&gt;
&lt;p&gt;6.&amp;nbsp;You should see the &amp;quot;Valid data in no init section&amp;quot; message in the UART log if the data&amp;nbsp;was retained.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-cd323c1c465247739237e44df06ccf34/ble_5F00_app_5F00_uart_5F00_w_5F00_ram_5F00_retention_5F00_test.zip"&gt;devzone.nordicsemi.com/.../ble_5F00_app_5F00_uart_5F00_w_5F00_ram_5F00_retention_5F00_test.zip&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: RAM retention issue</title><link>https://devzone.nordicsemi.com/thread/177441?ContentTypeID=1</link><pubDate>Wed, 20 Mar 2019 16:34:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d9e52220-46a8-47de-a6a6-6367cb3f71c3</guid><dc:creator>awneil</dc:creator><description>[quote userid="77452" url="~/f/nordic-q-a/45106/ram-retention-issue/177424"]I am using Keil. How do I know if it is placed correctly in non initialized section?[/quote]
&lt;p&gt;Check the Linker Map file.&lt;/p&gt;
[quote userid="77452" url="~/f/nordic-q-a/45106/ram-retention-issue/177424"]what is the correct way of putting it on non initialized section?[/quote]
&lt;p&gt;Whatever it is would not be specific to Nordic - so check Keil documentation.&lt;/p&gt;
&lt;p&gt;Search the Keil forum:&amp;nbsp;&lt;a href="http://www.keil.com/forum/"&gt;http://www.keil.com/forum/&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: RAM retention issue</title><link>https://devzone.nordicsemi.com/thread/177424?ContentTypeID=1</link><pubDate>Wed, 20 Mar 2019 15:56:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:babf614c-cb28-4030-bca8-677155ff2dd8</guid><dc:creator>Jyoti</dc:creator><description>&lt;p&gt;Hi Vidar,&lt;/p&gt;
&lt;p&gt;Thanks for the response. Does that mean that we do not need ram retention if&amp;nbsp;NRF52&amp;nbsp;just waking up from system off mode. As the RAM is not reset when waking up from system off then I can expect for it to retain it&amp;#39;s content.&lt;/p&gt;
&lt;p&gt;I am using Keil. How do I know if it is placed correctly in non initialized section? what is the correct way of putting it on non initialized section?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Jyoti&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: RAM retention issue</title><link>https://devzone.nordicsemi.com/thread/177383?ContentTypeID=1</link><pubDate>Wed, 20 Mar 2019 14:28:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:af6d7484-a024-4a5c-94fb-e5a124a95fe5</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi Jyoti,&lt;/p&gt;
&lt;p&gt;The power settings are retained until you power cycle the chip, maybe that could explain why you didn&amp;#39;t have to enable retention for the second test.&lt;/p&gt;
&lt;p&gt;Are you using Keil/SES or GCC? I wonder if the&amp;nbsp;m_addl_adv_manuf_data variable gets placed correctly in a &amp;quot;non initialized&amp;quot; section since it seems to work when you use&amp;nbsp;RAM_MEMORY_TEST_ADDRESS pointer.&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>