<?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: LPC54606 IAP write to address 0x0000 issue in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC54606-IAP-write-to-address-0x0000-issue/m-p/1212984#M43591</link>
    <description>&lt;P&gt;Hello jiachun_tu,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"I have made a function to update bootloader code on ROM when APP is running by using IAP function,"&lt;/P&gt;
&lt;P&gt;-&amp;gt;&amp;gt; Please tell me how do you put the function (WriteNewBootlaoder)in to ROM?&lt;/P&gt;
&lt;P&gt;And what address is about the ROM you said?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Alice&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 18 Jan 2021 06:04:08 GMT</pubDate>
    <dc:creator>Alice_Yang</dc:creator>
    <dc:date>2021-01-18T06:04:08Z</dc:date>
    <item>
      <title>LPC54606 IAP write to address 0x0000 issue</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC54606-IAP-write-to-address-0x0000-issue/m-p/1212719#M43583</link>
      <description>&lt;P&gt;hello.&lt;/P&gt;&lt;P&gt;i am working on a project which is combine with a secondary bootloader and APP. bootloader used address 0x0000-0xFFFF(flash sector 0-1), APP used address 0x10000-0x7FFFF(flash sector 2-15).&lt;/P&gt;&lt;P&gt;i have made a function to update bootloader code on ROM when APP is running by using IAP function, which is same like bootloader update APP code.&lt;/P&gt;&lt;P&gt;but i got a 2521 return code when using below function:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;void WriteNewBootloader ( void )
{
    uint32_t status;
    uint16_t i = 0;
    uint8_t BINbuffer[FLASHWRITEMAXSIZE] __attribute__ ((aligned (4)));

    __disable_irq();
    for ( i = 0; i &amp;lt; (( 0x10000 ) / FLASHWRITEMAXSIZE); i++ )
    {
		memcpy ( BINbuffer, ( uint32_t * ) ( 0x70000 + i * FLASHWRITEMAXSIZE ), FLASHWRITEMAXSIZE );
        FLASHIAP_PrepareSectorForWrite ( 0, 1 );
        status = FLASHIAP_CopyRamToFlash ( 0x00000000ul + i * FLASHWRITEMAXSIZE, ( uint32_t * )BINbuffer, FLASHWRITEMAXSIZE, SystemCoreClock );
        PRINTF ( "[Board]FLASHIAP_CopyRamToFlash status %d.\r\n", status);
		status = FLASHIAP_Compare ( 0x00000000ul + i * FLASHWRITEMAXSIZE, ( uint32_t * ) BINbuffer, FLASHWRITEMAXSIZE );
        if ( status != kStatus_FLASHIAP_Success )
        {
            PRINTF ( "[Board]FLASHIAP_Compare failed.\r\n" );
        }
    }
    __enable_irq();
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;printed out msg were:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[Board]This version's bootloader will be updated now.
[Board]FLASHIAP_CopyRamToFlash status 2521.
[Board]FLASHIAP_Compare failed.
[Board]FLASHIAP_CopyRamToFlash status 0.
[Board]FLASHIAP_CopyRamToFlash status 0.
[Board]FLASHIAP_CopyRamToFlash status 0.
[Board]FLASHIAP_CopyRamToFlash status 0.
[Board]FLASHIAP_CopyRamToFlash status 0.
[Board]FLASHIAP_CopyRamToFlash status 0.
[Board]FLASHIAP_CopyRamToFlash status 0.
[Board]FLASHIAP_CopyRamToFlash status 0.
[Board]FLASHIAP_CopyRamToFlash status 0.
[Board]FLASHIAP_CopyRamToFlash status 0.
[Board]FLASHIAP_CopyRamToFlash status 0.
[Board]FLASHIAP_CopyRamToFlash status 0.
[Board]FLASHIAP_CopyRamToFlash status 0.
[Board]FLASHIAP_CopyRamToFlash status 0.
[Board]FLASHIAP_CopyRamToFlash status 0.&lt;/LI-CODE&gt;&lt;P&gt;there were no IAP return code&lt;STRONG&gt; 2521&lt;/STRONG&gt; specification from SDK header file:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;/*!
 * @brief Flashiap status codes.
 */
enum _flashiap_status
{
    kStatus_FLASHIAP_Success        = kStatus_Success,                        /*!&amp;lt; Api is executed successfully */
    kStatus_FLASHIAP_InvalidCommand = MAKE_STATUS(kStatusGroup_FLASHIAP, 1U), /*!&amp;lt; Invalid command */
    kStatus_FLASHIAP_SrcAddrError =
        MAKE_STATUS(kStatusGroup_FLASHIAP, 2U), /*!&amp;lt; Source address is not on word boundary */
    kStatus_FLASHIAP_DstAddrError =
        MAKE_STATUS(kStatusGroup_FLASHIAP, 3U), /*!&amp;lt; Destination address is not on a correct boundary */
    kStatus_FLASHIAP_SrcAddrNotMapped =
        MAKE_STATUS(kStatusGroup_FLASHIAP, 4U), /*!&amp;lt; Source address is not mapped in the memory map */
    kStatus_FLASHIAP_DstAddrNotMapped =
        MAKE_STATUS(kStatusGroup_FLASHIAP, 5U), /*!&amp;lt; Destination address is not mapped in the memory map */
    kStatus_FLASHIAP_CountError =
        MAKE_STATUS(kStatusGroup_FLASHIAP, 6U), /*!&amp;lt; Byte count is not multiple of 4 or is not a permitted value */
    kStatus_FLASHIAP_InvalidSector =
        MAKE_STATUS(kStatusGroup_FLASHIAP,
                    7), /*!&amp;lt; Sector number is invalid or end sector number is greater than start sector number */
    kStatus_FLASHIAP_SectorNotblank = MAKE_STATUS(kStatusGroup_FLASHIAP, 8U), /*!&amp;lt; One or more sectors are not blank */
    kStatus_FLASHIAP_NotPrepared =
        MAKE_STATUS(kStatusGroup_FLASHIAP, 9U), /*!&amp;lt; Command to prepare sector for write operation was not executed */
    kStatus_FLASHIAP_CompareError =
        MAKE_STATUS(kStatusGroup_FLASHIAP, 10U), /*!&amp;lt; Destination and source memory contents do not match */
    kStatus_FLASHIAP_Busy =
        MAKE_STATUS(kStatusGroup_FLASHIAP, 11U), /*!&amp;lt; Flash programming hardware interface is busy */
    kStatus_FLASHIAP_ParamError =
        MAKE_STATUS(kStatusGroup_FLASHIAP, 12U), /*!&amp;lt; Insufficient number of parameters or invalid parameter */
    kStatus_FLASHIAP_AddrError = MAKE_STATUS(kStatusGroup_FLASHIAP, 13U), /*!&amp;lt; Address is not on word boundary */
    kStatus_FLASHIAP_AddrNotMapped =
        MAKE_STATUS(kStatusGroup_FLASHIAP, 14U),                        /*!&amp;lt; Address is not mapped in the memory map */
    kStatus_FLASHIAP_NoPower = MAKE_STATUS(kStatusGroup_FLASHIAP, 24U), /*!&amp;lt; Flash memory block is powered down */
    kStatus_FLASHIAP_NoClock =
        MAKE_STATUS(kStatusGroup_FLASHIAP, 27U), /*!&amp;lt; Flash memory block or controller is not clocked */
};&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so i had read out the datas from 0x0000-0xFFFF. there were all "0xFF" in 0x0000-0xFF0, and others address data were right.&amp;nbsp;&lt;/P&gt;&lt;P&gt;but if i changed the target flash sector to 12-13, address 0x60000-0x6FFFF. the function worked well, and i could read out right datas on this address.&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to know whether address 0x0000 can be used in IAP function to write in data, or somewhere I used these function in a wrong method?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Jan 2021 06:58:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC54606-IAP-write-to-address-0x0000-issue/m-p/1212719#M43583</guid>
      <dc:creator>jiachuan_tu</dc:creator>
      <dc:date>2021-01-16T06:58:56Z</dc:date>
    </item>
    <item>
      <title>Re: LPC54606 IAP write to address 0x0000 issue</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC54606-IAP-write-to-address-0x0000-issue/m-p/1212984#M43591</link>
      <description>&lt;P&gt;Hello jiachun_tu,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"I have made a function to update bootloader code on ROM when APP is running by using IAP function,"&lt;/P&gt;
&lt;P&gt;-&amp;gt;&amp;gt; Please tell me how do you put the function (WriteNewBootlaoder)in to ROM?&lt;/P&gt;
&lt;P&gt;And what address is about the ROM you said?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Alice&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Jan 2021 06:04:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC54606-IAP-write-to-address-0x0000-issue/m-p/1212984#M43591</guid>
      <dc:creator>Alice_Yang</dc:creator>
      <dc:date>2021-01-18T06:04:08Z</dc:date>
    </item>
    <item>
      <title>Re: LPC54606 IAP write to address 0x0000 issue</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC54606-IAP-write-to-address-0x0000-issue/m-p/1213199#M43601</link>
      <description>&lt;P&gt;Thanks for your reply. And I just solved this problem.&lt;/P&gt;&lt;P&gt;I called this funtion after hardware initialization finished.&amp;nbsp;&lt;/P&gt;&lt;P&gt;NewBootloader bin was set in 0x70000-0x7FFFF. the target address is 0x0000-0xFFFF.&lt;/P&gt;&lt;P&gt;I had read the UM10912 carefully, and I found below specification. &lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mu10912.PNG" style="width: 939px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/135031iC534C1B71927E343/image-size/large?v=v2&amp;amp;px=999" role="button" title="mu10912.PNG" alt="mu10912.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;So I changed one word data 0xDFFD6728 at offset&amp;nbsp;&lt;SPAN&gt;address&amp;nbsp; 0x001C in&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;my NewBootloader bin&lt;/SPAN&gt;&lt;SPAN&gt;, which was 0x0000000. Wirte the first 7 words checksum in ROM address 0x0000001C to satisified to the rule.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;After that, the function worked well. Thank your again.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Jan 2021 09:15:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC54606-IAP-write-to-address-0x0000-issue/m-p/1213199#M43601</guid>
      <dc:creator>jiachuan_tu</dc:creator>
      <dc:date>2021-01-18T09:15:43Z</dc:date>
    </item>
  </channel>
</rss>

