<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic K65F SDRAM configuration details in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/K65F-SDRAM-configuration-details/m-p/1232657#M59659</link>
    <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;We've got a TWR-K65F devel board, our custom board will be based on this later and we'll also put an SDRAM to it to satisfy our memory needs. Probably the SDRAM chip will be of different type, size, parameters etc. therefore I'm very focused on understanding &lt;STRONG&gt;all the details&lt;/STRONG&gt; of SDRAM interfacing, more precisely SDRAM controller configuration.&lt;/P&gt;&lt;P&gt;I checked this thoroughly:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-access-SDRAM-based-on-K65-SDRAM-controller/ta-p/1129000" target="_blank" rel="noopener"&gt;How-to-access-SDRAM-based-on-K65-SDRAM-controller/ta-p/1129000&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And also generated the SDRAM sample init code by MCUXpresso for TWR85F.&lt;/P&gt;&lt;P&gt;The only detail I don't understand presently is the correct setting of SDRAM_CM0 register. On TWR-K65F the memory chip has 4 banks, 2048 rows and 256 columns, and the data size is 32-bits (4 * 2048 * 256 * 4 = 8MB). Because of the 32-bit data size the 2 lowest bits of address are ignored. In the MCUXpresso code and in the referred PDF the memory base address is 0x80000000.&lt;/P&gt;&lt;P&gt;I simply don't understand how SDRAM_CM0 value of 0x007C0001 is got. More accurately, the 14-bit wide BAM (Base Address Mask) field is ambiguous to me, and I want to be able to&amp;nbsp;&lt;STRONG&gt;calculate it&lt;/STRONG&gt; &lt;STRONG&gt;by myself&lt;/STRONG&gt; (remember, we'll likely adapt a different SDRAM chip).&lt;/P&gt;&lt;P&gt;I only have one theory for calculation (frankly, I also don't believe this is right): 0x7C is binary 0111 1100. The 2 lowest bits are reserved, there 0, by "eliminating" them 11111 remains. This is decimal 31 which is quite close to the chip data size (32 bits).&lt;/P&gt;&lt;P&gt;Could you please someone clarify how to calculate CM0:BAM value knowing the base address (0x80000000), column width, row number, bank number, data size?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 18 Feb 2021 08:06:38 GMT</pubDate>
    <dc:creator>treefrog</dc:creator>
    <dc:date>2021-02-18T08:06:38Z</dc:date>
    <item>
      <title>K65F SDRAM configuration details</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/K65F-SDRAM-configuration-details/m-p/1232657#M59659</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;We've got a TWR-K65F devel board, our custom board will be based on this later and we'll also put an SDRAM to it to satisfy our memory needs. Probably the SDRAM chip will be of different type, size, parameters etc. therefore I'm very focused on understanding &lt;STRONG&gt;all the details&lt;/STRONG&gt; of SDRAM interfacing, more precisely SDRAM controller configuration.&lt;/P&gt;&lt;P&gt;I checked this thoroughly:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-access-SDRAM-based-on-K65-SDRAM-controller/ta-p/1129000" target="_blank" rel="noopener"&gt;How-to-access-SDRAM-based-on-K65-SDRAM-controller/ta-p/1129000&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And also generated the SDRAM sample init code by MCUXpresso for TWR85F.&lt;/P&gt;&lt;P&gt;The only detail I don't understand presently is the correct setting of SDRAM_CM0 register. On TWR-K65F the memory chip has 4 banks, 2048 rows and 256 columns, and the data size is 32-bits (4 * 2048 * 256 * 4 = 8MB). Because of the 32-bit data size the 2 lowest bits of address are ignored. In the MCUXpresso code and in the referred PDF the memory base address is 0x80000000.&lt;/P&gt;&lt;P&gt;I simply don't understand how SDRAM_CM0 value of 0x007C0001 is got. More accurately, the 14-bit wide BAM (Base Address Mask) field is ambiguous to me, and I want to be able to&amp;nbsp;&lt;STRONG&gt;calculate it&lt;/STRONG&gt; &lt;STRONG&gt;by myself&lt;/STRONG&gt; (remember, we'll likely adapt a different SDRAM chip).&lt;/P&gt;&lt;P&gt;I only have one theory for calculation (frankly, I also don't believe this is right): 0x7C is binary 0111 1100. The 2 lowest bits are reserved, there 0, by "eliminating" them 11111 remains. This is decimal 31 which is quite close to the chip data size (32 bits).&lt;/P&gt;&lt;P&gt;Could you please someone clarify how to calculate CM0:BAM value knowing the base address (0x80000000), column width, row number, bank number, data size?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Feb 2021 08:06:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/K65F-SDRAM-configuration-details/m-p/1232657#M59659</guid>
      <dc:creator>treefrog</dc:creator>
      <dc:date>2021-02-18T08:06:38Z</dc:date>
    </item>
    <item>
      <title>Re: K65F SDRAM configuration details</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/K65F-SDRAM-configuration-details/m-p/1233486#M59687</link>
      <description>&lt;P&gt;Hi treefrog,&lt;/P&gt;
&lt;P&gt;Actually, BAM means how many 256k size memory space is used by the SDRAM. If SDRAM_CM0=0x7c0001, the BAM is 0x1f. So, the address range is 256k*(31+1)=8M.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Jing&lt;/P&gt;</description>
      <pubDate>Fri, 19 Feb 2021 08:43:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/K65F-SDRAM-configuration-details/m-p/1233486#M59687</guid>
      <dc:creator>jingpan</dc:creator>
      <dc:date>2021-02-19T08:43:51Z</dc:date>
    </item>
    <item>
      <title>Re: K65F SDRAM configuration details</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/K65F-SDRAM-configuration-details/m-p/1233500#M59689</link>
      <description>&lt;P&gt;Many&amp;nbsp; thanks, it's quite simple.&lt;/P&gt;&lt;P&gt;(I think it'd worth adding this little bit of info to the CPU manual)&lt;/P&gt;</description>
      <pubDate>Fri, 19 Feb 2021 09:08:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/K65F-SDRAM-configuration-details/m-p/1233500#M59689</guid>
      <dc:creator>treefrog</dc:creator>
      <dc:date>2021-02-19T09:08:24Z</dc:date>
    </item>
  </channel>
</rss>

