<?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中的主题 Re: LPC4337 IAP erase flash hang</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC4337-IAP-erase-flash-hang/m-p/566575#M17343</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, for me this issue was solved by a) setting the correct CPU clock in the IAP requests and esp. b) calling the IAP_INIT function (decimal code 49) beforehand.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 04 Feb 2018 15:46:56 GMT</pubDate>
    <dc:creator>svenb_</dc:creator>
    <dc:date>2018-02-04T15:46:56Z</dc:date>
    <item>
      <title>LPC4337 IAP erase flash hang</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC4337-IAP-erase-flash-hang/m-p/566570#M17338</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there, I am having a problem with IAP rom code hanging on the LPC4337.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a bootloader in flash bank A and application code in flash bank B.&lt;/P&gt;&lt;P&gt;I can erase bank B, read the app code from the SD card and program the flash just fine under the debugger. However if I run the board without debugging it hangs. When I attach to the running code I find that the MCU stuck in a loop reading the FMSTAT register at 0x4000dfe0. I appears the loop is waiting for the SIG_DONE bit to be set and this never happens. See assembly code below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After checking for the obvious things like interrupts being enabled etc. I reverted to the LPC4337 LPCOpen example code, periph_flashiap, just to remove any variables that may be introduced by my own code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I get the same result. I appears to be during the sector erase IAP call. The sector(s) are prepared for write/erase but the erase call never returns unless I run the code under the debugger.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The LPCOpen example uses the last sector in bank A whereas I am using bank B so the FMSTAT for bank A is being checked.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the relevant bit of assembly code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;r0 = 0x4000d000 or 0x4000c000 depending in flash bank being used&lt;/P&gt;&lt;P&gt;r5 = 0x00000fe0 offset to FMSTAT register&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;r1 contains 0x00000008 after reading the FMSTAT register.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;104019da:&amp;nbsp;&amp;nbsp; b.n&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x104019c8&lt;BR /&gt;104019dc:&amp;nbsp;&amp;nbsp; adds&amp;nbsp;&amp;nbsp;&amp;nbsp; r1, r5, #1&lt;BR /&gt;104019de:&amp;nbsp;&amp;nbsp; beq.n&amp;nbsp;&amp;nbsp; 0x104019d6&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;104019e0:&amp;nbsp;&amp;nbsp; ldr&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; r1, [r0, r5]&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;-- Looping here&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;104019e2:&amp;nbsp;&amp;nbsp; lsls&amp;nbsp;&amp;nbsp;&amp;nbsp; r1, r1, #29&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;104019e4:&amp;nbsp;&amp;nbsp; beq.n&amp;nbsp;&amp;nbsp; 0x104019e0&lt;/STRONG&gt;&lt;/EM&gt;&lt;BR /&gt;104019e6:&amp;nbsp;&amp;nbsp; pop&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {r4, r5, pc}&lt;BR /&gt;104019e8:&amp;nbsp;&amp;nbsp; push&amp;nbsp;&amp;nbsp;&amp;nbsp; {r0, r1, r2, r3, r4, r5, r6, r7, lr}&lt;BR /&gt;104019ea:&amp;nbsp;&amp;nbsp; sub&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sp, #12&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A further problem that I have noticed with the example code is that the Chip_FMC_ComputeSignatureBlocks() call generates a hard fault. Specifically, the fault happens when writing to the FMSTATCLR register in fmc_18xx_43xx.h, although it is flagged as imprecise to I can't be too sure.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;STATIC INLINE void Chip_FMC_ComputeSignature(uint8_t bank, uint32_t start, uint32_t stop)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;LPC_FMC[bank]-&amp;gt;FMSSTART = (start &amp;gt;&amp;gt; 4);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;LPC_FMC[bank]-&amp;gt;FMSTATCLR = FMC_FLASHSIG_STAT;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;-- Hard fault here&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;LPC_FMC[bank]-&amp;gt;FMSSTOP = (stop &amp;gt;&amp;gt; 4) | FMC_FLASHSIG_BUSY;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am not using this feature yet but this is unmodified example code and I figure it should work.&lt;/P&gt;&lt;P&gt;As soon as I hit this hard fault lpcxpresso completely freezes and has to be killed externally.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using version 8.2.0 of lpcxpresso with the latest GDB as I know there are problems with the version supplied with 8.2.0.&lt;/P&gt;&lt;P&gt;Any help on these issue would be greatly appreciated.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mike&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 27 Aug 2016 22:00:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC4337-IAP-erase-flash-hang/m-p/566570#M17338</guid>
      <dc:creator>definium</dc:creator>
      <dc:date>2016-08-27T22:00:48Z</dc:date>
    </item>
    <item>
      <title>Re: LPC4337 IAP erase flash hang</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC4337-IAP-erase-flash-hang/m-p/566571#M17339</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Found the problem with the Chip_FMC_ComputeSignatureBlocks() function.&lt;/P&gt;&lt;P&gt;LPC_FMC is being declared as a pointer to a pointer but it is not. It is a pointer to a struct.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#define LPC_FMCA ((LPC_FMC_T *) LPC_FMCA_BASE)&lt;BR /&gt;&lt;EM&gt;&lt;STRONG&gt;#define LPC_FMC ((LPC_FMC_T * *) LPC_FMCA_BASE)&amp;nbsp;&lt;/STRONG&gt; &lt;/EM&gt;&lt;BR /&gt;#define LPC_FMCB ((LPC_FMC_T *) LPC_FMCB_BASE)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So the following line ends up trying to write the value (start &amp;gt;&amp;gt; 4) to a location pointed to by the contents of the FMSSTART register and that ends in tears.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LPC_FMC[bank]-&amp;gt;FMSSTART = (start &amp;gt;&amp;gt; 4);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I change the LPC_FMC declaration to the following in chip_lpc43xx.h:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;#define LPC_FMC ((LPC_FMC_T *) LPC_FMCA_BASE)&amp;nbsp;&lt;/STRONG&gt; &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;and then changed all the register references in fmc_18xx_43xx.h to dot notation, i.e.&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;LPC_FMC[bank].FMSSTART = (start &amp;gt;&amp;gt; 4);&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I wanted to attach the modified files but I just could find how to do it while posting this time.&lt;/P&gt;&lt;P&gt;Mike&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 27 Aug 2016 23:43:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC4337-IAP-erase-flash-hang/m-p/566571#M17339</guid>
      <dc:creator>definium</dc:creator>
      <dc:date>2016-08-27T23:43:16Z</dc:date>
    </item>
    <item>
      <title>Re: LPC4337 IAP erase flash hang</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC4337-IAP-erase-flash-hang/m-p/566572#M17340</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for reporting this - it should be fixed in the recent release of LPCOpen; the&amp;nbsp;LPC_FMC pointer definition was removed from chip_43xx.h.&amp;nbsp;&amp;nbsp; It is now done inside the Chip_FMC_ComputeSignatureBlocks routine.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Sep 2016 23:23:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC4337-IAP-erase-flash-hang/m-p/566572#M17340</guid>
      <dc:creator>brendonslade</dc:creator>
      <dc:date>2016-09-19T23:23:26Z</dc:date>
    </item>
    <item>
      <title>Re: LPC4337 IAP erase flash hang</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC4337-IAP-erase-flash-hang/m-p/566573#M17341</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have exactly the same issue but it does not happen on every chip, it only happens on 2 chips out of 8 chips I programmed. That's right, exactly the same code hangs in some chips and works well in the others.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just as Mike reported, during debug it works fine, while it&amp;nbsp;hangs if its not under debug mode.&amp;nbsp;Reading your post Mike, it is unclear to me if you managed to&amp;nbsp;resolve the bug which caused stalling in the IAP erase sector function, or you have only fixed a bug in the example&amp;nbsp;Chip_FMC_ComputeSignatureBlocks() function?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I did the modification of double pointer to a single one and changed functions to&amp;nbsp;dot notations, but it had no influence on stalling issue. That's logical to me as I would assume that IAP functions are in ROM address range (even our looping/hanging address 0x104019e0 is in ROM address range),&amp;nbsp;and&amp;nbsp;the ROM function itself shouldn't be influenced by a change in example function code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please let me know:&lt;/P&gt;&lt;P&gt;1) Did you resolved IAP eeprom erase sector hang issue?&lt;/P&gt;&lt;P&gt;2) If yes, what was the reason why it was happening?&lt;/P&gt;&lt;P&gt;3) If no, should I just assume I am dealing with a few faulty chips?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PS. My code optimization is level 0 - no optimization.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Stjepan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Nov 2017 23:30:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC4337-IAP-erase-flash-hang/m-p/566573#M17341</guid>
      <dc:creator>stype</dc:creator>
      <dc:date>2017-11-23T23:30:28Z</dc:date>
    </item>
    <item>
      <title>Re: LPC4337 IAP erase flash hang</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC4337-IAP-erase-flash-hang/m-p/566574#M17342</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have exactly the same issue, hang in these 3 instructions. I tried:&lt;/P&gt;&lt;P&gt;&amp;nbsp;- lowering the CPU clock to 20 MHz&lt;/P&gt;&lt;P&gt;&amp;nbsp;- not using the top 64 Byte of SRAM&lt;/P&gt;&lt;P&gt;&amp;nbsp;- using bigger alignments and different page sizes&lt;/P&gt;&lt;P&gt;&amp;nbsp;-disabling interrupts&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Nothing helped, always the same behaviour. Any tips?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Feb 2018 22:51:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC4337-IAP-erase-flash-hang/m-p/566574#M17342</guid>
      <dc:creator>svenb_</dc:creator>
      <dc:date>2018-02-02T22:51:46Z</dc:date>
    </item>
    <item>
      <title>Re: LPC4337 IAP erase flash hang</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC4337-IAP-erase-flash-hang/m-p/566575#M17343</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, for me this issue was solved by a) setting the correct CPU clock in the IAP requests and esp. b) calling the IAP_INIT function (decimal code 49) beforehand.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 04 Feb 2018 15:46:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC4337-IAP-erase-flash-hang/m-p/566575#M17343</guid>
      <dc:creator>svenb_</dc:creator>
      <dc:date>2018-02-04T15:46:56Z</dc:date>
    </item>
    <item>
      <title>Re: LPC4337 IAP erase flash hang</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC4337-IAP-erase-flash-hang/m-p/566576#M17344</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sven, thank you for the update.&lt;/P&gt;&lt;P&gt;Before you solved the problem, did all of your chips stalled or only some of them.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am asking since I didn't had a wrong CPU clock and I was calling the IAP_INIT beforehand. It works in almost all chips but some of them gets stalled for apparently no reason.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;S.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Mar 2018 17:46:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC4337-IAP-erase-flash-hang/m-p/566576#M17344</guid>
      <dc:creator>stype</dc:creator>
      <dc:date>2018-03-12T17:46:13Z</dc:date>
    </item>
  </channel>
</rss>

