<?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>Reliable method to clear device RAM</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/107899/reliable-method-to-clear-device-ram</link><description>Hello, 
 I have a board based on NRF52833 mcu. In this project, for pin reset case I want to clear all data in RAM and do a s/w reset of the device. I tried to power off RAM sections and disable RAM retenetion for all RAM blocks by configuring RAM[n]</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 31 Jan 2024 15:14:05 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/107899/reliable-method-to-clear-device-ram" /><item><title>RE: Reliable method to clear device RAM</title><link>https://devzone.nordicsemi.com/thread/466982?ContentTypeID=1</link><pubDate>Wed, 31 Jan 2024 15:14:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:409f3906-8db8-46fd-b825-ab6a4f7262db</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The hardfault is expected, as the CPU is trying to access RAM that is turned off/corrupted. The stack is stored in RAM and are used by function calls.&lt;/p&gt;
&lt;p&gt;Turning off the power to the RAM does not guarantee that it is cleared. As described in&amp;nbsp;&lt;a title="Reset behavior" href="https://infocenter.nordicsemi.com/topic/ps_nrf52833/power.html?cp=5_1_0_4_2_5_7#concept_res_behav"&gt;Reset behavior&lt;/a&gt;, &amp;quot;&lt;span&gt;The RAM is never reset, but depending on a reset source the content of RAM may be corrupted.&amp;quot;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;If you want to be sure that RAM is cleared, you can use memset() function, but you need to be careful to not corrupt the stack, as this will cause crash. Input a pointer to the RAM start address where you want to start clearing, set the second parameter to the value you want in RAM (e.g. 0x00), and set the last parameter to the size you want to clear.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;br /&gt;Jørgen&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>