<?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>Kinetis MicrocontrollersのトピックRe: How to Re-partition FlexNVM from FlexRAM to EEPROM</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-Re-partition-FlexNVM-from-FlexRAM-to-EEPROM/m-p/1176343#M58699</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;SPAN class=""&gt;&lt;A id="link_32" class="lia-link-navigation lia-page-link lia-user-name-link" href="https://community.nxp.com/t5/user/viewprofilepage/user-id/179454" target="_self"&gt;jcress&lt;/A&gt;,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp;What's the detail operation steps on your K60?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp;Please also let me know your detail K60 partnumber.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp;1. Do the mass erase&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; You even can use the JLINK commander: unlock kinetis&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; to finish the mass erase function.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp; 2. Do the partition checking like this code&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;int partition_flash(int eeprom_size, int dflash_size)&lt;BR /&gt;{&lt;BR /&gt;/* Test to make sure the device is not already partitioned. If it&lt;BR /&gt;* is already partitioned, then return with no action performed.&lt;BR /&gt;*/&lt;BR /&gt;if ((SIM_FCFG1 &amp;amp; SIM_FCFG1_DEPART(0xF)) != 0x00000F00)&lt;BR /&gt;{&lt;BR /&gt;printf("\nDevice is already partitioned.\n");&lt;BR /&gt;return 0;&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;/* Write the FCCOB registers */&lt;BR /&gt;FTFL_FCCOB0 = FTFL_FCCOB0_CCOBn(0x80); // Selects the PGMPART command&lt;BR /&gt;FTFL_FCCOB1 = 0x00;&lt;BR /&gt;FTFL_FCCOB2 = 0x00;&lt;BR /&gt;FTFL_FCCOB3 = 0x00;&lt;/P&gt;
&lt;P&gt;/* FCCOB4 is written with the code for the subsystem sizes (eeprom_size define) */&lt;BR /&gt;FTFL_FCCOB4 = eeprom_size;&lt;/P&gt;
&lt;P&gt;/* FFCOB5 is written with the code for the Dflash size (dflash_size define) */&lt;BR /&gt;FTFL_FCCOB5 = dflash_size;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;/* All required FCCOBx registers are written, so launch the command */&lt;BR /&gt;FTFL_FSTAT = FTFL_FSTAT_CCIF_MASK;&lt;/P&gt;
&lt;P&gt;/* Wait for the command to complete */&lt;BR /&gt;while(!(FTFL_FSTAT &amp;amp; FTFL_FSTAT_CCIF_MASK));&lt;/P&gt;
&lt;P&gt;return 1;&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Please note, you need to give the correct&amp;nbsp;eeprom_size and&amp;nbsp;dflash_size for K60 chip.&lt;/P&gt;
&lt;P&gt;Main code can like this:&lt;/P&gt;
&lt;P&gt;int main (void)&lt;BR /&gt;{&lt;BR /&gt;char ch;&lt;BR /&gt;uint32 temp=0;&lt;BR /&gt;#ifdef KEIL&lt;BR /&gt;start();&lt;BR /&gt;#endif&lt;BR /&gt;printf("\nRunning the hello_world project in K2050MHz family\n");&lt;BR /&gt;&lt;BR /&gt;SCB_SHCSR|=SCB_SHCSR_BUSFAULTENA_MASK|SCB_SHCSR_MEMFAULTENA_MASK|SCB_SHCSR_USGFAULTENA_MASK;&lt;BR /&gt;printf("\nRunning FlexMem demo!!\n");&lt;BR /&gt;/* Partition the memory to enable FlexMem mode */&lt;BR /&gt;if ( partition_flash( 0X33, 0X03) )//0X03&lt;BR /&gt;{&lt;BR /&gt;/* Device has been partitioned for the first time, so this&lt;BR /&gt;* means the counters have not been initialized yet. We'll&lt;BR /&gt;* zero them out now.&lt;BR /&gt;*/&lt;BR /&gt;*((uint32 *)(LONGWORD_COUNTER_ADDR)) = 0x0;&lt;/P&gt;
&lt;P&gt;/* Wait for the command to complete */&lt;BR /&gt;while(!(FTFL_FCNFG &amp;amp; FTFL_FCNFG_EEERDY_MASK));&lt;/P&gt;
&lt;P&gt;*((uint16 *)(WORD_COUNTER_ADDR)) = 0x0;&lt;/P&gt;
&lt;P&gt;/* Wait for the command to complete */&lt;BR /&gt;while(!(FTFL_FCNFG &amp;amp; FTFL_FCNFG_EEERDY_MASK));&lt;/P&gt;
&lt;P&gt;*((uint8 *)(BYTE_COUNTER_ADDR)) = 0x0;&lt;/P&gt;
&lt;P&gt;/* Wait for the command to complete */&lt;BR /&gt;while(!(FTFL_FCNFG &amp;amp; FTFL_FCNFG_EEERDY_MASK));&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;//Write eeprom&lt;BR /&gt;*((uint32 *)(LONGWORD_COUNTER_ADDR)) = 0x0;&lt;/P&gt;
&lt;P&gt;/* Wait for the command to complete */&lt;BR /&gt;while(!(FTFL_FCNFG &amp;amp; FTFL_FCNFG_EEERDY_MASK));&lt;/P&gt;
&lt;P&gt;*((uint16 *)(WORD_COUNTER_ADDR)) = 0x0;&lt;/P&gt;
&lt;P&gt;/* Wait for the command to complete */&lt;BR /&gt;while(!(FTFL_FCNFG &amp;amp; FTFL_FCNFG_EEERDY_MASK));&lt;/P&gt;
&lt;P&gt;*((uint8 *)(BYTE_COUNTER_ADDR)) = 0x0;&lt;/P&gt;
&lt;P&gt;/* Wait for the command to complete */&lt;BR /&gt;while(!(FTFL_FCNFG &amp;amp; FTFL_FCNFG_EEERDY_MASK));&lt;BR /&gt;printf("\nlongword counter = 0x%08X", *(uint32 *)(LONGWORD_COUNTER_ADDR));&lt;BR /&gt;printf("\nword counter = 0x%04X", *(uint16 *)(WORD_COUNTER_ADDR));&lt;BR /&gt;printf("\nbyte counter = 0x%02X", *(uint8 *)(BYTE_COUNTER_ADDR));&lt;BR /&gt;////////////////////////&lt;BR /&gt;/* Make sure the EEE is ready. If not wait for the command to complete */&lt;BR /&gt;while(!(FTFL_FCNFG &amp;amp; FTFL_FCNFG_EEERDY_MASK));&lt;/P&gt;
&lt;P&gt;temp = *((uint32 *)(LONGWORD_COUNTER_ADDR));&lt;BR /&gt;*((uint32 *)(LONGWORD_COUNTER_ADDR)) = (uint32) temp + 1;&lt;/P&gt;
&lt;P&gt;/* Make sure the EEE is ready. If not wait for the command to complete */&lt;BR /&gt;while(!(FTFL_FCNFG &amp;amp; FTFL_FCNFG_EEERDY_MASK));&lt;/P&gt;
&lt;P&gt;temp = *((uint16 *)(WORD_COUNTER_ADDR));&lt;BR /&gt;*((uint16 *)(WORD_COUNTER_ADDR)) = (uint16) temp + 1;&lt;/P&gt;
&lt;P&gt;/* Make sure the EEE is ready. If not wait for the command to complete */&lt;BR /&gt;while(!(FTFL_FCNFG &amp;amp; FTFL_FCNFG_EEERDY_MASK));&lt;/P&gt;
&lt;P&gt;temp = *((uint8 *)(BYTE_COUNTER_ADDR));&lt;BR /&gt;*((uint8 *)(BYTE_COUNTER_ADDR)) = (uint8) temp + 1;&lt;/P&gt;
&lt;P&gt;/* Make sure the EEE is ready. If not wait for the command to complete */&lt;BR /&gt;while(!(FTFL_FCNFG &amp;amp; FTFL_FCNFG_EEERDY_MASK));&lt;/P&gt;
&lt;P&gt;/* Display the initial counter values */&lt;BR /&gt;printf("\nlongword counter = 0x%08X", *(uint32 *)(LONGWORD_COUNTER_ADDR));&lt;BR /&gt;printf("\nword counter = 0x%04X", *(uint16 *)(WORD_COUNTER_ADDR));&lt;BR /&gt;printf("\nbyte counter = 0x%02X", *(uint8 *)(BYTE_COUNTER_ADDR));&lt;/P&gt;
&lt;P&gt;printf("\nRunning FlexMem demo!!end\n"); &lt;BR /&gt;while(1)&lt;BR /&gt;{&lt;BR /&gt;ch = getchar();&lt;BR /&gt;putchar(ch);&lt;BR /&gt;} &lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Although the code which I give you is the K20, but your K60 also can refer to it, just need to give the correct configuration.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please try it again.&lt;/P&gt;
&lt;P&gt;If you still have questions about it, please kindly let me know.&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Kerry&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 02 Nov 2020 03:16:36 GMT</pubDate>
    <dc:creator>kerryzhou</dc:creator>
    <dc:date>2020-11-02T03:16:36Z</dc:date>
    <item>
      <title>How to Re-partition FlexNVM from FlexRAM to EEPROM</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-Re-partition-FlexNVM-from-FlexRAM-to-EEPROM/m-p/1171994#M58577</link>
      <description>&lt;P&gt;I have an MK60 that I need to change its FlexNVM partitioning from FlexRAM to EEPROM.&lt;/P&gt;&lt;P&gt;The Program Partition command (0x80) fails with FSTAT[ACCERR] because the EEPROM data size and FlexNVM partition code bytes are not initially 0xFFFF. What can I do to get them both to 0xFFFF? I tried bulk erase, but that did not work.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Oct 2020 18:11:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-Re-partition-FlexNVM-from-FlexRAM-to-EEPROM/m-p/1171994#M58577</guid>
      <dc:creator>jcress</dc:creator>
      <dc:date>2020-10-22T18:11:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to Re-partition FlexNVM from FlexRAM to EEPROM</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-Re-partition-FlexNVM-from-FlexRAM-to-EEPROM/m-p/1172285#M58586</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;SPAN class=""&gt;&lt;A id="link_10" class="lia-link-navigation lia-page-link lia-user-name-link" href="https://community.nxp.com/t5/user/viewprofilepage/user-id/179454" target="_self"&gt;jcress,&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp; If your chip is already partitioned, then you need to do the mass erase at first.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp; About the mass erase, you can use the external debugger to finish it. I don't know what's the IDE you are using, the IDE also have the mass erase item when you download the code.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp; You also can use the JLINK debugger with JLINK commander: unlock kinetis&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp;After you do the mass erase, I think you should can finish the partition.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp;Please try it on your side.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;Please note, when you do the partition, you need to disable the interrupt, and flash operation commander need to put in the RAM.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;Wish it helps you!&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;If you still have questions about it, please kindly let me know!&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;Best Regards,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;Kerry&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;-------------------------------------------------------------------------------&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;Note:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;- If this post answers your question, please click the "Mark Correct" button. Thank you!&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;- We are following threads for 7 weeks after the last post, later replies are ignored&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;Please open a new thread and refer to the closed one, if you have a related question at a later point in time.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;-----------------------------------------------------------------------------&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Oct 2020 07:50:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-Re-partition-FlexNVM-from-FlexRAM-to-EEPROM/m-p/1172285#M58586</guid>
      <dc:creator>kerryzhou</dc:creator>
      <dc:date>2020-10-23T07:50:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to Re-partition FlexNVM from FlexRAM to EEPROM</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-Re-partition-FlexNVM-from-FlexRAM-to-EEPROM/m-p/1172503#M58591</link>
      <description>&lt;P&gt;Hi Kerry and thanks for the reply.&lt;/P&gt;&lt;P&gt;First the IDE I'm using is CodeWarrior 11.0.1.&lt;/P&gt;&lt;P&gt;You said to do a mass erase. Mass erase what? I've already tried mass erasing FTFE_PFLASH starting at address 0x00000000 and FTFE_DFLASH starting at address 0x14000000. This had no affect - I cannot re-partition to EEPROM.&lt;/P&gt;&lt;P&gt;Thanks,&lt;BR /&gt;Jim&lt;/P&gt;</description>
      <pubDate>Fri, 23 Oct 2020 14:08:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-Re-partition-FlexNVM-from-FlexRAM-to-EEPROM/m-p/1172503#M58591</guid>
      <dc:creator>jcress</dc:creator>
      <dc:date>2020-10-23T14:08:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to Re-partition FlexNVM from FlexRAM to EEPROM</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-Re-partition-FlexNVM-from-FlexRAM-to-EEPROM/m-p/1172787#M58604</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;SPAN&gt;jcress,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;What's the debugger you are using with the CW?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; Mass erase, means erase all the kinetis flash memory, then you can do the FlexNVM partition again.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; In the CW, different debugger has the different the mass erase windows, so please tell me which debugger you are using at first?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; Normally, you can find it in the debug configuration in your CW,&amp;nbsp; the item will be erase all, you can check that item before you downlod the code, then download the code again, the first&amp;nbsp; time, you should can do the partition successfully.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Wish it helps you!&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Best Regards,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Kerry&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Oct 2020 02:50:20 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-Re-partition-FlexNVM-from-FlexRAM-to-EEPROM/m-p/1172787#M58604</guid>
      <dc:creator>kerryzhou</dc:creator>
      <dc:date>2020-10-26T02:50:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to Re-partition FlexNVM from FlexRAM to EEPROM</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-Re-partition-FlexNVM-from-FlexRAM-to-EEPROM/m-p/1175899#M58680</link>
      <description>&lt;P&gt;Mass erase did NOT work. I do not have a solution.&lt;/P&gt;</description>
      <pubDate>Fri, 30 Oct 2020 11:54:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-Re-partition-FlexNVM-from-FlexRAM-to-EEPROM/m-p/1175899#M58680</guid>
      <dc:creator>jcress</dc:creator>
      <dc:date>2020-10-30T11:54:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to Re-partition FlexNVM from FlexRAM to EEPROM</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-Re-partition-FlexNVM-from-FlexRAM-to-EEPROM/m-p/1176343#M58699</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;SPAN class=""&gt;&lt;A id="link_32" class="lia-link-navigation lia-page-link lia-user-name-link" href="https://community.nxp.com/t5/user/viewprofilepage/user-id/179454" target="_self"&gt;jcress&lt;/A&gt;,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp;What's the detail operation steps on your K60?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp;Please also let me know your detail K60 partnumber.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp;1. Do the mass erase&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; You even can use the JLINK commander: unlock kinetis&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; to finish the mass erase function.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp; 2. Do the partition checking like this code&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;int partition_flash(int eeprom_size, int dflash_size)&lt;BR /&gt;{&lt;BR /&gt;/* Test to make sure the device is not already partitioned. If it&lt;BR /&gt;* is already partitioned, then return with no action performed.&lt;BR /&gt;*/&lt;BR /&gt;if ((SIM_FCFG1 &amp;amp; SIM_FCFG1_DEPART(0xF)) != 0x00000F00)&lt;BR /&gt;{&lt;BR /&gt;printf("\nDevice is already partitioned.\n");&lt;BR /&gt;return 0;&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;/* Write the FCCOB registers */&lt;BR /&gt;FTFL_FCCOB0 = FTFL_FCCOB0_CCOBn(0x80); // Selects the PGMPART command&lt;BR /&gt;FTFL_FCCOB1 = 0x00;&lt;BR /&gt;FTFL_FCCOB2 = 0x00;&lt;BR /&gt;FTFL_FCCOB3 = 0x00;&lt;/P&gt;
&lt;P&gt;/* FCCOB4 is written with the code for the subsystem sizes (eeprom_size define) */&lt;BR /&gt;FTFL_FCCOB4 = eeprom_size;&lt;/P&gt;
&lt;P&gt;/* FFCOB5 is written with the code for the Dflash size (dflash_size define) */&lt;BR /&gt;FTFL_FCCOB5 = dflash_size;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;/* All required FCCOBx registers are written, so launch the command */&lt;BR /&gt;FTFL_FSTAT = FTFL_FSTAT_CCIF_MASK;&lt;/P&gt;
&lt;P&gt;/* Wait for the command to complete */&lt;BR /&gt;while(!(FTFL_FSTAT &amp;amp; FTFL_FSTAT_CCIF_MASK));&lt;/P&gt;
&lt;P&gt;return 1;&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Please note, you need to give the correct&amp;nbsp;eeprom_size and&amp;nbsp;dflash_size for K60 chip.&lt;/P&gt;
&lt;P&gt;Main code can like this:&lt;/P&gt;
&lt;P&gt;int main (void)&lt;BR /&gt;{&lt;BR /&gt;char ch;&lt;BR /&gt;uint32 temp=0;&lt;BR /&gt;#ifdef KEIL&lt;BR /&gt;start();&lt;BR /&gt;#endif&lt;BR /&gt;printf("\nRunning the hello_world project in K2050MHz family\n");&lt;BR /&gt;&lt;BR /&gt;SCB_SHCSR|=SCB_SHCSR_BUSFAULTENA_MASK|SCB_SHCSR_MEMFAULTENA_MASK|SCB_SHCSR_USGFAULTENA_MASK;&lt;BR /&gt;printf("\nRunning FlexMem demo!!\n");&lt;BR /&gt;/* Partition the memory to enable FlexMem mode */&lt;BR /&gt;if ( partition_flash( 0X33, 0X03) )//0X03&lt;BR /&gt;{&lt;BR /&gt;/* Device has been partitioned for the first time, so this&lt;BR /&gt;* means the counters have not been initialized yet. We'll&lt;BR /&gt;* zero them out now.&lt;BR /&gt;*/&lt;BR /&gt;*((uint32 *)(LONGWORD_COUNTER_ADDR)) = 0x0;&lt;/P&gt;
&lt;P&gt;/* Wait for the command to complete */&lt;BR /&gt;while(!(FTFL_FCNFG &amp;amp; FTFL_FCNFG_EEERDY_MASK));&lt;/P&gt;
&lt;P&gt;*((uint16 *)(WORD_COUNTER_ADDR)) = 0x0;&lt;/P&gt;
&lt;P&gt;/* Wait for the command to complete */&lt;BR /&gt;while(!(FTFL_FCNFG &amp;amp; FTFL_FCNFG_EEERDY_MASK));&lt;/P&gt;
&lt;P&gt;*((uint8 *)(BYTE_COUNTER_ADDR)) = 0x0;&lt;/P&gt;
&lt;P&gt;/* Wait for the command to complete */&lt;BR /&gt;while(!(FTFL_FCNFG &amp;amp; FTFL_FCNFG_EEERDY_MASK));&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;//Write eeprom&lt;BR /&gt;*((uint32 *)(LONGWORD_COUNTER_ADDR)) = 0x0;&lt;/P&gt;
&lt;P&gt;/* Wait for the command to complete */&lt;BR /&gt;while(!(FTFL_FCNFG &amp;amp; FTFL_FCNFG_EEERDY_MASK));&lt;/P&gt;
&lt;P&gt;*((uint16 *)(WORD_COUNTER_ADDR)) = 0x0;&lt;/P&gt;
&lt;P&gt;/* Wait for the command to complete */&lt;BR /&gt;while(!(FTFL_FCNFG &amp;amp; FTFL_FCNFG_EEERDY_MASK));&lt;/P&gt;
&lt;P&gt;*((uint8 *)(BYTE_COUNTER_ADDR)) = 0x0;&lt;/P&gt;
&lt;P&gt;/* Wait for the command to complete */&lt;BR /&gt;while(!(FTFL_FCNFG &amp;amp; FTFL_FCNFG_EEERDY_MASK));&lt;BR /&gt;printf("\nlongword counter = 0x%08X", *(uint32 *)(LONGWORD_COUNTER_ADDR));&lt;BR /&gt;printf("\nword counter = 0x%04X", *(uint16 *)(WORD_COUNTER_ADDR));&lt;BR /&gt;printf("\nbyte counter = 0x%02X", *(uint8 *)(BYTE_COUNTER_ADDR));&lt;BR /&gt;////////////////////////&lt;BR /&gt;/* Make sure the EEE is ready. If not wait for the command to complete */&lt;BR /&gt;while(!(FTFL_FCNFG &amp;amp; FTFL_FCNFG_EEERDY_MASK));&lt;/P&gt;
&lt;P&gt;temp = *((uint32 *)(LONGWORD_COUNTER_ADDR));&lt;BR /&gt;*((uint32 *)(LONGWORD_COUNTER_ADDR)) = (uint32) temp + 1;&lt;/P&gt;
&lt;P&gt;/* Make sure the EEE is ready. If not wait for the command to complete */&lt;BR /&gt;while(!(FTFL_FCNFG &amp;amp; FTFL_FCNFG_EEERDY_MASK));&lt;/P&gt;
&lt;P&gt;temp = *((uint16 *)(WORD_COUNTER_ADDR));&lt;BR /&gt;*((uint16 *)(WORD_COUNTER_ADDR)) = (uint16) temp + 1;&lt;/P&gt;
&lt;P&gt;/* Make sure the EEE is ready. If not wait for the command to complete */&lt;BR /&gt;while(!(FTFL_FCNFG &amp;amp; FTFL_FCNFG_EEERDY_MASK));&lt;/P&gt;
&lt;P&gt;temp = *((uint8 *)(BYTE_COUNTER_ADDR));&lt;BR /&gt;*((uint8 *)(BYTE_COUNTER_ADDR)) = (uint8) temp + 1;&lt;/P&gt;
&lt;P&gt;/* Make sure the EEE is ready. If not wait for the command to complete */&lt;BR /&gt;while(!(FTFL_FCNFG &amp;amp; FTFL_FCNFG_EEERDY_MASK));&lt;/P&gt;
&lt;P&gt;/* Display the initial counter values */&lt;BR /&gt;printf("\nlongword counter = 0x%08X", *(uint32 *)(LONGWORD_COUNTER_ADDR));&lt;BR /&gt;printf("\nword counter = 0x%04X", *(uint16 *)(WORD_COUNTER_ADDR));&lt;BR /&gt;printf("\nbyte counter = 0x%02X", *(uint8 *)(BYTE_COUNTER_ADDR));&lt;/P&gt;
&lt;P&gt;printf("\nRunning FlexMem demo!!end\n"); &lt;BR /&gt;while(1)&lt;BR /&gt;{&lt;BR /&gt;ch = getchar();&lt;BR /&gt;putchar(ch);&lt;BR /&gt;} &lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Although the code which I give you is the K20, but your K60 also can refer to it, just need to give the correct configuration.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please try it again.&lt;/P&gt;
&lt;P&gt;If you still have questions about it, please kindly let me know.&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Kerry&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Nov 2020 03:16:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-Re-partition-FlexNVM-from-FlexRAM-to-EEPROM/m-p/1176343#M58699</guid>
      <dc:creator>kerryzhou</dc:creator>
      <dc:date>2020-11-02T03:16:36Z</dc:date>
    </item>
  </channel>
</rss>

