<?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 for 75% DTCM occupied in i.MX RT Crossover MCUs</title>
    <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Hard-fault-for-75-DTCM-occupied/m-p/1561178#M22692</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/179182"&gt;@Davidino&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;The FlexRAM settings seems fine. I also test on my board, it can work. I can write data to 0x20077000, but can't write to 20079000. So, it works.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Jing&lt;/P&gt;</description>
    <pubDate>Tue, 29 Nov 2022 08:41:28 GMT</pubDate>
    <dc:creator>jingpan</dc:creator>
    <dc:date>2022-11-29T08:41:28Z</dc:date>
    <item>
      <title>Hard fault for 75% DTCM occupied</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Hard-fault-for-75-DTCM-occupied/m-p/1559478#M22630</link>
      <description>&lt;P&gt;Goodmorning,&lt;/P&gt;&lt;P&gt;I'm using a iMXRT1064 with SDK 1.11 and MCUExpresso 11.6.0.&lt;/P&gt;&lt;P&gt;The memory configuration is:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Senza titolo.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/201644i413F1C4341A1B035/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Senza titolo.png" alt="Senza titolo.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The memory occupation is the following:&lt;/P&gt;&lt;P&gt;Memory region&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Used Size Region Size %age Used&lt;BR /&gt;PROGRAM_FLASH:&amp;nbsp;&amp;nbsp;&amp;nbsp; 555596 B&amp;nbsp; 4 MB&amp;nbsp;&amp;nbsp;&amp;nbsp; 13.25%&lt;BR /&gt;SRAM_DTC:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 274208 B&amp;nbsp; 384 KB 69.73%&lt;BR /&gt;SRAM_ITC:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 21328 B&amp;nbsp;&amp;nbsp;&amp;nbsp; 128 KB 16.27%&lt;BR /&gt;SRAM_OC:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 26 KB&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 512 KB 5.08%&lt;/P&gt;&lt;P&gt;If I move the data from OCRAM (about 5% occupation) to DTCM (about 70% occupation) the program crashes. If I leave the data in OCRAM the program runs perfectly.&lt;/P&gt;&lt;P&gt;The data that occupies 26kB is a single array of struct.&lt;/P&gt;&lt;P&gt;What are the possible reasons why the program crashes despite not having overflow 100% of memory occupation?&lt;/P&gt;&lt;P&gt;In attachment the .map file of my project.&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Nov 2022 13:42:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Hard-fault-for-75-DTCM-occupied/m-p/1559478#M22630</guid>
      <dc:creator>Davidino</dc:creator>
      <dc:date>2022-11-24T13:42:35Z</dc:date>
    </item>
    <item>
      <title>Re: Hard fault for 75% DTCM occupied</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Hard-fault-for-75-DTCM-occupied/m-p/1560513#M22667</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/179182"&gt;@Davidino&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Maybe there is some bugs in application, like stack overflow.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Jing&lt;/P&gt;</description>
      <pubDate>Mon, 28 Nov 2022 09:39:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Hard-fault-for-75-DTCM-occupied/m-p/1560513#M22667</guid>
      <dc:creator>jingpan</dc:creator>
      <dc:date>2022-11-28T09:39:43Z</dc:date>
    </item>
    <item>
      <title>Re: Hard fault for 75% DTCM occupied</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Hard-fault-for-75-DTCM-occupied/m-p/1560561#M22669</link>
      <description>&lt;P&gt;Hello &lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/61241"&gt;@jingpan&lt;/a&gt; ,&lt;/P&gt;&lt;P&gt;thank you for your answer.&lt;/P&gt;&lt;P&gt;Below you can find the stack and heap usage in the working project, at full operation: &lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dasasd.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/201890iC9F43F8B11C8C669/image-size/medium?v=v2&amp;amp;px=400" role="button" title="dasasd.png" alt="dasasd.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;And here the stack and heap usage in the NOT working project, when the error triggers: &lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Davidino_2-1669630916160.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/201893i520D3A847CBB5B77/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Davidino_2-1669630916160.png" alt="Davidino_2-1669630916160.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;If the problem was the stack overflow, I think that it would be visible here.&lt;/P&gt;&lt;P&gt;Since the project is very complex, I propose an hypothetichal cause for the error.&lt;/P&gt;&lt;P&gt;Following the link: &lt;A href="https://community.nxp.com/t5/i-MX-RT/How-to-reconfigure-the-flexRAM-on-i-mxRT-1062-using-MCUXpresso/td-p/1098523" target="_blank" rel="noopener"&gt;https://community.nxp.com/t5/i-MX-RT/How-to-reconfigure-the-flexRAM-on-i-mxRT-1062-using-MCUXpresso/td-p/1098523&lt;/A&gt; , I reconfigured the FlexRam in run time with the following modifications and below I highlight the most significant changes:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="gdfgfdgdfgdfgdfgd.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/201894iD92260162ED6B960/image-size/medium?v=v2&amp;amp;px=400" role="button" title="gdfgfdgdfgdfgdfgd.png" alt="gdfgfdgdfgdfgdfgd.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="fgdfsggfdssfdfsdsfdsfd.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/201895iAE9A20E6B95C9171/image-size/medium?v=v2&amp;amp;px=400" role="button" title="fgdfsggfdssfdfsdsfdsfd.png" alt="fgdfsggfdssfdfsdsfdsfd.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The code at startup is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;__attribute__ ((section(".after_vectors.reset")))
void ResetISR(void) {

    // Disable interrupts
    __asm volatile ("cpsid i");

    /* Reallocating the FlexRAM */
     __asm (".syntax unified\n"

    		 "LDR R0, =0x20003fff\n"	// load initial value to stack pointer into R0
    	     "MSR MSP,R0\n"				// re-initialize stack pointer by new value

    		 "LDR R0, =0x400ac044\n"	// Address of register IOMUXC_GPR_GPR17
    		 	 	 	 	 			// Modificato rispetto all'originale per rispettare la configurazione via eFuses
    		 //"LDR R1, =0x5AAFFAA5\n"	// FlexRAM configuration DTC = 256KB, ITC = 128KB, OC = 128KB
    		 //"LDR R1, =0xAAAFFAAA\n"	// FlexRAM configuration DTC = 384KB, ITC = 128KB, OC = 0KB
    		 "LDR R1, =0xEAAAAAAA\n"	// FlexRAM configuration DTC = 480KB, ITC = 32KB, OC = 0KB
    		 "STR R1,[R0]\n"

    		 "LDR R0,=0x400ac040\n"		// Address of register IOMUXC_GPR_GPR16
    		 "LDR R1,[R0]\n"
    		 "ORR R1,R1,#4\n"			// The 4 corresponds to setting the FLEXRAM_BANK_CFG_SEL bit in register IOMUXC_GPR_GPR16
    		 "STR R1,[R0]\n"
...&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And the MPU configuration is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;    /* Region 0 setting: Instruction access disabled, No data access permission. */
    MPU-&amp;gt;RBAR = ARM_MPU_RBAR(0, 0x00000000U);
    MPU-&amp;gt;RASR = ARM_MPU_RASR(1, ARM_MPU_AP_NONE, 2, 0, 0, 0, 0, ARM_MPU_REGION_SIZE_4GB);

    /* Region 1 setting: Memory with Device type, not shareable, non-cacheable. */
    MPU-&amp;gt;RBAR = ARM_MPU_RBAR(1, 0x80000000U);
    MPU-&amp;gt;RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 2, 0, 0, 0, 0, ARM_MPU_REGION_SIZE_512MB);

    /* Region 2 setting: Memory with Device type, not shareable,  non-cacheable. */
    MPU-&amp;gt;RBAR = ARM_MPU_RBAR(2, 0x60000000U);
    MPU-&amp;gt;RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 2, 0, 0, 0, 0, ARM_MPU_REGION_SIZE_512MB);

#if defined(XIP_EXTERNAL_FLASH) &amp;amp;&amp;amp; (XIP_EXTERNAL_FLASH == 1)
    /* Region 3 setting: Memory with Normal type, not shareable, outer/inner write back. */
    MPU-&amp;gt;RBAR = ARM_MPU_RBAR(3, 0x70000000U);
    MPU-&amp;gt;RASR = ARM_MPU_RASR(0, ARM_MPU_AP_RO, 0, 0, 1, 1, 0, ARM_MPU_REGION_SIZE_4MB);
#endif

    /* Region 4 setting: Memory with Device type, not shareable, non-cacheable. */
    MPU-&amp;gt;RBAR = ARM_MPU_RBAR(4, 0x00000000U);
    MPU-&amp;gt;RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 2, 0, 0, 0, 0, ARM_MPU_REGION_SIZE_1GB);

    /* Region 5 setting: Memory with Normal type, not shareable, outer/inner write back */
    MPU-&amp;gt;RBAR = ARM_MPU_RBAR(5, 0x00000000U);
    MPU-&amp;gt;RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 0, 0, 1, 1, 0, ARM_MPU_REGION_SIZE_32KB);		// ITCM

    /* Region 6 setting: Memory with Normal type, not shareable, outer/inner write back */
    MPU-&amp;gt;RBAR = ARM_MPU_RBAR(6, 0x20000000U);
    MPU-&amp;gt;RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 0, 0, 1, 1, 0, ARM_MPU_REGION_SIZE_512KB);		// DTCM

    /* Region 7 setting: Memory with Normal type, not shareable, outer/inner write back */
    MPU-&amp;gt;RBAR = ARM_MPU_RBAR(7, 0x20200000U);
    MPU-&amp;gt;RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 0, 0, 1, 1, 0, ARM_MPU_REGION_SIZE_512KB);		// OCRAM

    /* Region 8 setting: Memory with Normal type, not shareable, outer/inner write back */
    //MPU-&amp;gt;RBAR = ARM_MPU_RBAR(8, 0x20280000U);
    //MPU-&amp;gt;RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 0, 0, 1, 1, 0, ARM_MPU_REGION_SIZE_512KB);

    /* Region 11 setting: Memory with Device type, not shareable, non-cacheable */
    MPU-&amp;gt;RBAR = ARM_MPU_RBAR(11, 0x40000000);
    MPU-&amp;gt;RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 2, 0, 0, 0, 0, ARM_MPU_REGION_SIZE_4MB);

    /* Region 12 setting: Memory with Device type, not shareable, non-cacheable */
    MPU-&amp;gt;RBAR = ARM_MPU_RBAR(12, 0x42000000);
    MPU-&amp;gt;RASR = ARM_MPU_RASR(0, ARM_MPU_AP_FULL, 2, 0, 0, 0, 0, ARM_MPU_REGION_SIZE_1MB);

    /* Enable MPU */
    ARM_MPU_Enable(MPU_CTRL_PRIVDEFENA_Msk);

    /* Enable I cache and D cache */
    SCB_EnableDCache();
    SCB_EnableICache();
...&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you think that this changes are fine, I close the topic as it's too difficult via chat to examine anything.&lt;/P&gt;&lt;P&gt;Thank you in advanced.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Davidino&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Nov 2022 10:50:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Hard-fault-for-75-DTCM-occupied/m-p/1560561#M22669</guid>
      <dc:creator>Davidino</dc:creator>
      <dc:date>2022-11-28T10:50:57Z</dc:date>
    </item>
    <item>
      <title>Re: Hard fault for 75% DTCM occupied</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Hard-fault-for-75-DTCM-occupied/m-p/1561178#M22692</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/179182"&gt;@Davidino&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;The FlexRAM settings seems fine. I also test on my board, it can work. I can write data to 0x20077000, but can't write to 20079000. So, it works.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Jing&lt;/P&gt;</description>
      <pubDate>Tue, 29 Nov 2022 08:41:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Hard-fault-for-75-DTCM-occupied/m-p/1561178#M22692</guid>
      <dc:creator>jingpan</dc:creator>
      <dc:date>2022-11-29T08:41:28Z</dc:date>
    </item>
    <item>
      <title>Re: Hard fault for 75% DTCM occupied</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Hard-fault-for-75-DTCM-occupied/m-p/1561187#M22693</link>
      <description>&lt;P&gt;Hello &lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/61241"&gt;@jingpan&lt;/a&gt; ,&lt;/P&gt;&lt;P&gt;thank you for your answer and confirmation. For the moment I found a work-around using OCRAM, in the future I'll dig deeper what may be the cause of the problem.&lt;/P&gt;&lt;P&gt;Thank you again.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Nov 2022 08:58:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Hard-fault-for-75-DTCM-occupied/m-p/1561187#M22693</guid>
      <dc:creator>Davidino</dc:creator>
      <dc:date>2022-11-29T08:58:33Z</dc:date>
    </item>
  </channel>
</rss>

