<?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 Erase flash by sectors in S12 / MagniV Microcontrollers</title>
    <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Erase-flash-by-sectors/m-p/640405#M13630</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="margin: 0px; padding: 0px; border: 0px currentColor; text-align: left; color: #51626f; text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 15px; font-style: normal; font-weight: normal; word-spacing: 0px; vertical-align: baseline; white-space: normal; orphans: 2; widows: 2; background-color: #ffffff; font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px;"&gt;&lt;SPAN style="margin: 0px; padding: 0px; border: 0px currentColor; color: black; font-family: inherit; font-size: 10pt; font-style: inherit; font-weight: inherit; vertical-align: baseline;"&gt;Dear sir, &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0px; padding: 0px; border: 0px currentColor; text-align: left; color: #51626f; text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 15px; font-style: normal; font-weight: normal; word-spacing: 0px; vertical-align: baseline; white-space: normal; orphans: 2; widows: 2; background-color: #ffffff; font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px;"&gt;&lt;SPAN style="margin: 0px; padding: 0px; border: 0px currentColor; color: black; font-family: inherit; font-size: 10pt; font-style: inherit; font-weight: inherit; vertical-align: baseline;"&gt;&lt;SPAN style="color: #51626f; text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 15px; font-style: normal; font-weight: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: #ffffff; font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px;"&gt;I am using&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="margin: 0px; padding: 0px; border: 0px currentColor; color: black; text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 10pt; font-style: normal; font-weight: normal; word-spacing: 0px; vertical-align: baseline; white-space: normal; orphans: 2; widows: 2; background-color: #ffffff; font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px;"&gt;ms9c12xdp512 16 bit mcu.&lt;/SPAN&gt; I want to erase flash by sector(1024 bytes).&amp;nbsp; But the function can not work. Can you help me?&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0px; padding: 0px; border: 0px currentColor; text-align: left; color: #51626f; text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 15px; font-style: normal; font-weight: normal; word-spacing: 0px; vertical-align: baseline; white-space: normal; orphans: 2; widows: 2; background-color: #ffffff; font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px;"&gt;&lt;SPAN style="margin: 0px; padding: 0px; border: 0px currentColor; color: black; font-family: inherit; font-size: 10pt; font-style: inherit; font-weight: inherit; vertical-align: baseline;"&gt;main.c&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0px; padding: 0px; border: 0px currentColor; text-align: left; color: #51626f; text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 15px; font-style: normal; font-weight: normal; word-spacing: 0px; vertical-align: baseline; white-space: normal; orphans: 2; widows: 2; background-color: #ffffff; font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px;"&gt;&lt;SPAN style="margin: 0px; padding: 0px; border: 0px currentColor; color: black; font-family: inherit; font-size: 10pt; font-style: inherit; font-weight: inherit; vertical-align: baseline;"&gt;{&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0px; padding: 0px; border: 0px currentColor; text-align: left; color: #51626f; text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 15px; font-style: normal; font-weight: normal; word-spacing: 0px; vertical-align: baseline; white-space: normal; orphans: 2; widows: 2; background-color: #ffffff; font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px;"&gt;&lt;SPAN style="margin: 0px; padding: 0px; border: 0px currentColor; color: black; font-family: inherit; font-size: 10pt; font-style: inherit; font-weight: inherit; vertical-align: baseline;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; INT8U data[2] = {48, 49};&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0px; padding: 0px; border: 0px currentColor; text-align: left; color: #51626f; text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 15px; font-style: normal; font-weight: normal; word-spacing: 0px; vertical-align: baseline; white-space: normal; orphans: 2; widows: 2; background-color: #ffffff; font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px;"&gt;&lt;SPAN style="margin: 0px; padding: 0px; border: 0px currentColor; color: black; font-family: inherit; font-size: 10pt; font-style: inherit; font-weight: inherit; vertical-align: baseline;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; writeByte(0xFA, (INT8U*)0xBFFE, data, 2); //Write data to PAGE_FA, check the memory, it worked.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0px; padding: 0px; border: 0px currentColor; text-align: left; color: #51626f; text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 15px; font-style: normal; font-weight: normal; word-spacing: 0px; vertical-align: baseline; white-space: normal; orphans: 2; widows: 2; background-color: #ffffff; font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px;"&gt;&lt;SPAN style="margin: 0px; padding: 0px; border: 0px currentColor; color: black; font-family: inherit; font-size: 10pt; font-style: inherit; font-weight: inherit; vertical-align: baseline;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; eraserSector(0xFA, 0x8000, 16);&amp;nbsp; //After calling this, it does not work, the data in 0XFABFFE is still there.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0px; padding: 0px; border: 0px currentColor; text-align: left; color: #51626f; text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 15px; font-style: normal; font-weight: normal; word-spacing: 0px; vertical-align: baseline; white-space: normal; orphans: 2; widows: 2; background-color: #ffffff; font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px;"&gt;&lt;SPAN style="margin: 0px; padding: 0px; border: 0px currentColor; color: black; font-family: inherit; font-size: 10pt; font-style: inherit; font-weight: inherit; vertical-align: baseline;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0px; padding: 0px; border: 0px currentColor; text-align: left; color: #51626f; text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 15px; font-style: normal; font-weight: normal; word-spacing: 0px; vertical-align: baseline; white-space: normal; min-height: 8pt; orphans: 2; widows: 2; background-color: #ffffff; font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="margin: 0px; padding: 0px; border: 0px currentColor; text-align: left; color: #51626f; text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 15px; font-style: normal; font-weight: normal; word-spacing: 0px; vertical-align: baseline; white-space: normal; orphans: 2; widows: 2; background-color: #ffffff; font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px;"&gt;//erase by sector(1024 bytes)&lt;/P&gt;&lt;P style="margin: 0px; padding: 0px; border: 0px currentColor; text-align: left; color: #51626f; text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 15px; font-style: normal; font-weight: normal; word-spacing: 0px; vertical-align: baseline; white-space: normal; orphans: 2; widows: 2; background-color: #ffffff; font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px;"&gt;void eraserSector(INT8U page, INT16U address,&amp;nbsp; INT8U count){&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; INT16U i;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; INT8U d;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; INT8U oldPage;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; oldPage = PPAGE;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; while(!(FCLKDIV &amp;amp; 0x80));&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(PPAGE){&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PPAGE = page;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; d = page&amp;amp;0x0C;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; d = d&amp;gt;&amp;gt;2;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FCNFG = 3-d;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for(i=0;i&amp;lt;count;i++, address += 1024){&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while(!(FSTAT &amp;amp; 0x80));&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while(FSTAT &amp;amp; 0x30){&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FSTAT |= 0x30;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while(!(FPROT &amp;amp; 0x80));&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; __DINT;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *(INT16U*)address = 0xFFFF;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FCMD = 0x40;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FSTAT |= 0x80;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while( !FSTAT_CBEIF );&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while( !FSTAT_CCIF );&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; __EINT;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; PPAGE = oldPage;&lt;BR /&gt;}&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 10 Mar 2017 09:25:51 GMT</pubDate>
    <dc:creator>liuweiwei</dc:creator>
    <dc:date>2017-03-10T09:25:51Z</dc:date>
    <item>
      <title>Erase flash by sectors</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Erase-flash-by-sectors/m-p/640405#M13630</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="margin: 0px; padding: 0px; border: 0px currentColor; text-align: left; color: #51626f; text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 15px; font-style: normal; font-weight: normal; word-spacing: 0px; vertical-align: baseline; white-space: normal; orphans: 2; widows: 2; background-color: #ffffff; font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px;"&gt;&lt;SPAN style="margin: 0px; padding: 0px; border: 0px currentColor; color: black; font-family: inherit; font-size: 10pt; font-style: inherit; font-weight: inherit; vertical-align: baseline;"&gt;Dear sir, &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0px; padding: 0px; border: 0px currentColor; text-align: left; color: #51626f; text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 15px; font-style: normal; font-weight: normal; word-spacing: 0px; vertical-align: baseline; white-space: normal; orphans: 2; widows: 2; background-color: #ffffff; font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px;"&gt;&lt;SPAN style="margin: 0px; padding: 0px; border: 0px currentColor; color: black; font-family: inherit; font-size: 10pt; font-style: inherit; font-weight: inherit; vertical-align: baseline;"&gt;&lt;SPAN style="color: #51626f; text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 15px; font-style: normal; font-weight: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; orphans: 2; widows: 2; background-color: #ffffff; font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px;"&gt;I am using&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="margin: 0px; padding: 0px; border: 0px currentColor; color: black; text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 10pt; font-style: normal; font-weight: normal; word-spacing: 0px; vertical-align: baseline; white-space: normal; orphans: 2; widows: 2; background-color: #ffffff; font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px;"&gt;ms9c12xdp512 16 bit mcu.&lt;/SPAN&gt; I want to erase flash by sector(1024 bytes).&amp;nbsp; But the function can not work. Can you help me?&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0px; padding: 0px; border: 0px currentColor; text-align: left; color: #51626f; text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 15px; font-style: normal; font-weight: normal; word-spacing: 0px; vertical-align: baseline; white-space: normal; orphans: 2; widows: 2; background-color: #ffffff; font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px;"&gt;&lt;SPAN style="margin: 0px; padding: 0px; border: 0px currentColor; color: black; font-family: inherit; font-size: 10pt; font-style: inherit; font-weight: inherit; vertical-align: baseline;"&gt;main.c&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0px; padding: 0px; border: 0px currentColor; text-align: left; color: #51626f; text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 15px; font-style: normal; font-weight: normal; word-spacing: 0px; vertical-align: baseline; white-space: normal; orphans: 2; widows: 2; background-color: #ffffff; font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px;"&gt;&lt;SPAN style="margin: 0px; padding: 0px; border: 0px currentColor; color: black; font-family: inherit; font-size: 10pt; font-style: inherit; font-weight: inherit; vertical-align: baseline;"&gt;{&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0px; padding: 0px; border: 0px currentColor; text-align: left; color: #51626f; text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 15px; font-style: normal; font-weight: normal; word-spacing: 0px; vertical-align: baseline; white-space: normal; orphans: 2; widows: 2; background-color: #ffffff; font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px;"&gt;&lt;SPAN style="margin: 0px; padding: 0px; border: 0px currentColor; color: black; font-family: inherit; font-size: 10pt; font-style: inherit; font-weight: inherit; vertical-align: baseline;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; INT8U data[2] = {48, 49};&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0px; padding: 0px; border: 0px currentColor; text-align: left; color: #51626f; text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 15px; font-style: normal; font-weight: normal; word-spacing: 0px; vertical-align: baseline; white-space: normal; orphans: 2; widows: 2; background-color: #ffffff; font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px;"&gt;&lt;SPAN style="margin: 0px; padding: 0px; border: 0px currentColor; color: black; font-family: inherit; font-size: 10pt; font-style: inherit; font-weight: inherit; vertical-align: baseline;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; writeByte(0xFA, (INT8U*)0xBFFE, data, 2); //Write data to PAGE_FA, check the memory, it worked.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0px; padding: 0px; border: 0px currentColor; text-align: left; color: #51626f; text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 15px; font-style: normal; font-weight: normal; word-spacing: 0px; vertical-align: baseline; white-space: normal; orphans: 2; widows: 2; background-color: #ffffff; font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px;"&gt;&lt;SPAN style="margin: 0px; padding: 0px; border: 0px currentColor; color: black; font-family: inherit; font-size: 10pt; font-style: inherit; font-weight: inherit; vertical-align: baseline;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; eraserSector(0xFA, 0x8000, 16);&amp;nbsp; //After calling this, it does not work, the data in 0XFABFFE is still there.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0px; padding: 0px; border: 0px currentColor; text-align: left; color: #51626f; text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 15px; font-style: normal; font-weight: normal; word-spacing: 0px; vertical-align: baseline; white-space: normal; orphans: 2; widows: 2; background-color: #ffffff; font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px;"&gt;&lt;SPAN style="margin: 0px; padding: 0px; border: 0px currentColor; color: black; font-family: inherit; font-size: 10pt; font-style: inherit; font-weight: inherit; vertical-align: baseline;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0px; padding: 0px; border: 0px currentColor; text-align: left; color: #51626f; text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 15px; font-style: normal; font-weight: normal; word-spacing: 0px; vertical-align: baseline; white-space: normal; min-height: 8pt; orphans: 2; widows: 2; background-color: #ffffff; font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="margin: 0px; padding: 0px; border: 0px currentColor; text-align: left; color: #51626f; text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 15px; font-style: normal; font-weight: normal; word-spacing: 0px; vertical-align: baseline; white-space: normal; orphans: 2; widows: 2; background-color: #ffffff; font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px;"&gt;//erase by sector(1024 bytes)&lt;/P&gt;&lt;P style="margin: 0px; padding: 0px; border: 0px currentColor; text-align: left; color: #51626f; text-transform: none; text-indent: 0px; letter-spacing: normal; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 15px; font-style: normal; font-weight: normal; word-spacing: 0px; vertical-align: baseline; white-space: normal; orphans: 2; widows: 2; background-color: #ffffff; font-variant-ligatures: normal; font-variant-caps: normal; -webkit-text-stroke-width: 0px;"&gt;void eraserSector(INT8U page, INT16U address,&amp;nbsp; INT8U count){&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; INT16U i;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; INT8U d;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; INT8U oldPage;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; oldPage = PPAGE;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; while(!(FCLKDIV &amp;amp; 0x80));&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(PPAGE){&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PPAGE = page;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; d = page&amp;amp;0x0C;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; d = d&amp;gt;&amp;gt;2;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FCNFG = 3-d;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for(i=0;i&amp;lt;count;i++, address += 1024){&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while(!(FSTAT &amp;amp; 0x80));&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while(FSTAT &amp;amp; 0x30){&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FSTAT |= 0x30;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while(!(FPROT &amp;amp; 0x80));&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; __DINT;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *(INT16U*)address = 0xFFFF;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FCMD = 0x40;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FSTAT |= 0x80;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while( !FSTAT_CBEIF );&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while( !FSTAT_CCIF );&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; __EINT;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; PPAGE = oldPage;&lt;BR /&gt;}&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Mar 2017 09:25:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Erase-flash-by-sectors/m-p/640405#M13630</guid>
      <dc:creator>liuweiwei</dc:creator>
      <dc:date>2017-03-10T09:25:51Z</dc:date>
    </item>
    <item>
      <title>Re: Erase flash by sectors</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Erase-flash-by-sectors/m-p/640406#M13631</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I would like to provide you solution for flash (XDP512-FLASH-E_W-CW51). You can also find functions you would like to create. Moreover I have added a memory map to better understand local, globall, ppage... access.&lt;/P&gt;&lt;P&gt;Probably for the future you will be also require EEPROM routines so I have also attached them. (SW-XDP512-EEPROM-E_W-CW47.ZIP)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope and believe provided materials will lead you to understand and sucesfully solve your project.&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Ladislav&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Mar 2017 10:20:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Erase-flash-by-sectors/m-p/640406#M13631</guid>
      <dc:creator>lama</dc:creator>
      <dc:date>2017-03-10T10:20:22Z</dc:date>
    </item>
  </channel>
</rss>

