<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: hard fault when FreeRTOS heap is in external SDRAM in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/hard-fault-when-FreeRTOS-heap-is-in-external-SDRAM/m-p/521922#M4558</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by MikeSimmonds on Thu Nov 06 04:49:30 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, the debugger allows for a 'data' breakpoint.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Break (code) in the Reset code, place a watchpoint on the pointer's address&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[the address of the variable, not where it is pointing] and see where/when is it initialised&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;and or changed?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Mike&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 17:53:13 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T17:53:13Z</dc:date>
    <item>
      <title>hard fault when FreeRTOS heap is in external SDRAM</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/hard-fault-when-FreeRTOS-heap-is-in-external-SDRAM/m-p/521920#M4556</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Alex on Thu Nov 06 03:16:37 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm running a LPC1778 with a 16Mbit external SDRAM. The LPC runs at 120MHz and the SDRAM at 60MHz.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The application uses FreeRTOS and lwip.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I made a stripped down version that fits completly in the internal RAM to check if it is an SDRAM issue or a general software problem.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;When I place the FreeRTOS heap in external RAM I get a hard fault while initializing lwip. It seems that a ponter is corrupted.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;When I place the FreeRTOS heap in internal RAM the application runs without problems.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I already did a test with a reduced clock frequency of 32 MHz but the result is the same.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The SDRAM is tested on every startup using this test:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;code&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;for(int j = 0; j &amp;lt; 3; ++j)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; unsigned int* adr = (unsigned int*) 0xA0000000;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for(unsigned int i = 0; i &amp;lt; (256 * 1024); ++i)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *adr++ = (i &amp;lt;&amp;lt; 18) | i;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; adr = (unsigned int*) 0xA0000000;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for(unsigned int i = 0; i &amp;lt; (256 * 1024); ++i)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; unsigned int tmp = *adr++;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(tmp != ((i &amp;lt;&amp;lt; 18) | i))&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; goto SD_RAM_ERROR;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; adr = (unsigned int*) 0xA0000000;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for(unsigned int i = 0; i &amp;lt; (256 * 1024); ++i)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *adr++ = 0xA5A5A5A5;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; adr = (unsigned int*) 0xA0000000;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for(unsigned int i = 0; i &amp;lt; (256 * 1024); ++i)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; unsigned int tmp = *adr++;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(tmp != 0xA5A5A5A5)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; goto SD_RAM_ERROR;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; unsigned int* adr = (unsigned int*) 0xA0000000;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; for(int i = 0; i &amp;lt; 32; ++i)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; *adr = 1 &amp;lt;&amp;lt; i;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(*adr != 1 &amp;lt;&amp;lt; i)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; goto SD_RAM_ERROR;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;/code&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The test runs without any problems.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The FreeRTOS heap size is 35 kB and placed at address 0xA0000000.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there something to consider when placing something in external SDRAM? Read/Write timing or memory alignment?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Alex&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:53:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/hard-fault-when-FreeRTOS-heap-is-in-external-SDRAM/m-p/521920#M4556</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T17:53:12Z</dc:date>
    </item>
    <item>
      <title>Re: hard fault when FreeRTOS heap is in external SDRAM</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/hard-fault-when-FreeRTOS-heap-is-in-external-SDRAM/m-p/521921#M4557</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by MikeSimmonds on Thu Nov 06 04:44:41 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Silly question perhaps, but you have initialised SDRAM &lt;/SPAN&gt;&lt;I&gt;before&lt;/I&gt;&lt;SPAN&gt; initialising the RTOS and LWIP?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Does the RTOS do anything with the MPU re 'protecting' the A0000000 area?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Mike&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:53:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/hard-fault-when-FreeRTOS-heap-is-in-external-SDRAM/m-p/521921#M4557</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T17:53:13Z</dc:date>
    </item>
    <item>
      <title>Re: hard fault when FreeRTOS heap is in external SDRAM</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/hard-fault-when-FreeRTOS-heap-is-in-external-SDRAM/m-p/521922#M4558</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by MikeSimmonds on Thu Nov 06 04:49:30 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, the debugger allows for a 'data' breakpoint.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Break (code) in the Reset code, place a watchpoint on the pointer's address&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[the address of the variable, not where it is pointing] and see where/when is it initialised&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;and or changed?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Mike&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:53:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/hard-fault-when-FreeRTOS-heap-is-in-external-SDRAM/m-p/521922#M4558</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T17:53:13Z</dc:date>
    </item>
    <item>
      <title>Re: hard fault when FreeRTOS heap is in external SDRAM</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/hard-fault-when-FreeRTOS-heap-is-in-external-SDRAM/m-p/521923#M4559</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Alex on Thu Nov 06 06:57:57 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;The SDRAM is initialized correctly. Directly after initialising the SDRAM the test code is executed to check if it works correctly.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The MPU is not touched by the OS.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I will do some tests using a data breakpoint. Thanks for the hint.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Alex&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:53:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/hard-fault-when-FreeRTOS-heap-is-in-external-SDRAM/m-p/521923#M4559</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T17:53:14Z</dc:date>
    </item>
    <item>
      <title>Re: hard fault when FreeRTOS heap is in external SDRAM</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/hard-fault-when-FreeRTOS-heap-is-in-external-SDRAM/m-p/521924#M4560</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Alex on Fri Nov 07 04:00:47 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I got it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The setting of the EMCDLYCTL register was not correct. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Now I'm using:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_SC-&amp;gt;EMCDLYCTL = 0x1410;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_EMC-&amp;gt;DynamicReadConfig = EMC_DynamicReadConfig_RD(1);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Alex&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:53:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/hard-fault-when-FreeRTOS-heap-is-in-external-SDRAM/m-p/521924#M4560</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T17:53:15Z</dc:date>
    </item>
  </channel>
</rss>

