<?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: IAP flash writing problem</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/IAP-flash-writing-problem/m-p/648716#M25746</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A class="jx-jive-macro-user" href="https://community.nxp.com/people/kerryzhou"&gt;kerryzhou&lt;/A&gt;‌,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm working on LPC1114F/302 Flash Read and Write. when I give an input to the switch The following function works giving result SUCCESSFULL. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;if(coil_address_data[20]==1)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//Switch input&lt;/P&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;u32IAP_PrepareSectors(0x6,0x6);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;u32IAP_CopyRAMToFlash(0x6000,(uint32_t)RAM_Data,1024);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;coil_address_data[20]=0;&lt;P&gt;&lt;/P&gt;}&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But while debugging value is not loaded to Flash address.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks and Regards&lt;/P&gt;&lt;P&gt;Athmesh Nandakumar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 04 Feb 2019 08:31:46 GMT</pubDate>
    <dc:creator>athmesh_n</dc:creator>
    <dc:date>2019-02-04T08:31:46Z</dc:date>
    <item>
      <title>IAP flash writing problem</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/IAP-flash-writing-problem/m-p/648709#M25739</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am using the NVMwrite function that is in the firmware of a your demoboard to write data in flash memory on a custom board. I see that sometimes when I add new instructions or variables to the firmware, the data are not written in the flash memory anymore. Then I add new instructions or variable and the writing restart to work. The problem is that I don't know what is the condition that makes the writing instruction work or not.&lt;/P&gt;&lt;P&gt;The instructions or variables that I add are not related to the functioning of the writing function. Maybe is a matter of size, but I can't understand exactly the size of what and its value.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Dec 2016 14:50:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/IAP-flash-writing-problem/m-p/648709#M25739</guid>
      <dc:creator>valeriocaputo</dc:creator>
      <dc:date>2016-12-29T14:50:48Z</dc:date>
    </item>
    <item>
      <title>Re: IAP flash writing problem</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/IAP-flash-writing-problem/m-p/648710#M25740</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Valerio Caputo,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; What the chip you are using?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; When the problem happens, you can debug it, what the flash address the firmware want to write, and check that flash address, whether that flash address is erased before. As you know, when the customer want to write the flash, the according flash address must have been erased, and don't have any other data, otherwise , the flash write will be failed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Wish it helps you!&lt;/P&gt;&lt;P&gt;If you still have question, please contact me!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;Kerry&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Jan 2017 05:03:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/IAP-flash-writing-problem/m-p/648710#M25740</guid>
      <dc:creator>kerryzhou</dc:creator>
      <dc:date>2017-01-03T05:03:33Z</dc:date>
    </item>
    <item>
      <title>Re: IAP flash writing problem</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/IAP-flash-writing-problem/m-p/648711#M25741</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I did the debug and I found that the data are always written in the &lt;/P&gt;&lt;P&gt;memory. So the problem is that data are not read when there is the &lt;/P&gt;&lt;P&gt;problem. But I don't know why it stops reading the data sometimes that I &lt;/P&gt;&lt;P&gt;add instructions or variables (for example, one time that the program &lt;/P&gt;&lt;P&gt;stopped to read data, I added 9 variables with size of one byte, and the &lt;/P&gt;&lt;P&gt;program restarted to work in the right way). Is there some size of the &lt;/P&gt;&lt;P&gt;code that must be respected (for example, it must be multiple of some &lt;/P&gt;&lt;P&gt;value)?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Il 03/01/2017 06:04, kerryzhou ha scritto:&lt;/P&gt;&lt;BLOCKQUOTE level="1"&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;gt;&lt;/P&gt;&lt;BLOCKQUOTE level="1"&gt;&lt;P&gt;  NXP Community&lt;/P&gt;&lt;P&gt;  &amp;lt;https://community.freescale.com/resources/statics/1000/35400-NXP-Community-Email-banner-600x75.jpg&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;gt;&lt;/P&gt;&lt;BLOCKQUOTE level="1"&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    Re: IAP flash writing problem&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;reply from Kerry Zhou &lt;/P&gt;&lt;P&gt;&amp;lt;https://community.nxp.com/people/kerryzhou?et=watches.email.thread&amp;gt; &lt;/P&gt;&lt;P&gt;in /LPC/ - View the full discussion &lt;/P&gt;&lt;P&gt;&amp;lt;https://community.nxp.com/message/864708?commentID=864708&amp;amp;et=watches.email.thread#comment-864708&amp;gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Jan 2017 07:17:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/IAP-flash-writing-problem/m-p/648711#M25741</guid>
      <dc:creator>valeriocaputo</dc:creator>
      <dc:date>2017-01-03T07:17:00Z</dc:date>
    </item>
    <item>
      <title>Re: IAP flash writing problem</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/IAP-flash-writing-problem/m-p/648712#M25742</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Valerio Caputo,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; You still didn't tell us what the chip you are using.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Your code stop to read the flash address, I think you still need to check your code, when the problem happens, why it can't read. You refer to what item to read it? Length? If yes, please check the length is correct or not.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Please debug the code, and do more testing, and check your code, I think this is the code logic bug.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Wish it helps you!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;Kerry&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Jan 2017 08:19:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/IAP-flash-writing-problem/m-p/648712#M25742</guid>
      <dc:creator>kerryzhou</dc:creator>
      <dc:date>2017-01-03T08:19:53Z</dc:date>
    </item>
    <item>
      <title>Re: IAP flash writing problem</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/IAP-flash-writing-problem/m-p/648713#M25743</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The chip is LPC1114FBD48-302.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have made debug of the code, and the only difference between the code &lt;/P&gt;&lt;P&gt;that read the data and the one that doesn't read, is in the value of &lt;/P&gt;&lt;P&gt;&amp;amp;nvm_storage (there is a difference of 4 between the two cases). But &lt;/P&gt;&lt;P&gt;this is a parameter of the program_flash_sector function inside NVMwrite &lt;/P&gt;&lt;P&gt;function (that works), so it should not be the cause of the problem. All &lt;/P&gt;&lt;P&gt;the other variable of the NVMread function have the same values in both &lt;/P&gt;&lt;P&gt;cases.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the code, the only difference between the two codes is a call to a &lt;/P&gt;&lt;P&gt;function (in a code it is called, in the other one not). That function &lt;/P&gt;&lt;P&gt;surely has nothing to do with flash memory. It seems that when I add new &lt;/P&gt;&lt;P&gt;instructions or variables, the program stops to read data. Then, I add &lt;/P&gt;&lt;P&gt;again new instructions or variables and it begins to read data again. So &lt;/P&gt;&lt;P&gt;far, it happens in a casual way for me (it already happened more than &lt;/P&gt;&lt;P&gt;one time during the writing of the code), I can't understand the reason &lt;/P&gt;&lt;P&gt;it happens. I thought for example, the number of data bytes stored must &lt;/P&gt;&lt;P&gt;be multiple of some value? I need to reserve some bytes for IAP commands?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can't really find a solution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you again&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Il 03/01/2017 09:20, kerryzhou ha scritto:&lt;/P&gt;&lt;BLOCKQUOTE level="1"&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;gt;&lt;/P&gt;&lt;BLOCKQUOTE level="1"&gt;&lt;P&gt;  NXP Community&lt;/P&gt;&lt;P&gt;  &amp;lt;https://community.freescale.com/resources/statics/1000/35400-NXP-Community-Email-banner-600x75.jpg&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;gt;&lt;/P&gt;&lt;BLOCKQUOTE level="1"&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    Re: IAP flash writing problem&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;reply from Kerry Zhou &lt;/P&gt;&lt;P&gt;&amp;lt;https://community.nxp.com/people/kerryzhou?et=watches.email.thread&amp;gt; &lt;/P&gt;&lt;P&gt;in /LPC/ - View the full discussion &lt;/P&gt;&lt;P&gt;&amp;lt;https://community.nxp.com/message/864834?commentID=864834&amp;amp;et=watches.email.thread#comment-864834&amp;gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Jan 2017 09:12:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/IAP-flash-writing-problem/m-p/648713#M25743</guid>
      <dc:creator>valeriocaputo</dc:creator>
      <dc:date>2017-01-03T09:12:13Z</dc:date>
    </item>
    <item>
      <title>Re: IAP flash writing problem</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/IAP-flash-writing-problem/m-p/648714#M25744</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Valerio caputo,&lt;BR /&gt;Could you post some codes about your problem, it may help me to understand your question.&lt;BR /&gt;About the IAP program, please refer to the LPC1114 user manual, check the IAP commands, especial about the command description.&lt;BR /&gt;When you do the IAP erase/write operations, please disable the interrupts or ensure that the user interrupt vectors are active in RAM and that the interrupt handlers reside in RAM.&lt;BR /&gt;Because the on-chip flash memory is not accessible during erase/write operations.&lt;BR /&gt;About the question: the number of data bytes stored must be multiple of some value? &lt;BR /&gt;When you do the data store, please check the IAP function input param0, whether it is meet the user manual demand.Some input address and lenght have limit.&lt;BR /&gt;Besides, when you build the code, please modify your project optionmization level to lowest, it it better to none, just to make sure your problem is not caused by the high optimization.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Wish it helps you!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;Kerry&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Jan 2017 08:37:20 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/IAP-flash-writing-problem/m-p/648714#M25744</guid>
      <dc:creator>kerryzhou</dc:creator>
      <dc:date>2017-01-05T08:37:20Z</dc:date>
    </item>
    <item>
      <title>Re: IAP flash writing problem</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/IAP-flash-writing-problem/m-p/648715#M25745</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is the content of the file in which there are the funtions of &lt;/P&gt;&lt;P&gt;reading and writing:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#define CUR_BLOCK_SIZE         256&lt;/P&gt;&lt;P&gt;#define FLASH_SECTOR_FOR_DATA  7            // Highest Flash sector &lt;/P&gt;&lt;P&gt;number in LPC1114&lt;/P&gt;&lt;P&gt;#define START_OF_FLASH_SECTOR  0x00007000   // Start address of &lt;/P&gt;&lt;P&gt;FLASH_SECTOR_FOR_DATA&lt;/P&gt;&lt;P&gt;#define END_OF_FLASH_SECTOR    0x00008000   // End address of &lt;/P&gt;&lt;P&gt;FLASH_SECTOR_FOR_DATA&lt;/P&gt;&lt;P&gt;#define IAP_FLASH_CMD_PREPARE_SECTOR   50&lt;/P&gt;&lt;P&gt;#define IAP_FLASH_CMD_COPY_RAM2FLASH   51&lt;/P&gt;&lt;P&gt;#define IAP_FLASH_CMD_ERASE_SECTOR     52&lt;/P&gt;&lt;P&gt;#define IAP_LOCATION   0x1FFF1FF1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;typedef void (*IAP)(unsigned int *pcommand, unsigned int *presult);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;typedef struct &lt;U&gt;version&lt;/U&gt;t_&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;     uint16_t  major;&lt;/P&gt;&lt;P&gt;     uint16_t  minor;&lt;/P&gt;&lt;P&gt;} version_t;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;typedef struct &lt;U&gt;nvm&lt;/U&gt;layout_t_&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;     version_t  version;&lt;/P&gt;&lt;P&gt;     uint8_t    data[CUR_BLOCK_SIZE - sizeof(version_t)];&lt;/P&gt;&lt;P&gt;} nvm_layout_t;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/*******************************************************************************&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Local data&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  ******************************************************************************/&lt;/P&gt;&lt;P&gt;  nvm_layout_t nvm_storage;  //static&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/*******************************************************************************&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Local functions&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  ******************************************************************************/&lt;/P&gt;&lt;P&gt;static void erase_flash_sector(void)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;     uint32_t  command[5];&lt;/P&gt;&lt;P&gt;     uint32_t  result[4];&lt;/P&gt;&lt;P&gt;     IAP iap_entry = (IAP)IAP_LOCATION;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;     __disable_irq();&lt;/P&gt;&lt;P&gt;     command[0] = IAP_FLASH_CMD_PREPARE_SECTOR;&lt;/P&gt;&lt;P&gt;     command[1] = FLASH_SECTOR_FOR_DATA;&lt;/P&gt;&lt;P&gt;     command[2] = FLASH_SECTOR_FOR_DATA;       // Only 1 sector, so end &lt;/P&gt;&lt;P&gt;sector # is start sector #&lt;/P&gt;&lt;P&gt;     iap_entry(command, result);&lt;/P&gt;&lt;P&gt;     if (result[0] == 0)&lt;/P&gt;&lt;P&gt;     {&lt;/P&gt;&lt;P&gt;         command[0] = IAP_FLASH_CMD_ERASE_SECTOR;&lt;/P&gt;&lt;P&gt;         command[1] = FLASH_SECTOR_FOR_DATA;&lt;/P&gt;&lt;P&gt;         command[2] = FLASH_SECTOR_FOR_DATA;   // Only 1 sector, so end &lt;/P&gt;&lt;P&gt;sector # is start sector #&lt;/P&gt;&lt;P&gt;         command[3] = SystemCoreClock / 1000;&lt;/P&gt;&lt;P&gt;         iap_entry(command, result);&lt;/P&gt;&lt;P&gt;     }&lt;/P&gt;&lt;P&gt;     __enable_irq();&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;static void program_flash_sector(uint32_t * pDest, uint32_t * pSrc, &lt;/P&gt;&lt;P&gt;uint32_t size)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;     uint32_t  command[5];&lt;/P&gt;&lt;P&gt;     uint32_t  result[4];&lt;/P&gt;&lt;P&gt;     IAP iap_entry = (IAP)IAP_LOCATION;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;     __disable_irq();&lt;/P&gt;&lt;P&gt;     command[0] = IAP_FLASH_CMD_PREPARE_SECTOR;&lt;/P&gt;&lt;P&gt;     command[1] = FLASH_SECTOR_FOR_DATA;&lt;/P&gt;&lt;P&gt;     command[2] = FLASH_SECTOR_FOR_DATA;  // Only 1 sector, so end &lt;/P&gt;&lt;P&gt;sector # is start sector #&lt;/P&gt;&lt;P&gt;     iap_entry(command, result);&lt;/P&gt;&lt;P&gt;     if (result[0] == 0)&lt;/P&gt;&lt;P&gt;     {&lt;/P&gt;&lt;P&gt;         command[0] = IAP_FLASH_CMD_COPY_RAM2FLASH;&lt;/P&gt;&lt;P&gt;         command[1] = (uint32_t)pDest;&lt;/P&gt;&lt;P&gt;         command[2] = (uint32_t)pSrc;&lt;/P&gt;&lt;P&gt;         command[3] = size;&lt;/P&gt;&lt;P&gt;         command[4] = SystemCoreClock / 1000;&lt;/P&gt;&lt;P&gt;         iap_entry(command, result);&lt;/P&gt;&lt;P&gt;     }&lt;/P&gt;&lt;P&gt;     __enable_irq();&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/*******************************************************************************&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Exported functions&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  ******************************************************************************/&lt;/P&gt;&lt;P&gt;bool NVM_read(void * pData, uint32_t data_size)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;     bool erase = false;&lt;/P&gt;&lt;P&gt;     bool found = false;&lt;/P&gt;&lt;P&gt;     uint32_t  * fl_ptr;&lt;/P&gt;&lt;P&gt;     nvm_layout_t  * flash_nvm_ptr;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;     if (data_size &amp;gt; sizeof(nvm_storage.data))&lt;/P&gt;&lt;P&gt;     {&lt;/P&gt;&lt;P&gt;         return false;&lt;/P&gt;&lt;P&gt;     }&lt;/P&gt;&lt;P&gt;     // check if last block in Flash is empty&lt;/P&gt;&lt;P&gt;     fl_ptr = (uint32_t *)(END_OF_FLASH_SECTOR - CUR_BLOCK_SIZE);&lt;/P&gt;&lt;P&gt;     if (*fl_ptr != 0xFFFFFFFF)&lt;/P&gt;&lt;P&gt;     {&lt;/P&gt;&lt;P&gt;         // last block in Flash is not empty.&lt;/P&gt;&lt;P&gt;             // so the Data storage in Flash is full.&lt;/P&gt;&lt;P&gt;         erase = true;&lt;/P&gt;&lt;P&gt;     }&lt;/P&gt;&lt;P&gt;     // Try to find the most recent data in the NVM Flash sector.&lt;/P&gt;&lt;P&gt;     // We search backward (highest address) to the first non empty &lt;/P&gt;&lt;P&gt;block that we&lt;/P&gt;&lt;P&gt;     // find, since the NVM Flash sector is filled from the lowest &lt;/P&gt;&lt;P&gt;address upwards.&lt;/P&gt;&lt;P&gt;     while (!found &amp;amp;&amp;amp; (fl_ptr &amp;gt;= (uint32_t *)START_OF_FLASH_SECTOR))&lt;/P&gt;&lt;P&gt;     {&lt;/P&gt;&lt;P&gt;         flash_nvm_ptr = (nvm_layout_t *)fl_ptr;&lt;/P&gt;&lt;P&gt;         if ((flash_nvm_ptr-&amp;gt;version.major == &lt;/P&gt;&lt;P&gt;MAJOR_FIRMWARE_VERSION_NUMBER) &amp;amp;&amp;amp;&lt;/P&gt;&lt;P&gt;             (flash_nvm_ptr-&amp;gt;version.minor == &lt;/P&gt;&lt;P&gt;MINOR_FIRMWARE_VERSION_NUMBER))&lt;/P&gt;&lt;P&gt;         {&lt;/P&gt;&lt;P&gt;             found = true;&lt;/P&gt;&lt;P&gt;             memcpy(pData, &amp;amp;flash_nvm_ptr-&amp;gt;data[0], data_size);&lt;/P&gt;&lt;P&gt;         }&lt;/P&gt;&lt;P&gt;         else&lt;/P&gt;&lt;P&gt;         {&lt;/P&gt;&lt;P&gt;             fl_ptr -= (CUR_BLOCK_SIZE / sizeof(uint32_t)); // skip to &lt;/P&gt;&lt;P&gt;previous block&lt;/P&gt;&lt;P&gt;         }&lt;/P&gt;&lt;P&gt;     }&lt;/P&gt;&lt;P&gt;     if (erase)&lt;/P&gt;&lt;P&gt;     {&lt;/P&gt;&lt;P&gt;         // Data storage will be cleaned up now,&lt;/P&gt;&lt;P&gt;         // so that there is room in Flash when the next power down &lt;/P&gt;&lt;P&gt;takes place.&lt;/P&gt;&lt;P&gt;         erase_flash_sector();&lt;/P&gt;&lt;P&gt;         if (found)&lt;/P&gt;&lt;P&gt;         {&lt;/P&gt;&lt;P&gt;             // write back to Flash the most recent data&lt;/P&gt;&lt;P&gt;             NVM_write(pData, data_size);&lt;/P&gt;&lt;P&gt;          }&lt;/P&gt;&lt;P&gt;     }&lt;/P&gt;&lt;P&gt;     return found;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;void NVM_write(void * pData, uint32_t data_size)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;     bool found = false;&lt;/P&gt;&lt;P&gt;     uint32_t  * pDest = (uint32_t *)START_OF_FLASH_SECTOR;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;     if (data_size &amp;gt; sizeof(nvm_storage.data))&lt;/P&gt;&lt;P&gt;     {&lt;/P&gt;&lt;P&gt;         return;&lt;/P&gt;&lt;P&gt;     }&lt;/P&gt;&lt;P&gt;     while (!found &amp;amp;&amp;amp; (pDest &amp;lt; (uint32_t *)END_OF_FLASH_SECTOR))&lt;/P&gt;&lt;P&gt;     {&lt;/P&gt;&lt;P&gt;         // check if pDest points to an empty block&lt;/P&gt;&lt;P&gt;         if (*pDest == 0xFFFFFFFF)&lt;/P&gt;&lt;P&gt;         {&lt;/P&gt;&lt;P&gt;             found = true;&lt;/P&gt;&lt;P&gt;         }&lt;/P&gt;&lt;P&gt;         else&lt;/P&gt;&lt;P&gt;         {&lt;/P&gt;&lt;P&gt;             pDest += (CUR_BLOCK_SIZE / sizeof(uint32_t)); // skip to &lt;/P&gt;&lt;P&gt;next block&lt;/P&gt;&lt;P&gt;          }&lt;/P&gt;&lt;P&gt;     }&lt;/P&gt;&lt;P&gt;     if (!found)&lt;/P&gt;&lt;P&gt;     {&lt;/P&gt;&lt;P&gt;         erase_flash_sector();&lt;/P&gt;&lt;P&gt;         pDest = (uint32_t *)START_OF_FLASH_SECTOR;&lt;/P&gt;&lt;P&gt;     }&lt;/P&gt;&lt;P&gt;     nvm_storage.version.major = MAJOR_FIRMWARE_VERSION_NUMBER;&lt;/P&gt;&lt;P&gt;     nvm_storage.version.minor = MINOR_FIRMWARE_VERSION_NUMBER;&lt;/P&gt;&lt;P&gt;     memcpy(&amp;amp;nvm_storage.data[0], pData, data_size);&lt;/P&gt;&lt;P&gt;     program_flash_sector(pDest, (uint32_t *)&amp;amp;nvm_storage, CUR_BLOCK_SIZE);&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* End Of File */&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Il 05/01/2017 09:38, kerryzhou ha scritto:&lt;/P&gt;&lt;BLOCKQUOTE level="1"&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;gt;&lt;/P&gt;&lt;BLOCKQUOTE level="1"&gt;&lt;P&gt;  NXP Community&lt;/P&gt;&lt;P&gt;  &amp;lt;https://community.freescale.com/resources/statics/1000/35400-NXP-Community-Email-banner-600x75.jpg&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;gt;&lt;/P&gt;&lt;BLOCKQUOTE level="1"&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    Re: IAP flash writing problem&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;reply from Kerry Zhou &lt;/P&gt;&lt;P&gt;&amp;lt;https://community.nxp.com/people/kerryzhou?et=watches.email.thread&amp;gt; &lt;/P&gt;&lt;P&gt;in /LPC/ - View the full discussion &lt;/P&gt;&lt;P&gt;&amp;lt;https://community.nxp.com/message/865663?commentID=865663&amp;amp;et=watches.email.thread#comment-865663&amp;gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jan 2017 09:17:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/IAP-flash-writing-problem/m-p/648715#M25745</guid>
      <dc:creator>valeriocaputo</dc:creator>
      <dc:date>2017-01-10T09:17:49Z</dc:date>
    </item>
    <item>
      <title>Re: IAP flash writing problem</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/IAP-flash-writing-problem/m-p/648716#M25746</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A class="jx-jive-macro-user" href="https://community.nxp.com/people/kerryzhou"&gt;kerryzhou&lt;/A&gt;‌,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm working on LPC1114F/302 Flash Read and Write. when I give an input to the switch The following function works giving result SUCCESSFULL. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;if(coil_address_data[20]==1)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//Switch input&lt;/P&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;u32IAP_PrepareSectors(0x6,0x6);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;u32IAP_CopyRAMToFlash(0x6000,(uint32_t)RAM_Data,1024);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;coil_address_data[20]=0;&lt;P&gt;&lt;/P&gt;}&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But while debugging value is not loaded to Flash address.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks and Regards&lt;/P&gt;&lt;P&gt;Athmesh Nandakumar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Feb 2019 08:31:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/IAP-flash-writing-problem/m-p/648716#M25746</guid>
      <dc:creator>athmesh_n</dc:creator>
      <dc:date>2019-02-04T08:31:46Z</dc:date>
    </item>
  </channel>
</rss>

