<?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のトピックlpc1788 IAP read serial number causes lockup(reset)</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/lpc1788-IAP-read-serial-number-causes-lockup-reset/m-p/523460#M6096</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by wella-tabor on Wed Jan 22 10:52:50 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am trying to read the serial number by the IAP function (according to the app note and the datasheet) but when the function is invoked the microcontroller resets itself with RSID= 6 (LOCKUP). During the asm stepping (segger j/link), it is ok.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My system consists of two parts:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1) I call it bootloader, addr 0x0000 0000 - (0x0000 4000 - 1), it initializes peripherals, clock, SDRAM, etc. and at the end it sets VTOR to 0x0000 4000 and calls 0x0000 4000 + 4.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;2) The application - To protect itself from soft-reset, accidently executing code&amp;nbsp; from 0x0000 0004 (wrongly initialized function object), the addr. range 0x0000 0000 - (0x0000 4000 - 1) is disabled by MPU for access and execution.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However when the MPU is not configured in the part 2), it works.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Here is my explanation&lt;/STRONG&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The IAP_serial_number remaps the portion of the Boot ROM to address 0 (via MEMMAP register). This portion contains the serial number. The function attempts to read it somewhere from the range 0x0000 0000 - (0x0000 4000 - 1) but the MPU prevents from this.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am not sure if my explanation is right so that any advice is appreciated.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Martin&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 18:03:42 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T18:03:42Z</dc:date>
    <item>
      <title>lpc1788 IAP read serial number causes lockup(reset)</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/lpc1788-IAP-read-serial-number-causes-lockup-reset/m-p/523460#M6096</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by wella-tabor on Wed Jan 22 10:52:50 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am trying to read the serial number by the IAP function (according to the app note and the datasheet) but when the function is invoked the microcontroller resets itself with RSID= 6 (LOCKUP). During the asm stepping (segger j/link), it is ok.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My system consists of two parts:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1) I call it bootloader, addr 0x0000 0000 - (0x0000 4000 - 1), it initializes peripherals, clock, SDRAM, etc. and at the end it sets VTOR to 0x0000 4000 and calls 0x0000 4000 + 4.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;2) The application - To protect itself from soft-reset, accidently executing code&amp;nbsp; from 0x0000 0004 (wrongly initialized function object), the addr. range 0x0000 0000 - (0x0000 4000 - 1) is disabled by MPU for access and execution.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However when the MPU is not configured in the part 2), it works.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Here is my explanation&lt;/STRONG&gt;&lt;SPAN&gt;:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The IAP_serial_number remaps the portion of the Boot ROM to address 0 (via MEMMAP register). This portion contains the serial number. The function attempts to read it somewhere from the range 0x0000 0000 - (0x0000 4000 - 1) but the MPU prevents from this.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am not sure if my explanation is right so that any advice is appreciated.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Martin&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:03:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/lpc1788-IAP-read-serial-number-causes-lockup-reset/m-p/523460#M6096</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:03:42Z</dc:date>
    </item>
    <item>
      <title>Re: lpc1788 IAP read serial number causes lockup(reset)</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/lpc1788-IAP-read-serial-number-causes-lockup-reset/m-p/523461#M6097</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by MikeSimmonds on Wed Jan 22 20:21:55 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;That is essentially correct.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Most (if not all) IAP functions use an undocumented address remapping of&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;some part of the address space (presumably OTP) to overlay about 2K at&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;address zero. In there are the unique serial number, the cpu id, on-chip&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;flash and ram sizes etc.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That is why interrupts MUST be disabled; the standard vector table is&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;no longer available [I wonder if this still true with a relocated vector table?]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;As you point out, programming the MPU can (and obviously does) mess with this.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Why not program your MPU settings for Read/Not-Write/No-Execute instead of&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;no access at all?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Let us (the forum) know if that works.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;BTW, on the 1778/1888, IAP read serial does not need any ram reservation at&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;top of stack. (Rom ver 1.8)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Mike.&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:03:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/lpc1788-IAP-read-serial-number-causes-lockup-reset/m-p/523461#M6097</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:03:43Z</dc:date>
    </item>
    <item>
      <title>Re: lpc1788 IAP read serial number causes lockup(reset)</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/lpc1788-IAP-read-serial-number-causes-lockup-reset/m-p/523462#M6098</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by wella-tabor on Thu Jan 23 02:31:03 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: &lt;/STRONG&gt;&lt;BR /&gt;Why not program your MPU settings for Read/Not-Write/No-Execute instead of&lt;BR /&gt;no access at all?&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;No access is a runtime check of correctly initialized function pointers, data pointers to Flash, etc. (at least this is some level of the check). The bootloader address range should not be used at all.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It is not problem for me to read the serial number, I have disabled and than enabled the MPU and interrupts of course. Because this is an "undocumented" feature I wanted to spread the knowledge of it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;With your description, programmers will be aware of this. Thanks.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Martin&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:03:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/lpc1788-IAP-read-serial-number-causes-lockup-reset/m-p/523462#M6098</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:03:43Z</dc:date>
    </item>
  </channel>
</rss>

