<?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: K22 FLASH in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/K22-FLASH/m-p/619528#M37014</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi kathirkamu annakamu,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Please take care the following points:&lt;/P&gt;&lt;P&gt;1. sector size difference&lt;/P&gt;&lt;P&gt;&amp;nbsp;MK20DX128VLF5 sector size is 1Kbyte, MK22DX256VLF5&amp;nbsp; sector size is 2 KB.&lt;/P&gt;&lt;P&gt;Did you define the correct sector size.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Before write, did you do the according address erase?&lt;/P&gt;&lt;P&gt;If the according flash address already have data, and you didn't erase it before you write it, the flash operation will failed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. Disable the interrupt.&lt;/P&gt;&lt;P&gt;&amp;nbsp;Before the flash operation, you need to disable the global interrupt, after the flash operation is finished, you can enable the global interrupt again.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4. The launch command code should put in the RAM.&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 let me know!&lt;/P&gt;&lt;P&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, 14 Feb 2017 08:23:06 GMT</pubDate>
    <dc:creator>kerryzhou</dc:creator>
    <dc:date>2017-02-14T08:23:06Z</dc:date>
    <item>
      <title>K22 FLASH</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/K22-FLASH/m-p/619527#M37013</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Sir,&lt;/P&gt;&lt;P&gt;I am porting my software from MK20DX128VLF5 to MK22DX256VLF5 contoller. I am storing variables in the FLASH region from address 0x1000_0000 .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;I have written a snippet like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;size = (BYTE*)&amp;amp;param10 - (BYTE*)&amp;amp;param1;&lt;/P&gt;&lt;P&gt;WDog1_Disable();&lt;BR /&gt; &lt;BR /&gt; FLASH1_SetBlockFlash((unsigned char *)&amp;amp;&lt;SPAN&gt;param1&lt;/SPAN&gt;, 0x10000000, size);&lt;/P&gt;&lt;P&gt;WDog1_Clear();//CLEAR_WATCHDOG;&lt;BR /&gt; WDog1_Enable();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and my bean setting is&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_2.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/13967iCF5860A6C43BBADA/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_2.png" alt="pastedImage_2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The same code and setting &amp;nbsp;works well for MK20DX128VLF5. But in MK22DX256VLF5. its keep on looping the flash routine&amp;nbsp;&lt;EM&gt;&lt;STRONG&gt;byte FLASH1_SetFlash(FLASH1_TDataAddress Src, FLASH1_TAddress Dst, word Count).&amp;nbsp;&lt;/STRONG&gt;&lt;/EM&gt;its keep on looping do while loop on this section&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FLASH1_RemainingDataSize = 0U;&lt;BR /&gt; FLASH1_CurrentCommand = FLASH1_CMD_WRITE;&lt;BR /&gt; FLASH1_CmdPending = TRUE;&lt;BR /&gt; Result = IntFlashLdd1_Write(IntFlashLdd1_DevDataPtr, (LDD_TData *)Src, Dst, (LDD_FLASH_TDataSize)Count); /* Start reading from the flash memory */&lt;BR /&gt; if (Result == ERR_OK) {&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;do {&lt;BR /&gt; IntFlashLdd1_Main(IntFlashLdd1_DevDataPtr);&lt;BR /&gt; } while (FLASH1_CmdPending);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; Result = FLASH1_CmdResult;&lt;BR /&gt; } else {&lt;BR /&gt; FLASH1_CmdPending = FALSE; /* Command parameter error */&lt;BR /&gt; if (Result == ERR_PARAM_ADDRESS) {&lt;BR /&gt; Result = ERR_RANGE;&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt; return (byte)Result;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards,&lt;/P&gt;&lt;P&gt;A.Kathirkamu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Feb 2017 05:02:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/K22-FLASH/m-p/619527#M37013</guid>
      <dc:creator>kathirkamuannak</dc:creator>
      <dc:date>2017-02-10T05:02:58Z</dc:date>
    </item>
    <item>
      <title>Re: K22 FLASH</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/K22-FLASH/m-p/619528#M37014</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi kathirkamu annakamu,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Please take care the following points:&lt;/P&gt;&lt;P&gt;1. sector size difference&lt;/P&gt;&lt;P&gt;&amp;nbsp;MK20DX128VLF5 sector size is 1Kbyte, MK22DX256VLF5&amp;nbsp; sector size is 2 KB.&lt;/P&gt;&lt;P&gt;Did you define the correct sector size.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Before write, did you do the according address erase?&lt;/P&gt;&lt;P&gt;If the according flash address already have data, and you didn't erase it before you write it, the flash operation will failed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. Disable the interrupt.&lt;/P&gt;&lt;P&gt;&amp;nbsp;Before the flash operation, you need to disable the global interrupt, after the flash operation is finished, you can enable the global interrupt again.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4. The launch command code should put in the RAM.&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 let me know!&lt;/P&gt;&lt;P&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, 14 Feb 2017 08:23:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/K22-FLASH/m-p/619528#M37014</guid>
      <dc:creator>kerryzhou</dc:creator>
      <dc:date>2017-02-14T08:23:06Z</dc:date>
    </item>
  </channel>
</rss>

