<?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 Re: SDRAM Mode register configuration in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/SDRAM-Mode-register-configuration/m-p/810989#M32526</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Andrea Scauri,&lt;BR /&gt;Thank you for your interest in NXP Semiconductor products and for the opportunity to serve you.&lt;BR /&gt;To provide the fastest possible support, I'd highly recommend you to refer to the periph_memtest demo in LPCOpen library to adjust the SDRAM initialization code, then taking a testing later.&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://www.nxp.com/support/developer-resources/software-development-tools/lpc-developer-resources-/lpcopen-libraries-and-examples/lpcopen-software-development-platform-lpc17xx:LPCOPEN-SOFTWARE-FOR-LPC17XX" title="https://www.nxp.com/support/developer-resources/software-development-tools/lpc-developer-resources-/lpcopen-libraries-and-examples/lpcopen-software-development-platform-lpc17xx:LPCOPEN-SOFTWARE-FOR-LPC17XX"&gt;LPCOpen Software for LPC17XX|NXP&lt;/A&gt; &lt;BR /&gt;Have a great day,&lt;BR /&gt;TIC&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 06 Aug 2018 02:05:49 GMT</pubDate>
    <dc:creator>jeremyzhou</dc:creator>
    <dc:date>2018-08-06T02:05:49Z</dc:date>
    <item>
      <title>SDRAM Mode register configuration</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/SDRAM-Mode-register-configuration/m-p/810988#M32525</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello.&lt;/P&gt;&lt;P&gt;I have a problem during initialization of the SDRAM with set mode register :&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;wtemp =*(volatile unsigned int *)(DYNAMIC_MEM0_BASE+(MODE_REGISTER &amp;lt;&amp;lt; (COL+TBW+BANK)));&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;sometime the execution block in this code line so&amp;nbsp;much to trigger watchdog.&lt;/P&gt;&lt;P&gt;Does anyone have any idea what it could be?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SDRAM:&amp;nbsp;MT48LC16M16A2P-75&lt;/P&gt;&lt;P&gt;MPU: LPC1778&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Complete SDRAM init code&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;uint32_t i, wtemp;&lt;/P&gt;&lt;P&gt;DbgUart2("&amp;gt; %s\n",__FUNCTION__);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; SCS &amp;amp;=~BIT(1); //EMC reset when any resert occures // era EMC Shift Control&lt;/P&gt;&lt;P&gt;PCONP |= PCONP_PCEMC; // BIT(11); // Turn ON EMC PCLK&lt;/P&gt;&lt;P&gt;//EMC_DYN_RD_CFG = 0; // michele&lt;/P&gt;&lt;P&gt;EMCDLYCTL=0x00001010;&lt;/P&gt;&lt;P&gt;// Init SDRAM controller&lt;BR /&gt; EMC_CTRL = 1;// enable EMC&lt;BR /&gt; EMC_CONFIG = 0;&lt;/P&gt;&lt;P&gt;EMC_DYN_CFG0= ( (0uL &amp;lt;&amp;lt; 14) | (0uL &amp;lt;&amp;lt; 12) | (Sel9 &amp;lt;&amp;lt; 9) | (Sel7 &amp;lt;&amp;lt; 7));&lt;/P&gt;&lt;P&gt;/*Dynamic Memory RAS &amp;amp; CAS Delay registers&lt;BR /&gt; * 3 CAS PCLK cycles&lt;BR /&gt; * 3 RAS PCLK cycles&lt;BR /&gt; */&lt;BR /&gt; EMC_DYN_RASCAS0 = (CAS &amp;lt;&amp;lt; CAS_BIT) | (3uL &amp;lt;&amp;lt; RAS_BIT);&lt;/P&gt;&lt;P&gt;//EMCDynamicReadConfig&lt;BR /&gt; EMC_DYN_RD_CFG = 1;&lt;/P&gt;&lt;P&gt;/*&lt;BR /&gt; * Dynamic Memory Percentage Command Period register&lt;BR /&gt; * The EMCDynamicTRP register enables you to program the precharge command period,&lt;BR /&gt; * tRP. This register must only be modified during system initialization. This value is normally&lt;BR /&gt; * found in SDRAM data sheets as tRP. This register is accessed with one wait state&lt;BR /&gt; */&lt;BR /&gt; EMC_DYN_RP = P2C(SDRAM_TRP); // EMCDynamictRP&lt;BR /&gt; EMC_DYN_RAS = P2C(SDRAM_TRAS); // EMCDynamictRAS&lt;BR /&gt; EMC_DYN_SREX = P2C(SDRAM_TXSR); // EMCDynamictSREX Self Refresh Exit Time&lt;BR /&gt; EMC_DYN_APR = SDRAM_TAPR; // EMCDynamictDAL // Last Data Out to Active Time&lt;BR /&gt; EMC_DYN_DAL = SDRAM_TDAL + P2C(SDRAM_TRP); // Data in to Active Command Time&lt;BR /&gt; EMC_DYN_WR = SDRAM_TWR; // EMCDynamictWR // Write Recovery Time&lt;BR /&gt; EMC_DYN_RC = P2C(SDRAM_TRC); // EMCDynamictRC // Active to Active command Period&lt;BR /&gt; EMC_DYN_RFC = P2C(SDRAM_TRFC); // EMCDynamictRFC // Auto Refresh Period&lt;BR /&gt; EMC_DYN_XSR = P2C(SDRAM_TXSR); // EMCDynamictXSR // Exit Self Refresh&lt;BR /&gt; EMC_DYN_RRD = P2C(SDRAM_TRRD); // EMCDynamictRRD // Active Bank A to Active Bank B Time&lt;BR /&gt; EMC_DYN_MRD = SDRAM_TMRD; // EMCDynamictMRD = SDRAM_TMRD; // Load mode register to Active Command Time&lt;/P&gt;&lt;P&gt;Delay_uS(100*MSEC);&lt;/P&gt;&lt;P&gt;//Send command: NOP&lt;BR /&gt; EMC_DYN_CTRL = 3 | (3&amp;lt;&amp;lt;7);&lt;/P&gt;&lt;P&gt;// Mem clk enable, CLKOUT runs, send command: NOP&lt;BR /&gt; Delay_uS(200*MSEC);&lt;/P&gt;&lt;P&gt;//Send command: PRECHARGE-ALL, shortest possible refresh period&lt;BR /&gt; EMC_DYN_CTRL = 3 | (2&amp;lt;&amp;lt;7);&lt;BR /&gt; EMC_DYN_RFSH = 0x00000002;&lt;/P&gt;&lt;P&gt;//wait at least 128 ABH clock cycles&lt;BR /&gt; for(i=0; i&amp;lt;0x80; i++)&lt;BR /&gt; asm volatile(" nop");&lt;BR /&gt; //Delay_uS(100*MSEC);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; /*&lt;BR /&gt; * Some systems refresh every row in a burst of activity involving all rows every 64 mS.&lt;BR /&gt; * Other systems refresh one row at a time staggered through out the 64 mS interval.&lt;BR /&gt; * For example, a system with 2^13 = 8192 rows would require a staggered refresh rate of one row&lt;BR /&gt; * every 7.8 µs which is 64 ms divided by 8192 rows&lt;BR /&gt; */&lt;/P&gt;&lt;P&gt;/* set 28 x 16CCLKs=448CCLK=7us between SDRAM refresh cycles */&lt;BR /&gt; EMC_DYN_RFSH = P2C(SDRAM_REFRESH) &amp;gt;&amp;gt; 4;&lt;/P&gt;&lt;P&gt;DbgUart2("1 WDTC: %d, TV %d \n", WDTC, WDTV);&lt;/P&gt;&lt;P&gt;/* To set mode register in SDRAM, enter mode by issue&lt;BR /&gt; MODE command, after finishing, bailout and back to NORMAL mode. */&lt;/P&gt;&lt;P&gt;//Send command: MODE&lt;BR /&gt; EMC_DYN_CTRL = 3 | (1&amp;lt;&amp;lt;7);&lt;/P&gt;&lt;P&gt;DbgUart2("2 WDTC: %d, TV %d \n", WDTC, WDTV);&lt;BR /&gt; /* Set mode register in SDRAM */&lt;BR /&gt; /* Mode regitster table for Micron's MT48LCxx */&lt;BR /&gt; /* bit 9: Programmed burst length(0)&lt;BR /&gt; bit 8~7: Normal mode(0)&lt;BR /&gt; bit 6~4: CAS latency 3&lt;BR /&gt; bit 3: Sequential(0)&lt;BR /&gt; bit 2~0: Burst length is 8&lt;/P&gt;&lt;P&gt;You may calculate the shift value for "high-performance" SDRAM using this&lt;BR /&gt; formula:&lt;BR /&gt; SHIFT_HIGH_PERFORMANCE = COL + TBW + BANK, where&lt;BR /&gt; COL=# of column bits (here: 9)&lt;BR /&gt; TBW=total bus width, 1=16 bits, 2=32 bits (here: 2)&lt;BR /&gt; BANK=# of bank select bits (here: 2)&lt;BR /&gt; Just for completeness: For "low-power" SDRAM leave out the BANK term:&lt;BR /&gt; SHIFT_LOW_POWER = COL + TBW&lt;BR /&gt; */&lt;/P&gt;&lt;P&gt;//Delay_uS(100*MSEC);&lt;BR /&gt; wtemp =*(volatile unsigned int *)(DYNAMIC_MEM0_BASE+(MODE_REGISTER &amp;lt;&amp;lt; (COL+TBW+BANK)));&lt;/P&gt;&lt;P&gt;DbgUart2("3 WDTC: %d, TV %d \n", WDTC, WDTV);&lt;/P&gt;&lt;P&gt;EMC_DYN_CTRL = 0x00000000; /* Send command: NORMAL */&lt;/P&gt;&lt;P&gt;//Enable buffer&lt;BR /&gt; EMC_DYN_CFG0 |= BIT(19);&lt;/P&gt;&lt;P&gt;/* Abilito la ethernet per accedere alla 16K di ram */&lt;BR /&gt; //PCONP |= BIT(30);&lt;/P&gt;&lt;P&gt;DbgUart2("%s &amp;lt;\n",__FUNCTION__);&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Aug 2018 10:50:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/SDRAM-Mode-register-configuration/m-p/810988#M32525</guid>
      <dc:creator>andreascauri</dc:creator>
      <dc:date>2018-08-02T10:50:24Z</dc:date>
    </item>
    <item>
      <title>Re: SDRAM Mode register configuration</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/SDRAM-Mode-register-configuration/m-p/810989#M32526</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Andrea Scauri,&lt;BR /&gt;Thank you for your interest in NXP Semiconductor products and for the opportunity to serve you.&lt;BR /&gt;To provide the fastest possible support, I'd highly recommend you to refer to the periph_memtest demo in LPCOpen library to adjust the SDRAM initialization code, then taking a testing later.&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://www.nxp.com/support/developer-resources/software-development-tools/lpc-developer-resources-/lpcopen-libraries-and-examples/lpcopen-software-development-platform-lpc17xx:LPCOPEN-SOFTWARE-FOR-LPC17XX" title="https://www.nxp.com/support/developer-resources/software-development-tools/lpc-developer-resources-/lpcopen-libraries-and-examples/lpcopen-software-development-platform-lpc17xx:LPCOPEN-SOFTWARE-FOR-LPC17XX"&gt;LPCOpen Software for LPC17XX|NXP&lt;/A&gt; &lt;BR /&gt;Have a great day,&lt;BR /&gt;TIC&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Aug 2018 02:05:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/SDRAM-Mode-register-configuration/m-p/810989#M32526</guid>
      <dc:creator>jeremyzhou</dc:creator>
      <dc:date>2018-08-06T02:05:49Z</dc:date>
    </item>
  </channel>
</rss>

