<?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: Unable to use 4k blocks for progamming when calling ISP from user code in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/Unable-to-use-4k-blocks-for-progamming-when-calling-ISP-from/m-p/719176#M29087</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What works:&lt;/P&gt;&lt;P&gt;Place the LPC in ISP mode by pulling&amp;nbsp; PIO0_1 low during poweron.&lt;/P&gt;&lt;P&gt;call:&lt;/P&gt;&lt;P&gt;lpc21isp -hex image.hex /dev/ttyUSB0 19200 12000&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;lpc21isp version 1.97&lt;BR /&gt;File image.hex:&lt;BR /&gt; loaded...&lt;BR /&gt;Start Address = 0x00001011&lt;BR /&gt; converted to binary format...&lt;BR /&gt; image size : 4588&lt;BR /&gt;Image size : 4588&lt;BR /&gt;Synchronizing (ESC to abort). OK&lt;BR /&gt;Read bootcode version: 2&lt;BR /&gt;7&lt;BR /&gt;Read part ID: LPC1114.../333, 32 kiB FLASH / 8 kiB SRAM (0x00040070)&lt;BR /&gt;Will start programming at Sector 1 if possible, and conclude with Sector 0 to ensure that checksum is written last.&lt;BR /&gt;Erasing sector 0 first, to invalidate checksum. OK &lt;BR /&gt;Sector 1: ...............&lt;BR /&gt;Sector 0: ..............................................................................................&lt;BR /&gt;Download Finished... taking 0 seconds&lt;BR /&gt;Now launching the brand new code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The code programmed also contains code to jump to the ISP mode so I can reprogam without having to use the ISP pin&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My code to start the ISP:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;typedef void (*IAP)(uint32_t[], uint32_t[]);&lt;BR /&gt;static IAP iap_entry = (IAP) 0x1fff1ff1;&lt;BR /&gt;static uint32_t command[5];&lt;BR /&gt;static uint32_t result[4];&lt;/P&gt;&lt;P&gt;void bootloader_start(void)&lt;BR /&gt;{&lt;BR /&gt; &amp;nbsp;&amp;nbsp; __disable_irq();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; LPC_SYSCON-&amp;gt;SYSAHBCLKCTRL |= SYSAHBCLKCTRL_CT32B1;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; LPC_SYSCON-&amp;gt;SYSAHBCLKCTRL |= SYSAHBCLKCTRL_GPIO;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; LPC_SYSCON-&amp;gt;SYSAHBCLKCTRL |= SYSAHBCLKCTRL_IOCON;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;LPC_SYSCON-&amp;gt;SYSAHBCLKDIV = 1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;command[0] = 57;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; __set_MSP(*((uint32_t *) 0x1FFF0000));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;iap_entry(command, result);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It enters the ISP, and I can communicate with the target, but if I then try to program the same lpc21isp command failes:&lt;/P&gt;&lt;P&gt;File image.hex:&lt;BR /&gt; loaded...&lt;BR /&gt;Start Address = 0x00001011&lt;BR /&gt; converted to binary format...&lt;BR /&gt; image size : 4588&lt;BR /&gt;Image size : 4588&lt;BR /&gt;Synchronizing (ESC to abort). OK&lt;BR /&gt;Read bootcode version: 2&lt;BR /&gt;7&lt;BR /&gt;Read part ID: LPC1114.../333, 32 kiB FLASH / 8 kiB SRAM (0x00040070)&lt;BR /&gt;Will start programming at Sector 1 if possible, and conclude with Sector 0 to ensure that checksum is written last.&lt;BR /&gt;Erasing sector 0 first, to invalidate checksum. OK &lt;BR /&gt;Sector 1: ...............&lt;BR /&gt;Sector 0: ...........................................................................Error on writing data (1)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I ran lpc21isp with debug info enabled and discovered that the error occured during the writing of data to RAM,&lt;/P&gt;&lt;P&gt;By default lpc21isp uses 4k blocks for the LPC1114/333 and the failure occurs between bytes 3195 and 3240.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I do the same but now using a adjusted version of lpc21isp to limit it the transfer size to RAM to 1024 it works:&lt;/P&gt;&lt;P&gt;File image.hex:&lt;BR /&gt; loaded...&lt;/P&gt;&lt;P&gt;Start Address = 0x00001011&lt;BR /&gt; converted to binary format...&lt;BR /&gt; image size : 4588&lt;BR /&gt;Image size : 4588&lt;BR /&gt;Synchronizing (ESC to abort). OK&lt;BR /&gt;Read bootcode version: 2&lt;BR /&gt;7&lt;BR /&gt;Read part ID: LPC1114.../333, 56 kiB FLASH / 8 kiB SRAM (0x00040070)&lt;BR /&gt;Will start programming at Sector 1 if possible, and conclude with Sector 0 to ensure that checksum is written last.&lt;BR /&gt;Erasing sector 0 first, to invalidate checksum. OK &lt;BR /&gt;Sector 1: ...............&lt;BR /&gt;Sector 0: ..........................|.........................|.........................|.........................&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 23 Mar 2018 13:02:15 GMT</pubDate>
    <dc:creator>bartvdmeulen</dc:creator>
    <dc:date>2018-03-23T13:02:15Z</dc:date>
    <item>
      <title>Unable to use 4k blocks for progamming when calling ISP from user code</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Unable-to-use-4k-blocks-for-progamming-when-calling-ISP-from/m-p/719174#M29085</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I try to program an LPC1114/333 using the ISP.&lt;/P&gt;&lt;P&gt;When I enter the ISP pulling PIO0_1 low during reset, I program the flash with any problems sector by sector by uploading blocks of 4k data to the RAM and program the flash.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However when I enter the ISP from user space, using the IAP command, I have to program the flash using 1k blocks, If i try to use 4k, the ISP crashes during the write action to RAM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In both cases I start to write to ram starting at address 0x10000300 (as per the user manual&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Mar 2018 16:14:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Unable-to-use-4k-blocks-for-progamming-when-calling-ISP-from/m-p/719174#M29085</guid>
      <dc:creator>bartvdmeulen</dc:creator>
      <dc:date>2018-03-21T16:14:09Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to use 4k blocks for progamming when calling ISP from user code</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Unable-to-use-4k-blocks-for-progamming-when-calling-ISP-from/m-p/719175#M29086</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;&lt;DIV style="font-size: 14px;"&gt;&lt;SPAN&gt;Thank you for your interest in NXP Semiconductor products and&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="font-size: 14px;"&gt;&lt;SPAN&gt;the opportunity to serve you.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'd like to get the more&amp;nbsp; information, whether you can introduce the steps of replicating the issue in details.&lt;/P&gt;&lt;P&gt;I'm looking forward to your reply.&lt;/P&gt;&lt;DIV style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;&lt;SPAN style="border: 0px; font-weight: inherit; font-size: 14px;"&gt;Have a great day,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;&lt;SPAN style="border: 0px; font-weight: inherit; font-size: 14px;"&gt;TIC&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;&lt;SPAN style="border: 0px; font-weight: inherit; font-size: 14px;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;&lt;SPAN style="border: 0px; font-weight: inherit; font-size: 14px;"&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;&lt;SPAN style="border: 0px; font-weight: inherit; font-size: 14px;"&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;&lt;SPAN style="border: 0px; font-weight: inherit; font-size: 14px;"&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Mar 2018 02:21:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Unable-to-use-4k-blocks-for-progamming-when-calling-ISP-from/m-p/719175#M29086</guid>
      <dc:creator>jeremyzhou</dc:creator>
      <dc:date>2018-03-23T02:21:08Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to use 4k blocks for progamming when calling ISP from user code</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Unable-to-use-4k-blocks-for-progamming-when-calling-ISP-from/m-p/719176#M29087</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What works:&lt;/P&gt;&lt;P&gt;Place the LPC in ISP mode by pulling&amp;nbsp; PIO0_1 low during poweron.&lt;/P&gt;&lt;P&gt;call:&lt;/P&gt;&lt;P&gt;lpc21isp -hex image.hex /dev/ttyUSB0 19200 12000&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;lpc21isp version 1.97&lt;BR /&gt;File image.hex:&lt;BR /&gt; loaded...&lt;BR /&gt;Start Address = 0x00001011&lt;BR /&gt; converted to binary format...&lt;BR /&gt; image size : 4588&lt;BR /&gt;Image size : 4588&lt;BR /&gt;Synchronizing (ESC to abort). OK&lt;BR /&gt;Read bootcode version: 2&lt;BR /&gt;7&lt;BR /&gt;Read part ID: LPC1114.../333, 32 kiB FLASH / 8 kiB SRAM (0x00040070)&lt;BR /&gt;Will start programming at Sector 1 if possible, and conclude with Sector 0 to ensure that checksum is written last.&lt;BR /&gt;Erasing sector 0 first, to invalidate checksum. OK &lt;BR /&gt;Sector 1: ...............&lt;BR /&gt;Sector 0: ..............................................................................................&lt;BR /&gt;Download Finished... taking 0 seconds&lt;BR /&gt;Now launching the brand new code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The code programmed also contains code to jump to the ISP mode so I can reprogam without having to use the ISP pin&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My code to start the ISP:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;typedef void (*IAP)(uint32_t[], uint32_t[]);&lt;BR /&gt;static IAP iap_entry = (IAP) 0x1fff1ff1;&lt;BR /&gt;static uint32_t command[5];&lt;BR /&gt;static uint32_t result[4];&lt;/P&gt;&lt;P&gt;void bootloader_start(void)&lt;BR /&gt;{&lt;BR /&gt; &amp;nbsp;&amp;nbsp; __disable_irq();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; LPC_SYSCON-&amp;gt;SYSAHBCLKCTRL |= SYSAHBCLKCTRL_CT32B1;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; LPC_SYSCON-&amp;gt;SYSAHBCLKCTRL |= SYSAHBCLKCTRL_GPIO;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; LPC_SYSCON-&amp;gt;SYSAHBCLKCTRL |= SYSAHBCLKCTRL_IOCON;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;LPC_SYSCON-&amp;gt;SYSAHBCLKDIV = 1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;command[0] = 57;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; __set_MSP(*((uint32_t *) 0x1FFF0000));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;iap_entry(command, result);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It enters the ISP, and I can communicate with the target, but if I then try to program the same lpc21isp command failes:&lt;/P&gt;&lt;P&gt;File image.hex:&lt;BR /&gt; loaded...&lt;BR /&gt;Start Address = 0x00001011&lt;BR /&gt; converted to binary format...&lt;BR /&gt; image size : 4588&lt;BR /&gt;Image size : 4588&lt;BR /&gt;Synchronizing (ESC to abort). OK&lt;BR /&gt;Read bootcode version: 2&lt;BR /&gt;7&lt;BR /&gt;Read part ID: LPC1114.../333, 32 kiB FLASH / 8 kiB SRAM (0x00040070)&lt;BR /&gt;Will start programming at Sector 1 if possible, and conclude with Sector 0 to ensure that checksum is written last.&lt;BR /&gt;Erasing sector 0 first, to invalidate checksum. OK &lt;BR /&gt;Sector 1: ...............&lt;BR /&gt;Sector 0: ...........................................................................Error on writing data (1)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I ran lpc21isp with debug info enabled and discovered that the error occured during the writing of data to RAM,&lt;/P&gt;&lt;P&gt;By default lpc21isp uses 4k blocks for the LPC1114/333 and the failure occurs between bytes 3195 and 3240.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I do the same but now using a adjusted version of lpc21isp to limit it the transfer size to RAM to 1024 it works:&lt;/P&gt;&lt;P&gt;File image.hex:&lt;BR /&gt; loaded...&lt;/P&gt;&lt;P&gt;Start Address = 0x00001011&lt;BR /&gt; converted to binary format...&lt;BR /&gt; image size : 4588&lt;BR /&gt;Image size : 4588&lt;BR /&gt;Synchronizing (ESC to abort). OK&lt;BR /&gt;Read bootcode version: 2&lt;BR /&gt;7&lt;BR /&gt;Read part ID: LPC1114.../333, 56 kiB FLASH / 8 kiB SRAM (0x00040070)&lt;BR /&gt;Will start programming at Sector 1 if possible, and conclude with Sector 0 to ensure that checksum is written last.&lt;BR /&gt;Erasing sector 0 first, to invalidate checksum. OK &lt;BR /&gt;Sector 1: ...............&lt;BR /&gt;Sector 0: ..........................|.........................|.........................|.........................&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Mar 2018 13:02:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Unable-to-use-4k-blocks-for-progamming-when-calling-ISP-from/m-p/719176#M29087</guid>
      <dc:creator>bartvdmeulen</dc:creator>
      <dc:date>2018-03-23T13:02:15Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to use 4k blocks for progamming when calling ISP from user code</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Unable-to-use-4k-blocks-for-progamming-when-calling-ISP-from/m-p/719177#M29088</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp;&lt;A _jive_internal="true" data-content-finding="Community" data-userid="307864" data-username="bartvdmeulen" href="https://community.nxp.com/people/bartvdmeulen" style="color: #5e89c1; background-color: #ffffff; border: 0px; font-weight: 200; text-decoration: none; font-size: 1.286rem;"&gt;Bart vd. Meulen&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;Thanks for your reply.&lt;/P&gt;&lt;P&gt;As I know, the Flash Magic&amp;nbsp;which is another tool used to update the firmware of MCU via the ISP mode, it select the 512 bytes when calling the ISP Copy RAM to flash command to&amp;nbsp;avoid some potential issues.&lt;/P&gt;&lt;P&gt;Hope it helps.&lt;/P&gt;&lt;P&gt;Have a great day,&lt;/P&gt;&lt;P&gt;TIC&lt;/P&gt;&lt;DIV style="border: 0px; font-weight: inherit; font-size: 14px;"&gt;&lt;DIV class="" style="border: 0px; font-weight: inherit; margin: 20px 0px;"&gt;&lt;DIV style="color: #51626f; background-color: #ffffff; border: 0px; font-weight: inherit; font-size: 14px;"&gt;&lt;SPAN style="border: 0px; font-weight: inherit; font-size: 14px;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="color: #51626f; background-color: #ffffff; border: 0px; font-weight: inherit; font-size: 14px;"&gt;&lt;SPAN style="border: 0px; font-weight: inherit; font-size: 14px;"&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="color: #51626f; background-color: #ffffff; border: 0px; font-weight: inherit; font-size: 14px;"&gt;&lt;SPAN style="border: 0px; font-weight: inherit; font-size: 14px;"&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="color: #51626f; background-color: #ffffff; border: 0px; font-weight: inherit; font-size: 14px;"&gt;&lt;SPAN style="border: 0px; font-weight: inherit; font-size: 14px;"&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV style="border: 0px; font-weight: inherit; font-size: 14px;"&gt; &lt;/DIV&gt;&lt;DIV class="" style="border: 0px; font-weight: inherit; font-size: 14px; margin: 20px 0px 0px;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Mar 2018 06:10:40 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Unable-to-use-4k-blocks-for-progamming-when-calling-ISP-from/m-p/719177#M29088</guid>
      <dc:creator>jeremyzhou</dc:creator>
      <dc:date>2018-03-26T06:10:40Z</dc:date>
    </item>
  </channel>
</rss>

