<?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>nRF52840 - Understanding RAM AHB slaves and sections.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/64907/nrf52840---understanding-ram-ahb-slaves-and-sections</link><description>Hi everyone, 
 I am trying to understand the Memory layout of nRF52840 SOC in order to apply RAM retention into specific section. Looking the memory layout at pg 21 of the datasheet I can see 9 x ARM AHB slaves with total of 22 sections. 
 
 Then on pages</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 20 Aug 2020 21:44:53 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/64907/nrf52840---understanding-ram-ahb-slaves-and-sections" /><item><title>RE: nRF52840 - Understanding RAM AHB slaves and sections.</title><link>https://devzone.nordicsemi.com/thread/265626?ContentTypeID=1</link><pubDate>Thu, 20 Aug 2020 21:44:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fa72c7d3-a795-4981-9917-85aa5c465c24</guid><dc:creator>Nikosant03</dc:creator><description>&lt;p&gt;Could I re-open this thread?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 - Understanding RAM AHB slaves and sections.</title><link>https://devzone.nordicsemi.com/thread/265560?ContentTypeID=1</link><pubDate>Thu, 20 Aug 2020 12:45:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fc842aa3-c496-4e53-9529-d8b1ce5a5670</guid><dc:creator>Nikosant03</dc:creator><description>&lt;p&gt;Thank you for your support Einar!!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 - Understanding RAM AHB slaves and sections.</title><link>https://devzone.nordicsemi.com/thread/265539?ContentTypeID=1</link><pubDate>Thu, 20 Aug 2020 11:49:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:887e61a5-3cb6-4eac-96bb-e2cac291f85c</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Your understanding is correct.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 - Understanding RAM AHB slaves and sections.</title><link>https://devzone.nordicsemi.com/thread/265349?ContentTypeID=1</link><pubDate>Wed, 19 Aug 2020 13:44:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:63e8f83c-4f7b-415a-ac50-e8b8e3bccd61</guid><dc:creator>Nikosant03</dc:creator><description>&lt;p&gt;Thank you for your effort Einar&lt;/p&gt;
[quote userid="7377" url="~/f/nordic-q-a/64907/nrf52840---understanding-ram-ahb-slaves-and-sections/265320"]So for section 0, bit in position 0 controls if the section is on or off in system ON mode, and bit in position 16 controls weather it is on of off in system OFF mode. For section 1 this would be bit positions 1 and 17 respectively.[/quote]
&lt;p&gt;So, If I have understood correctly for&amp;nbsp;&lt;span&gt;AHB slave index 0-7 there are only two sections and the assosiated bit positions are 0,1,16,17 while for AHB slave index 8 there are six sections and the assosiated bit positions are 0,1,2,3,4,5,16,17,18,19,20,21 &lt;strong&gt;right&lt;/strong&gt;?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;So, actually the bits 6-15 &amp;amp; 22-31 of&amp;nbsp;RAM[n].POWER register have no affect and I won&amp;#39;t need them anywhere &lt;strong&gt;right&lt;/strong&gt;?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 - Understanding RAM AHB slaves and sections.</title><link>https://devzone.nordicsemi.com/thread/265320?ContentTypeID=1</link><pubDate>Wed, 19 Aug 2020 12:36:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ec12e354-bc21-49e6-861e-c61895ad91f4</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi Nick,&lt;/p&gt;
[quote user="Nikosant03"]1. Section 0 &amp;amp; Section 1 of RAM1 which field (S[i]) within POWER register represent?[/quote]
&lt;p&gt;This is unfortunately not clearly documented in the PS, but you can refer to the&amp;nbsp;components\device\nrf52840_bitfields.h file to see this. There you can see a some relevant defines for this question:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/* Bit 17 : Keep retention on RAM section S1 when RAM section is in OFF */
#define POWER_RAM_POWER_S1RETENTION_Pos (17UL) /*!&amp;lt; Position of S1RETENTION field. */
#define POWER_RAM_POWER_S1RETENTION_Msk (0x1UL &amp;lt;&amp;lt; POWER_RAM_POWER_S1RETENTION_Pos) /*!&amp;lt; Bit mask of S1RETENTION field. */
#define POWER_RAM_POWER_S1RETENTION_Off (0UL) /*!&amp;lt; Off */
#define POWER_RAM_POWER_S1RETENTION_On (1UL) /*!&amp;lt; On */

/* Bit 16 : Keep retention on RAM section S0 when RAM section is in OFF */
#define POWER_RAM_POWER_S0RETENTION_Pos (16UL) /*!&amp;lt; Position of S0RETENTION field. */
#define POWER_RAM_POWER_S0RETENTION_Msk (0x1UL &amp;lt;&amp;lt; POWER_RAM_POWER_S0RETENTION_Pos) /*!&amp;lt; Bit mask of S0RETENTION field. */
#define POWER_RAM_POWER_S0RETENTION_Off (0UL) /*!&amp;lt; Off */
#define POWER_RAM_POWER_S0RETENTION_On (1UL) /*!&amp;lt; On */

...

/* Bit 1 : Keep RAM section S1 ON or OFF in System ON mode. */
#define POWER_RAM_POWER_S1POWER_Pos (1UL) /*!&amp;lt; Position of S1POWER field. */
#define POWER_RAM_POWER_S1POWER_Msk (0x1UL &amp;lt;&amp;lt; POWER_RAM_POWER_S1POWER_Pos) /*!&amp;lt; Bit mask of S1POWER field. */
#define POWER_RAM_POWER_S1POWER_Off (0UL) /*!&amp;lt; Off */
#define POWER_RAM_POWER_S1POWER_On (1UL) /*!&amp;lt; On */

/* Bit 0 : Keep RAM section S0 ON or OFF in System ON mode. */
#define POWER_RAM_POWER_S0POWER_Pos (0UL) /*!&amp;lt; Position of S0POWER field. */
#define POWER_RAM_POWER_S0POWER_Msk (0x1UL &amp;lt;&amp;lt; POWER_RAM_POWER_S0POWER_Pos) /*!&amp;lt; Bit mask of S0POWER field. */
#define POWER_RAM_POWER_S0POWER_Off (0UL) /*!&amp;lt; Off */
#define POWER_RAM_POWER_S0POWER_On (1UL) /*!&amp;lt; On */&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;So for section 0, bit in position 0 controls if the section is on or off in system ON mode, and bit in position 16 controls weather it is on of off in system OFF mode. For section 1 this would be bit positions 1 and 17 respectively.&lt;/p&gt;
[quote user="Nikosant03"]2. Using the s140 API for RAM retention, is the snippet below correct in order to put RAM2 AHB slave section 0 in retention?[/quote]
&lt;p&gt;No.&amp;nbsp;The AHB slave index is correct, but you are referring to section 2 in this case (which does not exist), as you use&amp;nbsp;POWER_RAM_POWER_S2RETENTION_Pos (and&amp;nbsp;POWER_RAM_POWER_S2RETENTION_On, though that does not really matter as it is just 1 in any case). You should have used&amp;nbsp;POWER_RAM_POWER_S0RETENTION_On and&amp;nbsp;POWER_RAM_POWER_S0RETENTION_Pos. Other than that it is correct.&lt;/p&gt;
&lt;p&gt;Br,&lt;/p&gt;
&lt;p&gt;Einar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 - Understanding RAM AHB slaves and sections.</title><link>https://devzone.nordicsemi.com/thread/265121?ContentTypeID=1</link><pubDate>Tue, 18 Aug 2020 13:20:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:12f405f8-f7a3-4e68-8229-ce8743f0c80b</guid><dc:creator>Nikosant03</dc:creator><description>&lt;p&gt;Thank you for your answer Einar&lt;/p&gt;
[quote userid="7377" url="~/f/nordic-q-a/64907/nrf52840---understanding-ram-ahb-slaves-and-sections/265090"]And the section (S) field within each POWER register instance represents a section within that slave[/quote]
&lt;p&gt;How does it represented? For example, n=0 represents RAM0 and looking the RAM layout I see that RAM0 has two sections (Section 0 &amp;amp; Section 1) but the&amp;nbsp;&lt;span&gt;section (S) field within each POWER register instance could be 0-15 (it shouldn&amp;#39;t be 0-1?)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;1. Section 0 &amp;amp; Section 1 of RAM1 which field (S[i]) within POWER register represent?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;2. Using the s140 API for RAM retention, is the snippet below correct in order to put RAM2 AHB slave section 0 in retention?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#define RAM_AHB_slave 2

ret_code_t err_code;
err_code = sd_power_ram_power_set(RAM_AHB_slave, POWER_RAM_POWER_S2RETENTION_On &amp;lt;&amp;lt; POWER_RAM_POWER_S2RETENTION_Pos);
APP_ERROR_CHECK(err_code);&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1597756418586v1.png" alt=" " /&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840 - Understanding RAM AHB slaves and sections.</title><link>https://devzone.nordicsemi.com/thread/265090?ContentTypeID=1</link><pubDate>Tue, 18 Aug 2020 12:23:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cb203e31-09b5-4f22-a18a-849a3383ebd6</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi Nick,&lt;/p&gt;
&lt;p&gt;It is not easy to see from the product specification, but each instance of the&amp;nbsp;RAM[n].POWER register represents an AHB slave (n = 0, represents RAM0,&amp;nbsp;n = 1, represents RAM1, ...). And the section (S) field within each POWER register instance represents a section within that slave. You can refer to &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/39396/nrf52840-ram-retention-in-system-on-mode/152628#152628"&gt;this post&lt;/a&gt; to see a code snippet that powers down all sections.&lt;/p&gt;
&lt;p&gt;Einar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>