<?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中的主题 External SDRAM EMC Configuration Help W9816G6JH-6</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/External-SDRAM-EMC-Configuration-Help-W9816G6JH-6/m-p/880407#M35183</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am developing firmware on the LPC54605J256ET180. I have custom hardware with an external SDRAM chip connected to the EMC. I was hoping I could get some help configuring all the different timing registers for my RAM chip.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using the NXP emc driver and following the demo app used for the OM13092 LPCXpresso54608 Dev board.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;RAM chip:&lt;/P&gt;&lt;P&gt;&lt;SPAN data-sheets-userformat="{&amp;quot;2&amp;quot;:14467,&amp;quot;3&amp;quot;:{&amp;quot;1&amp;quot;:0},&amp;quot;4&amp;quot;:[null,2,16777215],&amp;quot;10&amp;quot;:2,&amp;quot;14&amp;quot;:[null,2,0],&amp;quot;15&amp;quot;:&amp;quot;Arial&amp;quot;,&amp;quot;16&amp;quot;:9}" data-sheets-value="{&amp;quot;1&amp;quot;:2,&amp;quot;2&amp;quot;:&amp;quot;W9816G6JH-6&amp;quot;}" style="color: #000000; font-weight: normal; font-size: 9pt;"&gt;Winbond W9816G6JH-6&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN data-sheets-userformat="{&amp;quot;2&amp;quot;:14467,&amp;quot;3&amp;quot;:{&amp;quot;1&amp;quot;:0},&amp;quot;4&amp;quot;:[null,2,16777215],&amp;quot;10&amp;quot;:2,&amp;quot;14&amp;quot;:[null,2,0],&amp;quot;15&amp;quot;:&amp;quot;Arial&amp;quot;,&amp;quot;16&amp;quot;:9}" data-sheets-value="{&amp;quot;1&amp;quot;:2,&amp;quot;2&amp;quot;:&amp;quot;W9816G6JH-6&amp;quot;}" style="color: #000000; font-weight: normal; font-size: 9pt;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN data-sheets-userformat="{&amp;quot;2&amp;quot;:14467,&amp;quot;3&amp;quot;:{&amp;quot;1&amp;quot;:0},&amp;quot;4&amp;quot;:[null,2,16777215],&amp;quot;10&amp;quot;:2,&amp;quot;14&amp;quot;:[null,2,0],&amp;quot;15&amp;quot;:&amp;quot;Arial&amp;quot;,&amp;quot;16&amp;quot;:9}" data-sheets-value="{&amp;quot;1&amp;quot;:2,&amp;quot;2&amp;quot;:&amp;quot;W9816G6JH-6&amp;quot;}" style="color: #000000; font-weight: normal; font-size: 9pt;"&gt;MCU Setup:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN data-sheets-userformat="{&amp;quot;2&amp;quot;:14467,&amp;quot;3&amp;quot;:{&amp;quot;1&amp;quot;:0},&amp;quot;4&amp;quot;:[null,2,16777215],&amp;quot;10&amp;quot;:2,&amp;quot;14&amp;quot;:[null,2,0],&amp;quot;15&amp;quot;:&amp;quot;Arial&amp;quot;,&amp;quot;16&amp;quot;:9}" data-sheets-value="{&amp;quot;1&amp;quot;:2,&amp;quot;2&amp;quot;:&amp;quot;W9816G6JH-6&amp;quot;}" style="color: #000000; font-weight: normal; font-size: 9pt;"&gt;1) Using 12MHz external crystal and running core clock at 180MHz&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Initialization Code:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;DIV style="color: #d4d4d4; background-color: #1e1e1e; font-weight: normal; font-size: 14px;"&gt;&lt;DIV&gt;&lt;DIV style="color: #d4d4d4; background-color: #1e1e1e; font-weight: normal;"&gt;&lt;DIV&gt;&lt;SPAN style="color: #6a9955;"&gt;// The SDRAM timing.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #c586c0;"&gt;#define&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;HW_SDRAM_REFRESHPERIOD_NS&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;32&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;*&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;1000000&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;/&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;2048&lt;/SPAN&gt;&lt;SPAN&gt;) &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;// 4096 rows/ 64ms) // 4096 rows/ 64ms&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #c586c0;"&gt;#define&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;HW_SDRAM_TRP_NS&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;18u&lt;/SPAN&gt;&lt;SPAN&gt;) &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;///&amp;lt; Precharge command period&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #c586c0;"&gt;#define&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;HW_SDRAM_TRAS_NS&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;42u&lt;/SPAN&gt;&lt;SPAN&gt;) &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;///&amp;lt; Active to precharge command period&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #c586c0;"&gt;#define&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;HW_SDRAM_TSREX_NS&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;72u&lt;/SPAN&gt;&lt;SPAN&gt;) &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;///&amp;lt; Self-refresh exit time&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #c586c0;"&gt;#define&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;HW_SDRAM_TAPR_NS&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;18u&lt;/SPAN&gt;&lt;SPAN&gt;) &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;///&amp;lt; Last-data-out to active command time&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #c586c0;"&gt;#define&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;HW_SDRAM_TWRDELT_NS&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;22u&lt;/SPAN&gt;&lt;SPAN&gt;) &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;///&amp;lt; Write recovery time&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #c586c0;"&gt;#define&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;HW_SDRAM_TRC_NS&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;60u&lt;/SPAN&gt;&lt;SPAN&gt;) &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;///&amp;lt; Selects the active to active command period&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #c586c0;"&gt;#define&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;HW_SDRAM_RFC_NS&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;60u&lt;/SPAN&gt;&lt;SPAN&gt;) &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;///&amp;lt; Selects the auto-refresh period&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #c586c0;"&gt;#define&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;HW_SDRAM_XSR_NS&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;72u&lt;/SPAN&gt;&lt;SPAN&gt;) &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;///&amp;lt; Time for exit self-refresh to active command&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #c586c0;"&gt;#define&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;HW_SDRAM_RRD_NS&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;12u&lt;/SPAN&gt;&lt;SPAN&gt;) &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;///&amp;lt; Latency for active bank A to active bank B&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #c586c0;"&gt;#define&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;HW_SDRAM_MRD_NCLK&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;2u&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #c586c0;"&gt;#define&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;HW_SDRAM_RAS_NCLK&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;2u&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #c586c0;"&gt;#define&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;HW_SDRAM_MODEREG_VALUE&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;0x23u&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #c586c0;"&gt;#define&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;HW_SDRAM_DEV_MEMORYMAP&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;0x21u&lt;/SPAN&gt;&lt;SPAN&gt;) &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;// 16Mbits (1M*16, 2banks, 11 rows, 8 columns)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #569cd6;"&gt;static&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;void&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;HW_InitSDRAM&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;void&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;) {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #4ec9b0;"&gt;emc_basic_config_t&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; basicConfig;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #4ec9b0;"&gt;emc_dynamic_timing_config_t&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; dynTiming;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #4ec9b0;"&gt;emc_dynamic_chip_config_t&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; dynChipConfig;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;// Initialize the I/O pins&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;HW_InitSDRAMPins&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;();&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;// BOARD_InitPins();&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;/* Basic configuration. */&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; basicConfig.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;endian&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; kEMC_LittleEndian;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; basicConfig.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;fbClkSrc&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; kEMC_IntloopbackEmcclk;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;/*&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #6a9955;"&gt; * EMC Clock = CPU FREQ/2 here can fit CPU freq from 12M ~ 180M.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #6a9955;"&gt; * If you change the divide to 0 and EMC clock is larger than 100M&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #6a9955;"&gt; * please take refer to emc.dox to adjust EMC clock delay.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #6a9955;"&gt; */&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; basicConfig.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;emcClkDiv&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;/* Dynamic memory timing configuration. */&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; dynTiming.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;readConfig&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; kEMC_Cmddelay;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; dynTiming.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;refreshPeriod_Nanosec&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; HW_SDRAM_REFRESHPERIOD_NS;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; dynTiming.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;tRp_Ns&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; HW_SDRAM_TRP_NS;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; dynTiming.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;tRas_Ns&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; HW_SDRAM_TRAS_NS;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; dynTiming.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;tSrex_Ns&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; HW_SDRAM_TSREX_NS;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; dynTiming.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;tApr_Ns&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; HW_SDRAM_TAPR_NS;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; dynTiming.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;tWr_Ns&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; (((&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;1000000000&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;/&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;CLOCK_GetFreq&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(kCLOCK_EMC)) &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;*&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;) &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;+&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; HW_SDRAM_TWRDELT_NS); &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;/* one clk + HW_SDRAM_TWRDELT_NS */&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; dynTiming.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;tDal_Ns&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; dynTiming.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;tWr_Ns&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;+&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; dynTiming.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;tRp_Ns&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; dynTiming.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;tRc_Ns&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; HW_SDRAM_TRC_NS;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; dynTiming.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;tRfc_Ns&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; HW_SDRAM_RFC_NS;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; dynTiming.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;tXsr_Ns&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; HW_SDRAM_XSR_NS;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; dynTiming.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;tRrd_Ns&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; HW_SDRAM_RRD_NS;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; dynTiming.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;tMrd_Nclk&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; HW_SDRAM_MRD_NCLK;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;/* Dynamic memory chip specific configuration: Chip 0 - MTL48LC8M16A2B4-6A */&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; dynChipConfig.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;chipIndex&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; dynChipConfig.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;dynamicDevice&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; kEMC_Sdram;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; dynChipConfig.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;rAS_Nclk&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; HW_SDRAM_RAS_NCLK;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; dynChipConfig.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;sdramModeReg&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; HW_SDRAM_MODEREG_VALUE;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; dynChipConfig.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;sdramExtModeReg&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;; &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;/* it has no use for normal sdram */&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; dynChipConfig.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;devAddrMap&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; HW_SDRAM_DEV_MEMORYMAP;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;/* EMC Basic configuration. */&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;EMC_Init&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(EMC, &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;amp;&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;basicConfig);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;/* EMC Dynamc memory configuration. */&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;EMC_DynamicMemInit&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(EMC, &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;amp;&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;dynTiming, &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;amp;&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;dynChipConfig, &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With the code above, it passes the test routines, BUT only when I run the MCU core clock at 96MHz with&amp;nbsp;BOARD_BootClockFROHF96M.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But when I run the core clock at 180MHz with BOARD_BootClockPLL180M, it fails the _______.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I increased the clock divider, but that does not seem to get it to work. I'm guessing the timing parameters are wrong. I kinda had to guess on some of them because i'm not sure how to get them from the datasheet.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Specifically the&amp;nbsp;HW_SDRAM_REFRESHPERIOD_NS&amp;nbsp;parameter. I'm not sure how to choose this value with the datasheet.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The test routines are the same ones used in the lpcxpresso54608_driver_examples_emc_sdram. But here there are anyway:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;/P&gt;&lt;DIV style="color: #d4d4d4; background-color: #1e1e1e; font-weight: normal; font-size: 14px;"&gt;&lt;DIV&gt;&lt;SPAN style="color: #c586c0;"&gt;#define&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;SDRAM_BASE_ADDR&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;0xa0000000&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #c586c0;"&gt;#define&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;SDRAM_SIZE_BYTES&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;2000000&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;//(8 * 1024 * 1024)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #c586c0;"&gt;#define&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;SDRAM_EXAMPLE_DATALEN&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt; (SDRAM_SIZE_BYTES &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;/&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;4&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #c586c0;"&gt;#define&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;SDRAM_TEST_PATTERN&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt; (&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;2&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #4ec9b0;"&gt;pti_return_t&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;SDRAM_DataBusCheck&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;volatile&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #4ec9b0;"&gt;uint32_t&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;*&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; address) {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #4ec9b0;"&gt;uint32_t&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; data &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;/* Write the walking 1's data test. */&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;for&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(data &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;; data &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;!=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;; data &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;lt;&amp;lt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;) {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;*&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;address &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; data;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;/* Read the data out of the address and check. */&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;*&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;address &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;!=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; data) {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;return&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; pti_error;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;return&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; pti_success;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #4ec9b0;"&gt;pti_return_t&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;SDRAM_AddressBusCheck&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;volatile&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #4ec9b0;"&gt;uint32_t&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;*&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; address, &lt;/SPAN&gt;&lt;SPAN style="color: #4ec9b0;"&gt;uint32_t&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; bytes) {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="padding-left: 30px;"&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #4ec9b0;"&gt;uint32_t&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; pattern &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;0x55555555&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="padding-left: 30px;"&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #4ec9b0;"&gt;uint32_t&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; size &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; bytes &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;/&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;4&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="padding-left: 30px;"&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #4ec9b0;"&gt;uint32_t&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; offset;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="padding-left: 30px;"&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #4ec9b0;"&gt;uint32_t&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; checkOffset;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV style="padding-left: 30px;"&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;/* write the pattern to the power-of-two address. */&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="padding-left: 30px;"&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;for&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(offset &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;; offset &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; size; offset &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;lt;&amp;lt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;) {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="padding-left: 30px;"&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;address[offset] &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; pattern;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="padding-left: 30px;"&gt;&lt;SPAN style="color: #d4d4d4;"&gt; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="padding-left: 30px;"&gt;&lt;SPAN style="color: #d4d4d4;"&gt; address[&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;] &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;~&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;pattern;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV style="padding-left: 30px;"&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;/* Read and check. */&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="padding-left: 30px;"&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #4ec9b0;"&gt;uint32_t&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;*&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;ptr &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;NULL&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="padding-left: 30px;"&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;for&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(offset &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;; offset &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; size; offset &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;lt;&amp;lt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;) {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="padding-left: 30px;"&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;ptr &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;amp;&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;address[offset];&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="padding-left: 30px;"&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;*&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;ptr &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;!=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; pattern) {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="padding-left: 30px;"&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;return&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; pti_error;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="padding-left: 30px;"&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="padding-left: 30px;"&gt;&lt;SPAN style="color: #d4d4d4;"&gt; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV style="padding-left: 30px;"&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(address[&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;] &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;!=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;~&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;pattern) {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="padding-left: 30px;"&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;return&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; pti_error;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="padding-left: 30px;"&gt;&lt;SPAN style="color: #d4d4d4;"&gt; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV style="padding-left: 30px;"&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;/* Change the data to the revert one address each time&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="padding-left: 30px;"&gt;&lt;SPAN style="color: #6a9955;"&gt; * and check there is no effect to other address. */&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="padding-left: 30px;"&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;for&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(offset &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;; offset &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; size; offset &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;lt;&amp;lt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;) {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="padding-left: 30px;"&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;address[offset] &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;~&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;pattern;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="padding-left: 30px;"&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;for&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(checkOffset &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;; checkOffset &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; size; checkOffset &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;lt;&amp;lt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;) {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="padding-left: 30px;"&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;((checkOffset &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;!=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; offset) &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;amp;&amp;amp;&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; (address[checkOffset] &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;!=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; pattern)) {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="padding-left: 30px;"&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;return&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; pti_error;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="padding-left: 30px;"&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="padding-left: 30px;"&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="padding-left: 30px;"&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;address[offset] &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; pattern;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="padding-left: 30px;"&gt;&lt;SPAN style="color: #d4d4d4;"&gt; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="padding-left: 30px;"&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;return&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; pti_success;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #569cd6;"&gt;static&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;void&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;test&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;void&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;) {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;volatile&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #4ec9b0;"&gt;uint32_t&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; index;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #4ec9b0;"&gt;uint32_t&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;*&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; sdram &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; (&lt;/SPAN&gt;&lt;SPAN style="color: #4ec9b0;"&gt;uint32_t&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;*&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;)SDRAM_BASE_ADDR; &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;/* SDRAM start address. */&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;/* Data/address bus check. */&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;SDRAM_DataBusCheck&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(sdram) &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;!=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; pti_success) {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;LOG_DEBUG&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(MOD_ALL_BASE, &lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d7ba7d;"&gt;\r\n&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt; SDRAM data bus check is failure.&lt;/SPAN&gt;&lt;SPAN style="color: #d7ba7d;"&gt;\r\n&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;SDRAM_AddressBusCheck&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(sdram, SDRAM_SIZE_BYTES) &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;!=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; pti_success) {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;LOG_DEBUG&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(MOD_ALL_BASE, &lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d7ba7d;"&gt;\r\n&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt; SDRAM address bus check is failure.&lt;/SPAN&gt;&lt;SPAN style="color: #d7ba7d;"&gt;\r\n&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;LOG_DEBUG&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(MOD_ALL_BASE, &lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d7ba7d;"&gt;\r\n&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt; Start EMC SDRAM access example.&lt;/SPAN&gt;&lt;SPAN style="color: #d7ba7d;"&gt;\r\n&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;LOG_DEBUG_PF&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(MOD_ALL_BASE, &lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d7ba7d;"&gt;\r\n&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt; SDRAM Write Start, Start Address 0x%x, Data Length %d !&lt;/SPAN&gt;&lt;SPAN style="color: #d7ba7d;"&gt;\r\n&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;, sdram,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; SDRAM_EXAMPLE_DATALEN);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;/* Prepare data and write to SDRAM. */&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;for&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(index &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;; index &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; SDRAM_EXAMPLE_DATALEN; index&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;++&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;) {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;*&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #4ec9b0;"&gt;uint32_t&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;*&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;)(sdram &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;+&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; index) &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; index;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;LOG_DEBUG&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(MOD_ALL_BASE, &lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d7ba7d;"&gt;\r\n&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt; SDRAM Write finished!&lt;/SPAN&gt;&lt;SPAN style="color: #d7ba7d;"&gt;\r\n&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;LOG_DEBUG_PF&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(MOD_ALL_BASE, &lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d7ba7d;"&gt;\r\n&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt; SDRAM Read/Check Start, Start Address 0x%x, Data Length %d !&lt;/SPAN&gt;&lt;SPAN style="color: #d7ba7d;"&gt;\r\n&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;, sdram,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; SDRAM_EXAMPLE_DATALEN);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;/* Read data from the SDRAM. */&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #4ec9b0;"&gt;uint32_t&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;*&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; ptr &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;NULL&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #4ec9b0;"&gt;uint32_t&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; value &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;for&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(index &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;; index &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; SDRAM_EXAMPLE_DATALEN; index&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;++&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;) {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; ptr &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; sdram &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;+&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; index;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; value &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;*&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;ptr;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(value &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;!=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; index) {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;LOG_DEBUG&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(MOD_ALL_BASE, &lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d7ba7d;"&gt;\r\n&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt; SDRAM Write Data and Read Data Check Error!&lt;/SPAN&gt;&lt;SPAN style="color: #d7ba7d;"&gt;\r\n&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;break&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;LOG_DEBUG&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(MOD_ALL_BASE, &lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d7ba7d;"&gt;\r\n&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt; SDRAM Write Data and Read Data Succeed.&lt;/SPAN&gt;&lt;SPAN style="color: #d7ba7d;"&gt;\r\n&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If someone could help me tune the EMC to work with my RAM chip I would greatly appreciate it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Link to datasheet for SDRAM chip:&lt;BR /&gt;&lt;A class="link-titled" href="http://www.winbond.com/resource-files/w9816g6jh_a02.pdf" title="http://www.winbond.com/resource-files/w9816g6jh_a02.pdf"&gt;http://www.winbond.com/resource-files/w9816g6jh_a02.pdf&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 21 Mar 2019 22:09:23 GMT</pubDate>
    <dc:creator>guitardenver</dc:creator>
    <dc:date>2019-03-21T22:09:23Z</dc:date>
    <item>
      <title>External SDRAM EMC Configuration Help W9816G6JH-6</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/External-SDRAM-EMC-Configuration-Help-W9816G6JH-6/m-p/880407#M35183</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am developing firmware on the LPC54605J256ET180. I have custom hardware with an external SDRAM chip connected to the EMC. I was hoping I could get some help configuring all the different timing registers for my RAM chip.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using the NXP emc driver and following the demo app used for the OM13092 LPCXpresso54608 Dev board.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;RAM chip:&lt;/P&gt;&lt;P&gt;&lt;SPAN data-sheets-userformat="{&amp;quot;2&amp;quot;:14467,&amp;quot;3&amp;quot;:{&amp;quot;1&amp;quot;:0},&amp;quot;4&amp;quot;:[null,2,16777215],&amp;quot;10&amp;quot;:2,&amp;quot;14&amp;quot;:[null,2,0],&amp;quot;15&amp;quot;:&amp;quot;Arial&amp;quot;,&amp;quot;16&amp;quot;:9}" data-sheets-value="{&amp;quot;1&amp;quot;:2,&amp;quot;2&amp;quot;:&amp;quot;W9816G6JH-6&amp;quot;}" style="color: #000000; font-weight: normal; font-size: 9pt;"&gt;Winbond W9816G6JH-6&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN data-sheets-userformat="{&amp;quot;2&amp;quot;:14467,&amp;quot;3&amp;quot;:{&amp;quot;1&amp;quot;:0},&amp;quot;4&amp;quot;:[null,2,16777215],&amp;quot;10&amp;quot;:2,&amp;quot;14&amp;quot;:[null,2,0],&amp;quot;15&amp;quot;:&amp;quot;Arial&amp;quot;,&amp;quot;16&amp;quot;:9}" data-sheets-value="{&amp;quot;1&amp;quot;:2,&amp;quot;2&amp;quot;:&amp;quot;W9816G6JH-6&amp;quot;}" style="color: #000000; font-weight: normal; font-size: 9pt;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN data-sheets-userformat="{&amp;quot;2&amp;quot;:14467,&amp;quot;3&amp;quot;:{&amp;quot;1&amp;quot;:0},&amp;quot;4&amp;quot;:[null,2,16777215],&amp;quot;10&amp;quot;:2,&amp;quot;14&amp;quot;:[null,2,0],&amp;quot;15&amp;quot;:&amp;quot;Arial&amp;quot;,&amp;quot;16&amp;quot;:9}" data-sheets-value="{&amp;quot;1&amp;quot;:2,&amp;quot;2&amp;quot;:&amp;quot;W9816G6JH-6&amp;quot;}" style="color: #000000; font-weight: normal; font-size: 9pt;"&gt;MCU Setup:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN data-sheets-userformat="{&amp;quot;2&amp;quot;:14467,&amp;quot;3&amp;quot;:{&amp;quot;1&amp;quot;:0},&amp;quot;4&amp;quot;:[null,2,16777215],&amp;quot;10&amp;quot;:2,&amp;quot;14&amp;quot;:[null,2,0],&amp;quot;15&amp;quot;:&amp;quot;Arial&amp;quot;,&amp;quot;16&amp;quot;:9}" data-sheets-value="{&amp;quot;1&amp;quot;:2,&amp;quot;2&amp;quot;:&amp;quot;W9816G6JH-6&amp;quot;}" style="color: #000000; font-weight: normal; font-size: 9pt;"&gt;1) Using 12MHz external crystal and running core clock at 180MHz&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Initialization Code:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;DIV style="color: #d4d4d4; background-color: #1e1e1e; font-weight: normal; font-size: 14px;"&gt;&lt;DIV&gt;&lt;DIV style="color: #d4d4d4; background-color: #1e1e1e; font-weight: normal;"&gt;&lt;DIV&gt;&lt;SPAN style="color: #6a9955;"&gt;// The SDRAM timing.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #c586c0;"&gt;#define&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;HW_SDRAM_REFRESHPERIOD_NS&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;32&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;*&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;1000000&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;/&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;2048&lt;/SPAN&gt;&lt;SPAN&gt;) &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;// 4096 rows/ 64ms) // 4096 rows/ 64ms&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #c586c0;"&gt;#define&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;HW_SDRAM_TRP_NS&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;18u&lt;/SPAN&gt;&lt;SPAN&gt;) &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;///&amp;lt; Precharge command period&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #c586c0;"&gt;#define&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;HW_SDRAM_TRAS_NS&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;42u&lt;/SPAN&gt;&lt;SPAN&gt;) &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;///&amp;lt; Active to precharge command period&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #c586c0;"&gt;#define&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;HW_SDRAM_TSREX_NS&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;72u&lt;/SPAN&gt;&lt;SPAN&gt;) &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;///&amp;lt; Self-refresh exit time&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #c586c0;"&gt;#define&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;HW_SDRAM_TAPR_NS&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;18u&lt;/SPAN&gt;&lt;SPAN&gt;) &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;///&amp;lt; Last-data-out to active command time&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #c586c0;"&gt;#define&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;HW_SDRAM_TWRDELT_NS&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;22u&lt;/SPAN&gt;&lt;SPAN&gt;) &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;///&amp;lt; Write recovery time&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #c586c0;"&gt;#define&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;HW_SDRAM_TRC_NS&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;60u&lt;/SPAN&gt;&lt;SPAN&gt;) &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;///&amp;lt; Selects the active to active command period&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #c586c0;"&gt;#define&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;HW_SDRAM_RFC_NS&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;60u&lt;/SPAN&gt;&lt;SPAN&gt;) &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;///&amp;lt; Selects the auto-refresh period&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #c586c0;"&gt;#define&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;HW_SDRAM_XSR_NS&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;72u&lt;/SPAN&gt;&lt;SPAN&gt;) &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;///&amp;lt; Time for exit self-refresh to active command&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #c586c0;"&gt;#define&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;HW_SDRAM_RRD_NS&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;12u&lt;/SPAN&gt;&lt;SPAN&gt;) &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;///&amp;lt; Latency for active bank A to active bank B&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #c586c0;"&gt;#define&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;HW_SDRAM_MRD_NCLK&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;2u&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #c586c0;"&gt;#define&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;HW_SDRAM_RAS_NCLK&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;2u&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #c586c0;"&gt;#define&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;HW_SDRAM_MODEREG_VALUE&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;0x23u&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #c586c0;"&gt;#define&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;HW_SDRAM_DEV_MEMORYMAP&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;0x21u&lt;/SPAN&gt;&lt;SPAN&gt;) &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;// 16Mbits (1M*16, 2banks, 11 rows, 8 columns)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #569cd6;"&gt;static&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;void&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;HW_InitSDRAM&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;void&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;) {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #4ec9b0;"&gt;emc_basic_config_t&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; basicConfig;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #4ec9b0;"&gt;emc_dynamic_timing_config_t&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; dynTiming;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #4ec9b0;"&gt;emc_dynamic_chip_config_t&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; dynChipConfig;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;// Initialize the I/O pins&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;HW_InitSDRAMPins&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;();&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;// BOARD_InitPins();&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;/* Basic configuration. */&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; basicConfig.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;endian&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; kEMC_LittleEndian;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; basicConfig.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;fbClkSrc&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; kEMC_IntloopbackEmcclk;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;/*&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #6a9955;"&gt; * EMC Clock = CPU FREQ/2 here can fit CPU freq from 12M ~ 180M.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #6a9955;"&gt; * If you change the divide to 0 and EMC clock is larger than 100M&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #6a9955;"&gt; * please take refer to emc.dox to adjust EMC clock delay.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #6a9955;"&gt; */&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; basicConfig.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;emcClkDiv&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;/* Dynamic memory timing configuration. */&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; dynTiming.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;readConfig&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; kEMC_Cmddelay;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; dynTiming.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;refreshPeriod_Nanosec&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; HW_SDRAM_REFRESHPERIOD_NS;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; dynTiming.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;tRp_Ns&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; HW_SDRAM_TRP_NS;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; dynTiming.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;tRas_Ns&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; HW_SDRAM_TRAS_NS;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; dynTiming.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;tSrex_Ns&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; HW_SDRAM_TSREX_NS;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; dynTiming.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;tApr_Ns&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; HW_SDRAM_TAPR_NS;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; dynTiming.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;tWr_Ns&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; (((&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;1000000000&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;/&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;CLOCK_GetFreq&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(kCLOCK_EMC)) &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;*&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;) &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;+&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; HW_SDRAM_TWRDELT_NS); &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;/* one clk + HW_SDRAM_TWRDELT_NS */&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; dynTiming.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;tDal_Ns&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; dynTiming.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;tWr_Ns&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;+&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; dynTiming.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;tRp_Ns&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; dynTiming.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;tRc_Ns&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; HW_SDRAM_TRC_NS;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; dynTiming.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;tRfc_Ns&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; HW_SDRAM_RFC_NS;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; dynTiming.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;tXsr_Ns&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; HW_SDRAM_XSR_NS;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; dynTiming.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;tRrd_Ns&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; HW_SDRAM_RRD_NS;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; dynTiming.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;tMrd_Nclk&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; HW_SDRAM_MRD_NCLK;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;/* Dynamic memory chip specific configuration: Chip 0 - MTL48LC8M16A2B4-6A */&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; dynChipConfig.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;chipIndex&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; dynChipConfig.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;dynamicDevice&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; kEMC_Sdram;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; dynChipConfig.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;rAS_Nclk&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; HW_SDRAM_RAS_NCLK;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; dynChipConfig.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;sdramModeReg&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; HW_SDRAM_MODEREG_VALUE;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; dynChipConfig.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;sdramExtModeReg&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;; &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;/* it has no use for normal sdram */&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; dynChipConfig.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;devAddrMap&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; HW_SDRAM_DEV_MEMORYMAP;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;/* EMC Basic configuration. */&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;EMC_Init&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(EMC, &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;amp;&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;basicConfig);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;/* EMC Dynamc memory configuration. */&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;EMC_DynamicMemInit&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(EMC, &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;amp;&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;dynTiming, &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;amp;&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;dynChipConfig, &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With the code above, it passes the test routines, BUT only when I run the MCU core clock at 96MHz with&amp;nbsp;BOARD_BootClockFROHF96M.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But when I run the core clock at 180MHz with BOARD_BootClockPLL180M, it fails the _______.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I increased the clock divider, but that does not seem to get it to work. I'm guessing the timing parameters are wrong. I kinda had to guess on some of them because i'm not sure how to get them from the datasheet.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Specifically the&amp;nbsp;HW_SDRAM_REFRESHPERIOD_NS&amp;nbsp;parameter. I'm not sure how to choose this value with the datasheet.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The test routines are the same ones used in the lpcxpresso54608_driver_examples_emc_sdram. But here there are anyway:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;/P&gt;&lt;DIV style="color: #d4d4d4; background-color: #1e1e1e; font-weight: normal; font-size: 14px;"&gt;&lt;DIV&gt;&lt;SPAN style="color: #c586c0;"&gt;#define&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;SDRAM_BASE_ADDR&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;0xa0000000&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #c586c0;"&gt;#define&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;SDRAM_SIZE_BYTES&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;2000000&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;//(8 * 1024 * 1024)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #c586c0;"&gt;#define&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;SDRAM_EXAMPLE_DATALEN&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt; (SDRAM_SIZE_BYTES &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;/&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;4&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #c586c0;"&gt;#define&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;SDRAM_TEST_PATTERN&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt; (&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;2&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #4ec9b0;"&gt;pti_return_t&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;SDRAM_DataBusCheck&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;volatile&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #4ec9b0;"&gt;uint32_t&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;*&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; address) {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #4ec9b0;"&gt;uint32_t&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; data &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;/* Write the walking 1's data test. */&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;for&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(data &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;; data &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;!=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;; data &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;lt;&amp;lt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;) {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;*&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;address &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; data;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;/* Read the data out of the address and check. */&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;*&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;address &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;!=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; data) {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;return&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; pti_error;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;return&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; pti_success;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #4ec9b0;"&gt;pti_return_t&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;SDRAM_AddressBusCheck&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;volatile&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #4ec9b0;"&gt;uint32_t&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;*&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; address, &lt;/SPAN&gt;&lt;SPAN style="color: #4ec9b0;"&gt;uint32_t&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; bytes) {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="padding-left: 30px;"&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #4ec9b0;"&gt;uint32_t&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; pattern &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;0x55555555&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="padding-left: 30px;"&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #4ec9b0;"&gt;uint32_t&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; size &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; bytes &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;/&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;4&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="padding-left: 30px;"&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #4ec9b0;"&gt;uint32_t&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; offset;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="padding-left: 30px;"&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #4ec9b0;"&gt;uint32_t&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; checkOffset;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV style="padding-left: 30px;"&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;/* write the pattern to the power-of-two address. */&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="padding-left: 30px;"&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;for&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(offset &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;; offset &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; size; offset &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;lt;&amp;lt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;) {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="padding-left: 30px;"&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;address[offset] &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; pattern;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="padding-left: 30px;"&gt;&lt;SPAN style="color: #d4d4d4;"&gt; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="padding-left: 30px;"&gt;&lt;SPAN style="color: #d4d4d4;"&gt; address[&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;] &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;~&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;pattern;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV style="padding-left: 30px;"&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;/* Read and check. */&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="padding-left: 30px;"&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #4ec9b0;"&gt;uint32_t&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;*&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;ptr &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;NULL&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="padding-left: 30px;"&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;for&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(offset &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;; offset &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; size; offset &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;lt;&amp;lt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;) {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="padding-left: 30px;"&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;ptr &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;amp;&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;address[offset];&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="padding-left: 30px;"&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;*&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;ptr &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;!=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; pattern) {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="padding-left: 30px;"&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;return&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; pti_error;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="padding-left: 30px;"&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="padding-left: 30px;"&gt;&lt;SPAN style="color: #d4d4d4;"&gt; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV style="padding-left: 30px;"&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(address[&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;] &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;!=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;~&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;pattern) {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="padding-left: 30px;"&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;return&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; pti_error;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="padding-left: 30px;"&gt;&lt;SPAN style="color: #d4d4d4;"&gt; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV style="padding-left: 30px;"&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;/* Change the data to the revert one address each time&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="padding-left: 30px;"&gt;&lt;SPAN style="color: #6a9955;"&gt; * and check there is no effect to other address. */&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="padding-left: 30px;"&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;for&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(offset &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;; offset &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; size; offset &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;lt;&amp;lt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;) {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="padding-left: 30px;"&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;address[offset] &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;~&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;pattern;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="padding-left: 30px;"&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;for&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(checkOffset &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;; checkOffset &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; size; checkOffset &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;lt;&amp;lt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;) {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="padding-left: 30px;"&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;((checkOffset &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;!=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; offset) &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;amp;&amp;amp;&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; (address[checkOffset] &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;!=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; pattern)) {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="padding-left: 30px;"&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;return&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; pti_error;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="padding-left: 30px;"&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="padding-left: 30px;"&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="padding-left: 30px;"&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;address[offset] &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; pattern;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="padding-left: 30px;"&gt;&lt;SPAN style="color: #d4d4d4;"&gt; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="padding-left: 30px;"&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;return&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; pti_success;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #569cd6;"&gt;static&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;void&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;test&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;void&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;) {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;volatile&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #4ec9b0;"&gt;uint32_t&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; index;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #4ec9b0;"&gt;uint32_t&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;*&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; sdram &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; (&lt;/SPAN&gt;&lt;SPAN style="color: #4ec9b0;"&gt;uint32_t&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;*&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;)SDRAM_BASE_ADDR; &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;/* SDRAM start address. */&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;/* Data/address bus check. */&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;SDRAM_DataBusCheck&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(sdram) &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;!=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; pti_success) {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;LOG_DEBUG&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(MOD_ALL_BASE, &lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d7ba7d;"&gt;\r\n&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt; SDRAM data bus check is failure.&lt;/SPAN&gt;&lt;SPAN style="color: #d7ba7d;"&gt;\r\n&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;SDRAM_AddressBusCheck&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(sdram, SDRAM_SIZE_BYTES) &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;!=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; pti_success) {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;LOG_DEBUG&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(MOD_ALL_BASE, &lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d7ba7d;"&gt;\r\n&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt; SDRAM address bus check is failure.&lt;/SPAN&gt;&lt;SPAN style="color: #d7ba7d;"&gt;\r\n&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;LOG_DEBUG&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(MOD_ALL_BASE, &lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d7ba7d;"&gt;\r\n&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt; Start EMC SDRAM access example.&lt;/SPAN&gt;&lt;SPAN style="color: #d7ba7d;"&gt;\r\n&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;LOG_DEBUG_PF&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(MOD_ALL_BASE, &lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d7ba7d;"&gt;\r\n&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt; SDRAM Write Start, Start Address 0x%x, Data Length %d !&lt;/SPAN&gt;&lt;SPAN style="color: #d7ba7d;"&gt;\r\n&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;, sdram,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; SDRAM_EXAMPLE_DATALEN);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;/* Prepare data and write to SDRAM. */&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;for&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(index &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;; index &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; SDRAM_EXAMPLE_DATALEN; index&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;++&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;) {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;*&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #4ec9b0;"&gt;uint32_t&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;*&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;)(sdram &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;+&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; index) &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; index;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;LOG_DEBUG&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(MOD_ALL_BASE, &lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d7ba7d;"&gt;\r\n&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt; SDRAM Write finished!&lt;/SPAN&gt;&lt;SPAN style="color: #d7ba7d;"&gt;\r\n&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;LOG_DEBUG_PF&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(MOD_ALL_BASE, &lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d7ba7d;"&gt;\r\n&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt; SDRAM Read/Check Start, Start Address 0x%x, Data Length %d !&lt;/SPAN&gt;&lt;SPAN style="color: #d7ba7d;"&gt;\r\n&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;, sdram,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; SDRAM_EXAMPLE_DATALEN);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;/* Read data from the SDRAM. */&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #4ec9b0;"&gt;uint32_t&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;*&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; ptr &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;NULL&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #4ec9b0;"&gt;uint32_t&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; value &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;for&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(index &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;; index &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; SDRAM_EXAMPLE_DATALEN; index&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;++&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;) {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; ptr &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; sdram &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;+&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; index;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; value &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;*&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;ptr;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(value &lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;!=&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; index) {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;LOG_DEBUG&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(MOD_ALL_BASE, &lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d7ba7d;"&gt;\r\n&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt; SDRAM Write Data and Read Data Check Error!&lt;/SPAN&gt;&lt;SPAN style="color: #d7ba7d;"&gt;\r\n&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;break&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;LOG_DEBUG&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(MOD_ALL_BASE, &lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d7ba7d;"&gt;\r\n&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt; SDRAM Write Data and Read Data Succeed.&lt;/SPAN&gt;&lt;SPAN style="color: #d7ba7d;"&gt;\r\n&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If someone could help me tune the EMC to work with my RAM chip I would greatly appreciate it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Link to datasheet for SDRAM chip:&lt;BR /&gt;&lt;A class="link-titled" href="http://www.winbond.com/resource-files/w9816g6jh_a02.pdf" title="http://www.winbond.com/resource-files/w9816g6jh_a02.pdf"&gt;http://www.winbond.com/resource-files/w9816g6jh_a02.pdf&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Mar 2019 22:09:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/External-SDRAM-EMC-Configuration-Help-W9816G6JH-6/m-p/880407#M35183</guid>
      <dc:creator>guitardenver</dc:creator>
      <dc:date>2019-03-21T22:09:23Z</dc:date>
    </item>
    <item>
      <title>Re: External SDRAM EMC Configuration Help W9816G6JH-6</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/External-SDRAM-EMC-Configuration-Help-W9816G6JH-6/m-p/880408#M35184</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Matt,&lt;/P&gt;&lt;P&gt;for the following code:&lt;/P&gt;&lt;P&gt;void BOARD_InitSDRAM(void)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; emc_basic_config_t basicConfig;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; emc_dynamic_timing_config_t dynTiming;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; emc_dynamic_chip_config_t dynChipConfig;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Basic configuration. */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; basicConfig.endian = kEMC_LittleEndian;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; basicConfig.fbClkSrc = kEMC_IntloopbackEmcclk;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* EMC Clock = CPU FREQ/2 here can fit CPU freq from 12M ~ 180M.&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; * If you change the divide to 0 and EMC clock is larger than 100M&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; * please take refer to emc.dox to adjust EMC clock delay.&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; basicConfig.emcClkDiv = 1;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Dynamic memory timing configuration. */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; dynTiming.readConfig = kEMC_Cmddelay;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; dynTiming.refreshPeriod_Nanosec = SDRAM_REFRESHPERIOD_NS;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; dynTiming.tRp_Ns = SDRAM_TRP_NS;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After you set the core clock to 180mhz, If you change the clock divider basicConfig.emcClkDiv = 3; in the case, the EMC_CLK will be 180MHz/(3+1)=45MHz, what is the result?&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;Xiangjun Rong&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Mar 2019 09:28:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/External-SDRAM-EMC-Configuration-Help-W9816G6JH-6/m-p/880408#M35184</guid>
      <dc:creator>xiangjun_rong</dc:creator>
      <dc:date>2019-03-25T09:28:25Z</dc:date>
    </item>
    <item>
      <title>Re: External SDRAM EMC Configuration Help W9816G6JH-6</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/External-SDRAM-EMC-Configuration-Help-W9816G6JH-6/m-p/880409#M35185</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I think the W9816G6JH-6 has different row size with the MT48LC8M16A2B4. So the parameter #define SDRAM_REFRESHPERIOD_NS is different&lt;/P&gt;&lt;P&gt;assume the the clock frequency is 100MHz.&lt;/P&gt;&lt;P&gt;for the MT48LC8M16A2B4, the&amp;nbsp;SDRAM_REFRESHPERIOD_NS&amp;nbsp; is&amp;nbsp; (64 * 1000000 / 4096) /* 4096 rows/ 64ms */&lt;/P&gt;&lt;P&gt;for theW9816G6JH-6, the&amp;nbsp;SDRAM_REFRESHPERIOD_NS&amp;nbsp; is&amp;nbsp; (64 * 1000000 / 2048) /* 2048 rows/ 64ms */&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pls have a try&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;XiangJun Rong&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;H1&gt;&lt;/H1&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Mar 2019 09:55:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/External-SDRAM-EMC-Configuration-Help-W9816G6JH-6/m-p/880409#M35185</guid>
      <dc:creator>xiangjun_rong</dc:creator>
      <dc:date>2019-03-25T09:55:06Z</dc:date>
    </item>
    <item>
      <title>Re: External SDRAM EMC Configuration Help W9816G6JH-6</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/External-SDRAM-EMC-Configuration-Help-W9816G6JH-6/m-p/880410#M35186</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;The W9816G6JH is 512K*2Bank*16 bits SDRAM, it is 1M*16 bits, based on the Table 656. Address mapping, so the parameter&lt;/P&gt;&lt;P&gt;#define SDRAM_DEV_MEMORYMAP (0x01u) /* 16Mbits (1M*16, 2banks, 11rows, 8 columns)*/&lt;/P&gt;&lt;P&gt;Pls have a try&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;XiangJun Rong&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/68473iE4E20490BD07CDA6/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_1.png" alt="pastedImage_1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Mar 2019 09:08:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/External-SDRAM-EMC-Configuration-Help-W9816G6JH-6/m-p/880410#M35186</guid>
      <dc:creator>xiangjun_rong</dc:creator>
      <dc:date>2019-03-26T09:08:16Z</dc:date>
    </item>
    <item>
      <title>Re: External SDRAM EMC Configuration Help W9816G6JH-6</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/External-SDRAM-EMC-Configuration-Help-W9816G6JH-6/m-p/880411#M35187</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;XiangJun Rong,&lt;/P&gt;&lt;P&gt;Thanks for the reply.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What is the difference between the "high-performance bus width" and just "16 bit bus width"?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Mar 2019 15:51:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/External-SDRAM-EMC-Configuration-Help-W9816G6JH-6/m-p/880411#M35187</guid>
      <dc:creator>guitardenver</dc:creator>
      <dc:date>2019-03-26T15:51:47Z</dc:date>
    </item>
    <item>
      <title>Re: External SDRAM EMC Configuration Help W9816G6JH-6</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/External-SDRAM-EMC-Configuration-Help-W9816G6JH-6/m-p/880412#M35188</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Matt,&lt;/P&gt;&lt;P&gt;Generally speaking, the "high-performance bus width" mode can generate low latency timing to access the SDRAM, but we have not detailed description to clarify the feature and highlight the difference between two modes. I am sorry.&lt;/P&gt;&lt;P&gt;After the modification, can you access the W9816 correctly?&lt;/P&gt;&lt;H2&gt;&lt;/H2&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;Xiangjun Rong&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Mar 2019 09:18:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/External-SDRAM-EMC-Configuration-Help-W9816G6JH-6/m-p/880412#M35188</guid>
      <dc:creator>xiangjun_rong</dc:creator>
      <dc:date>2019-03-27T09:18:09Z</dc:date>
    </item>
    <item>
      <title>Re: External SDRAM EMC Configuration Help W9816G6JH-6</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/External-SDRAM-EMC-Configuration-Help-W9816G6JH-6/m-p/880413#M35189</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, that was the fix. Although I needed to use the "16 bit bus", not the high performance one. Does not work on high performance. Too bad there is not any details of what the difference is.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Another parts of code was overwriting it to use the high performance. I have it like this now and it seems to pass all tests. Thank you for your help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;DIV style="color: #d4d4d4; background-color: #1e1e1e; font-weight: normal; font-size: 14px;"&gt;&lt;DIV&gt;&lt;SPAN style="color: #c586c0;"&gt;#define&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;HW_SDRAM_DEV_MEMORYMAP&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt; (&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;0x21u&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;) &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;// 16Mbits (1M*16, 2banks, 11 rows, 8 columns)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Mar 2019 14:55:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/External-SDRAM-EMC-Configuration-Help-W9816G6JH-6/m-p/880413#M35189</guid>
      <dc:creator>guitardenver</dc:creator>
      <dc:date>2019-03-27T14:55:56Z</dc:date>
    </item>
  </channel>
</rss>

