<?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のトピックLPC4357 FreeRTOS cause fault after SoftReset</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC4357-FreeRTOS-cause-fault-after-SoftReset/m-p/947071#M37666</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a little problem on a LPC4357 running FreeRTOS 8.2.&lt;/P&gt;&lt;P&gt;Problem is that when I execute a SoftReset MCU restart but during EMC SDRAM initialization it stop working, with loss of LPC-Link 2 debugger control. So, no HardFault, olny stop ecxecution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The function where CPU stop working is this:&amp;nbsp;SystemInit_ExtMemCtl (void)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="xnxp.JPG"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/95758i733C2C59227200D8/image-size/large?v=v2&amp;amp;px=999" role="button" title="xnxp.JPG" alt="xnxp.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From some research I think it should be a Stack Pointer problem, but not sure about that, FreeRTOS Heap in my application is located in External SDRAM, and if I call the SoftReset routine before FreeRTOS start no problem with EMC init.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="xnxp2.JPG"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/95759i3F6E72B625AB9D0F/image-size/large?v=v2&amp;amp;px=999" role="button" title="xnxp2.JPG" alt="xnxp2.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I made a SoftReset after these instruction, system stop working during initialization in the Reset ISR.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The same code work right with a LPC4088 in the same condition (Ext RAM FreeRTOS Heap, same reset routine) with no problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In LPC 4357 I'm working only with Core M4&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance to anyone who could help me.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 04 Oct 2019 12:58:40 GMT</pubDate>
    <dc:creator>alessioschisano</dc:creator>
    <dc:date>2019-10-04T12:58:40Z</dc:date>
    <item>
      <title>LPC4357 FreeRTOS cause fault after SoftReset</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC4357-FreeRTOS-cause-fault-after-SoftReset/m-p/947071#M37666</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a little problem on a LPC4357 running FreeRTOS 8.2.&lt;/P&gt;&lt;P&gt;Problem is that when I execute a SoftReset MCU restart but during EMC SDRAM initialization it stop working, with loss of LPC-Link 2 debugger control. So, no HardFault, olny stop ecxecution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The function where CPU stop working is this:&amp;nbsp;SystemInit_ExtMemCtl (void)&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="xnxp.JPG"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/95758i733C2C59227200D8/image-size/large?v=v2&amp;amp;px=999" role="button" title="xnxp.JPG" alt="xnxp.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From some research I think it should be a Stack Pointer problem, but not sure about that, FreeRTOS Heap in my application is located in External SDRAM, and if I call the SoftReset routine before FreeRTOS start no problem with EMC init.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="xnxp2.JPG"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/95759i3F6E72B625AB9D0F/image-size/large?v=v2&amp;amp;px=999" role="button" title="xnxp2.JPG" alt="xnxp2.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I made a SoftReset after these instruction, system stop working during initialization in the Reset ISR.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The same code work right with a LPC4088 in the same condition (Ext RAM FreeRTOS Heap, same reset routine) with no problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In LPC 4357 I'm working only with Core M4&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance to anyone who could help me.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Oct 2019 12:58:40 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC4357-FreeRTOS-cause-fault-after-SoftReset/m-p/947071#M37666</guid>
      <dc:creator>alessioschisano</dc:creator>
      <dc:date>2019-10-04T12:58:40Z</dc:date>
    </item>
    <item>
      <title>Re: LPC4357 FreeRTOS cause fault after SoftReset</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC4357-FreeRTOS-cause-fault-after-SoftReset/m-p/947072#M37667</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Fixed it! Below the solution, hope it helps others in future. Simply need to relocate the MSP and PSP register before resetting:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;void (*user_code_entry)(void);&lt;BR /&gt;unsigned *p;&lt;/P&gt;&lt;P&gt;void SoftReset(void){&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;__disable_irq();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;SysTick-&amp;gt;CTRL = 0; // Disable System timer&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;// disable and clear pending IRQs&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;for (uint32_t i = 0; i &amp;lt; 8; i++)&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;NVIC-&amp;gt;ICER[i] = 0xFFFFFFFF; // disable IRQ&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;NVIC-&amp;gt;ICPR[i] = 0xFFFFFFFF; // clear pending IRQ&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;// Barriers&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;__DSB(); // data synchronization barrier&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;__ISB(); // instruction synchronization barrier&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;SCB-&amp;gt;VTOR = 0x1A010000 &amp;amp; 0x1FFFFF80;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;// Rebase the Stack Pointer&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;__set_MSP(*(uint32_t *) (0x1A010000 &amp;amp; 0x1FFFFF80));&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;__set_PSP(*(uint32_t *) (0x1A010000 &amp;amp; 0x1FFFFF80));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;p = (unsigned *)(0x1A010000 + 4);&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;user_code_entry = (void *) *p;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;__DSB();&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;__ISB();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;user_code_entry();&lt;BR /&gt; }&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Oct 2019 13:40:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC4357-FreeRTOS-cause-fault-after-SoftReset/m-p/947072#M37667</guid>
      <dc:creator>alessioschisano</dc:creator>
      <dc:date>2019-10-08T13:40:16Z</dc:date>
    </item>
  </channel>
</rss>

