<?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 repeated writes to iap_entry(command, result) cause hard fault in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/repeated-writes-to-iap-entry-command-result-cause-hard-fault/m-p/537359#M11447</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by williamjsell on Wed Jan 20 16:28:27 MST 2016&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a FreeRTOS thread which is unblocks every 5ms.&amp;nbsp; It calls the iap_entry function to extract data from the EEPROM.&amp;nbsp; Works great for about 10s then hard faults.&amp;nbsp; There is no call stack context as all the PC register and stack pointer contain garbage.&amp;nbsp; However, I traced it down to the iap_entry call.&amp;nbsp; Anyone encountered any problems with the iap? &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 19:36:37 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T19:36:37Z</dc:date>
    <item>
      <title>repeated writes to iap_entry(command, result) cause hard fault</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/repeated-writes-to-iap-entry-command-result-cause-hard-fault/m-p/537359#M11447</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by williamjsell on Wed Jan 20 16:28:27 MST 2016&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a FreeRTOS thread which is unblocks every 5ms.&amp;nbsp; It calls the iap_entry function to extract data from the EEPROM.&amp;nbsp; Works great for about 10s then hard faults.&amp;nbsp; There is no call stack context as all the PC register and stack pointer contain garbage.&amp;nbsp; However, I traced it down to the iap_entry call.&amp;nbsp; Anyone encountered any problems with the iap? &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 19:36:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/repeated-writes-to-iap-entry-command-result-cause-hard-fault/m-p/537359#M11447</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T19:36:37Z</dc:date>
    </item>
    <item>
      <title>Re: repeated writes to iap_entry(command, result) cause hard fault</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/repeated-writes-to-iap-entry-command-result-cause-hard-fault/m-p/537360#M11448</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by williamjsell on Wed Jan 20 18:19:22 MST 2016&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I did find this comment on-line:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;"Don't forget to modify the stack pointer in your linker file to not use the last 32-bytes of the SRAM (because it's used by the IAP functions)."&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;this would explain the crash, but this begs my next question: Which SRAM is it referring to, in the LPC11U68, there is main sram ending at x10008000, and a 2K segment ending at 0x20000800.&amp;nbsp; Anyone know?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 19:36:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/repeated-writes-to-iap-entry-command-result-cause-hard-fault/m-p/537360#M11448</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T19:36:38Z</dc:date>
    </item>
    <item>
      <title>Re: repeated writes to iap_entry(command, result) cause hard fault</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/repeated-writes-to-iap-entry-command-result-cause-hard-fault/m-p/537361#M11449</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by williamjsell on Thu Jan 21 10:39:49 MST 2016&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried shielding off 32 bytes at both the top and bottom of RAM1 and RAM2, but this does not make a difference.&amp;nbsp; Is there anyone who can help here?&amp;nbsp; Please!!!&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 19:36:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/repeated-writes-to-iap-entry-command-result-cause-hard-fault/m-p/537361#M11449</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T19:36:38Z</dc:date>
    </item>
    <item>
      <title>Re: repeated writes to iap_entry(command, result) cause hard fault</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/repeated-writes-to-iap-entry-command-result-cause-hard-fault/m-p/537362#M11450</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by williamjsell on Thu Jan 21 13:01:17 MST 2016&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;The caller:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;ee_section_info_t *GetEEPROMData(SectionTypes sectionIndex)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; xSemaphoreTake(eepromMutex, portMAX_DELAY);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; uint8_t *base, *offset, retval = 0;&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; base = (uint8_t *)&amp;amp;ee;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; offset = (uint8_t *)SectionPointers[sectionIndex].ptr;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; retval = Chip_EEPROM_Read(offset - base, (uint8_t *)SectionPointers[sectionIndex].ptr, SectionPointers[sectionIndex].size);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(retval != 0) &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;&amp;nbsp;&amp;nbsp; //generate error&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WriteStatus(STATUS_EEPROM_READ_ERROR, true);&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; else&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;&amp;nbsp;&amp;nbsp; WriteStatus(STATUS_EEPROM_READ_ERROR, false);&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; xSemaphoreGive(eepromMutex);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return SectionPointers[sectionIndex].ptr; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;the callee:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;/* Read data from EEPROM */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;uint8_t Chip_EEPROM_Read(uint32_t srcAdd, uint8_t *ptr, uint32_t bytesrd)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; static uint32_t count = 0;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;uint32_t command[5], result[4];&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;command[0] = IAP_EEPROM_READ;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;command[1] = srcAdd;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;command[2] = (uint32_t) ptr;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;command[3] = bytesrd;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;command[4] = SystemCoreClock / 1000;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; iap_entry(command, result);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;return result[0];&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 19:36:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/repeated-writes-to-iap-entry-command-result-cause-hard-fault/m-p/537362#M11450</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T19:36:39Z</dc:date>
    </item>
    <item>
      <title>Re: repeated writes to iap_entry(command, result) cause hard fault</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/repeated-writes-to-iap-entry-command-result-cause-hard-fault/m-p/537363#M11451</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by lpcxpresso-support on Fri Jan 22 03:56:44 MST 2016&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;If you aren't already, it might be worth trying to disable interrupts around the IAP call.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The other thing to check would be how much stack space you have - particularly as it sounds like this call is being made from a particular FreeRTOS thread. Where is the stack for this thread, and how much space is allocated?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPCXpresso Support&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 19:36:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/repeated-writes-to-iap-entry-command-result-cause-hard-fault/m-p/537363#M11451</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T19:36:39Z</dc:date>
    </item>
    <item>
      <title>Re: repeated writes to iap_entry(command, result) cause hard fault</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/repeated-writes-to-iap-entry-command-result-cause-hard-fault/m-p/537364#M11452</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by williamjsell on Fri Jan 22 09:25:38 MST 2016&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks, disabling the interrupts during read cured the problem.&amp;nbsp; I added the interrupt disable to the write side as well, I will test this and post the results on this thread&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 19:36:40 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/repeated-writes-to-iap-entry-command-result-cause-hard-fault/m-p/537364#M11452</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T19:36:40Z</dc:date>
    </item>
  </channel>
</rss>

