<?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>LPC MicrocontrollersのトピックRe: LPC 4337 and 128Mb SDRAM</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC-4337-and-128Mb-SDRAM/m-p/613428#M23985</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Update...&lt;/P&gt;&lt;P&gt;If I step through the code one write and one read at a time the data appears to be good. &amp;nbsp;If I let the program run at all then the data gets corrupted.&lt;/P&gt;&lt;P&gt;If I add a delay between the write and the read the data gets corrupted.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;does this have something to do with the refresh rate?&lt;/P&gt;&lt;P&gt;anyone else have an issue like this? &amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 23 Mar 2017 22:36:39 GMT</pubDate>
    <dc:creator>michaeldenney</dc:creator>
    <dc:date>2017-03-23T22:36:39Z</dc:date>
    <item>
      <title>LPC 4337 and 128Mb SDRAM</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC-4337-and-128Mb-SDRAM/m-p/613427#M23984</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am using the LPC4337 LQFP144 &amp;nbsp;connecting to&amp;nbsp;IS42S16800F-7 &amp;nbsp;8Mx16 SDRAM chip.&lt;/P&gt;&lt;P&gt;I think I am setting up the EMC properly but I am not getting the results that I would expect. &amp;nbsp;Can anyone look at my setup and verify that I am not missing something.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;void SDRAM_Init(void)&lt;BR /&gt;{&lt;BR /&gt; uint32_t pclk;&lt;BR /&gt; uint32_t temp;&lt;BR /&gt; uint64_t tmpclk;&lt;BR /&gt; uint32_t tmp2;&lt;/P&gt;&lt;P&gt;// divide core clock by 2 to get approx 102 Mhz&lt;BR /&gt; LPC_CREG-&amp;gt;CREG6 |= (1 &amp;lt;&amp;lt; 16);&lt;BR /&gt; LPC_CCU1-&amp;gt;CLKCCU[CLK_MX_EMC_DIV].CFG |= (1 &amp;lt;&amp;lt; 5);&lt;BR /&gt; //LPC_SCU-&amp;gt;EMCDELAYCLK = 0x00006666;&lt;BR /&gt; pclk = Chip_Clock_GetEMCRate();&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LPC_EMC-&amp;gt;STATICWAITRD0 = NS2CLK(pclk,55); // select the delay from chip select 0 to a read access&lt;BR /&gt; LPC_EMC-&amp;gt;STATICCONFIG0 = 0x81; // select memory config for static chip select 0&lt;BR /&gt; LPC_EMC-&amp;gt;STATICWAITOEN0 = NS2CLK(pclk,10); // selects the delay from chip select 0 or address change to output enable&lt;BR /&gt; LPC_EMC-&amp;gt;STATICWAITWEN0 = NS2CLK(pclk, 10); // selects the delay from chip select 0 to write enable&lt;BR /&gt; LPC_EMC-&amp;gt;STATICWAITPAG0 = NS2CLK(pclk, 55); // selects the delay for async page mote access&lt;BR /&gt; LPC_EMC-&amp;gt;STATICWAITWR0 = NS2CLK(pclk, 55); // selects the delay from chip select 0 to a write access&lt;BR /&gt; LPC_EMC-&amp;gt;STATICWAITTURN0 = NS2CLK(pclk, 55); // selects the number of bus turnaround cycles for chip select 0&lt;/P&gt;&lt;P&gt;LPC_SCU-&amp;gt;SFSCLK[0] = (MD_PLN_FAST | SCU_MODE_FUNC5);&lt;BR /&gt; LPC_SCU-&amp;gt;SFSCLK[1] = MD_PLN_FAST;&lt;BR /&gt; LPC_SCU-&amp;gt;SFSCLK[2] = (MD_PLN_FAST | SCU_MODE_FUNC5);&lt;BR /&gt; LPC_SCU-&amp;gt;SFSCLK[3] = MD_PLN_FAST;&lt;/P&gt;&lt;P&gt;LPC_EMC-&amp;gt;CONTROL = 0x00000001;&lt;BR /&gt; LPC_EMC-&amp;gt;CONFIG = 0x00000000;&lt;BR /&gt; LPC_EMC-&amp;gt;DYNAMICCONFIG0 = &amp;nbsp;(1 &amp;lt;&amp;lt; 10) | (1 &amp;lt;&amp;lt; 7);&lt;/P&gt;&lt;P&gt;LPC_EMC-&amp;gt;DYNAMICRASCAS0 = 0x00000303;&lt;BR /&gt; LPC_EMC-&amp;gt;DYNAMICREADCONFIG = 0x00000003;&lt;/P&gt;&lt;P&gt;LPC_EMC-&amp;gt;DYNAMICRP = NS2CLK(pclk,20);&lt;BR /&gt; LPC_EMC-&amp;gt;DYNAMICRAS = NS2CLK(pclk,42);&lt;BR /&gt; LPC_EMC-&amp;gt;DYNAMICSREX = NS2CLK(pclk,63);&lt;/P&gt;&lt;P&gt;LPC_EMC-&amp;gt;DYNAMICAPR = 0x00000005;&lt;BR /&gt; LPC_EMC-&amp;gt;DYNAMICDAL = 0x00000005;&lt;BR /&gt; LPC_EMC-&amp;gt;DYNAMICWR = 2;&lt;BR /&gt; LPC_EMC-&amp;gt;DYNAMICRC = NS2CLK(pclk, 63);&lt;BR /&gt; LPC_EMC-&amp;gt;DYNAMICRFC = NS2CLK(pclk, 63);&lt;BR /&gt; LPC_EMC-&amp;gt;DYNAMICXSR = NS2CLK(pclk, 63);&lt;BR /&gt; LPC_EMC-&amp;gt;DYNAMICRRD = NS2CLK(pclk, 14);&lt;BR /&gt; LPC_EMC-&amp;gt;DYNAMICMRD = 0x00000002;&lt;/P&gt;&lt;P&gt;//Delay_us(100);&lt;BR /&gt; Delay_ms(100);&lt;BR /&gt; LPC_EMC-&amp;gt;DYNAMICCONTROL = 0x00000183; /* Issue NOP command */&lt;/P&gt;&lt;P&gt;//Delay_us(200); /* wait 200ms */&lt;BR /&gt; Delay_ms(200);&lt;BR /&gt; LPC_EMC-&amp;gt;DYNAMICCONTROL = 0x00000103; /* Issue PALL command */&lt;/P&gt;&lt;P&gt;LPC_EMC-&amp;gt;DYNAMICREFRESH = EMC_SDRAM_REFRESH(pclk, 70); /* ( n * 16 ) -&amp;gt; 32 clock cycles */&lt;/P&gt;&lt;P&gt;//for(i = 0; i &amp;lt; 0x80; i++); /* wait 128 AHB clock cycles */&lt;BR /&gt; Delay_ms(200); /* wait 200ms */&lt;BR /&gt; tmpclk = (uint64_t) 15625 * (uint64_t) pclk / 1000000000 / 16;&lt;BR /&gt; LPC_EMC-&amp;gt;DYNAMICREFRESH = tmpclk; /* ( n * 16 ) -&amp;gt; 736 clock cycles -&amp;gt; 15.330uS at 48MHz &amp;lt;= 15.625uS ( 64ms / 4096 row ) */&lt;/P&gt;&lt;P&gt;LPC_EMC-&amp;gt;DYNAMICCONTROL = 0x00000083; /* Issue MODE command */&lt;/P&gt;&lt;P&gt;temp = *((volatile uint32_t *) (SDRAM_ADDR_BASE | (3 &amp;lt;&amp;lt; 4 | 3 ) &amp;lt;&amp;lt; 12)); /* 8 burst, 3 CAS latency */&lt;/P&gt;&lt;P&gt;temp = temp;&lt;BR /&gt; LPC_EMC-&amp;gt;DYNAMICCONTROL = 0x00000000; /* Issue NORMAL command */&lt;/P&gt;&lt;P&gt;//[re]enable buffers&lt;BR /&gt; LPC_EMC-&amp;gt;DYNAMICCONFIG0 = (1 &amp;lt;&amp;lt; 19) | (1 &amp;lt;&amp;lt; 10) | (1 &amp;lt;&amp;lt; 7);&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Test function&lt;/P&gt;&lt;P&gt;uint16_t data = 0x0102;&lt;BR /&gt; uint16_t rdData;&lt;/P&gt;&lt;P&gt;uint16_t *short_wr_ptr;&lt;BR /&gt; short_wr_ptr = (uint16_t *) SDRAM_ADDR_BASE;&lt;BR /&gt; uint16_t *short_rd_ptr;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; short_rd_ptr = (uint16_t *) SDRAM_ADDR_BASE;&lt;/P&gt;&lt;P&gt;for (i=0; i&amp;lt;(0x01000000/2); i++)&lt;BR /&gt; {&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;*short_wr_ptr++ = data;&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;data += 0x0101;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;rdData = *short_rd_ptr;&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;if(rdData != 0x0102)&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;errorCount = i;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;The data seems to be getting corrupted early and and randomly. &amp;nbsp;By that I mean that within the first 14-400 writes my first address has been overwritten and it does not seem to correspond to any specific address line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help would be greatly appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;Michael Denney&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Mar 2017 16:53:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC-4337-and-128Mb-SDRAM/m-p/613427#M23984</guid>
      <dc:creator>michaeldenney</dc:creator>
      <dc:date>2017-03-23T16:53:26Z</dc:date>
    </item>
    <item>
      <title>Re: LPC 4337 and 128Mb SDRAM</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC-4337-and-128Mb-SDRAM/m-p/613428#M23985</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Update...&lt;/P&gt;&lt;P&gt;If I step through the code one write and one read at a time the data appears to be good. &amp;nbsp;If I let the program run at all then the data gets corrupted.&lt;/P&gt;&lt;P&gt;If I add a delay between the write and the read the data gets corrupted.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;does this have something to do with the refresh rate?&lt;/P&gt;&lt;P&gt;anyone else have an issue like this? &amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Mar 2017 22:36:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC-4337-and-128Mb-SDRAM/m-p/613428#M23985</guid>
      <dc:creator>michaeldenney</dc:creator>
      <dc:date>2017-03-23T22:36:39Z</dc:date>
    </item>
    <item>
      <title>Re: LPC 4337 and 128Mb SDRAM</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC-4337-and-128Mb-SDRAM/m-p/613429#M23986</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For those who may care,&lt;/P&gt;&lt;P&gt;The problems I had were related to interrupts (as is usually the case). I had a function in an interrupt that was reading and writing values to the flash. &amp;nbsp;Therefore my data was getting corrupted during my testing.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Mar 2017 23:44:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC-4337-and-128Mb-SDRAM/m-p/613429#M23986</guid>
      <dc:creator>michaeldenney</dc:creator>
      <dc:date>2017-03-28T23:44:29Z</dc:date>
    </item>
  </channel>
</rss>

