<?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>CodeWarrior for MCU中的主题 Re: flash erase verify</title>
    <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/flash-erase-verify/m-p/161043#M4435</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the help all. My problem was that I didn't got the part that It verifies all the array. I was trying to use it to verify 512 bytes blocks. while running I'll try to use flags to control the state&amp;nbsp; of each used block and check the values of all the addresses only after a reset.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 23 Aug 2011 16:27:13 GMT</pubDate>
    <dc:creator>jmfs</dc:creator>
    <dc:date>2011-08-23T16:27:13Z</dc:date>
    <item>
      <title>flash erase verify</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/flash-erase-verify/m-p/161039#M4431</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to use the flash command erase verify, but it doesn't seem to work (always returns 0). I'm following the flowchart in the datasheet. The device is mc9s08qe128, and I'm using codewarrior 10.1. Here is my code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;byte flashEraseVerify(const byte * flash_block){ if(FCDIV_FDIVLD) {&amp;nbsp; while(!FSTAT_FCBEF)&amp;nbsp;&amp;nbsp; ;&amp;nbsp; if(FSTAT_FACCERR | FSTAT_FPVIOL)&amp;nbsp;&amp;nbsp; FSTAT = FSTAT &amp;amp; 0x30;&amp;nbsp; *((byte*)flash_block) = 0xA; // dummy write&amp;nbsp; FCMD = 0x05; // erase verify command&amp;nbsp; FSTAT_FCBEF = 1;&amp;nbsp; while(!FSTAT_FCCF)&amp;nbsp;&amp;nbsp; ;&amp;nbsp; return FSTAT_FBLANK; } return 0;}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Using debug I've checked that FDIVLD is set and that the page isn't erased. I'm not sure if I can write the flash block address like this&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;*((byte*)flash_destination) = 0xA; // dummy write&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;I'm assuming that this function doesn't need to be executed from ram because it only needs to read from flash.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2020 09:06:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/flash-erase-verify/m-p/161039#M4431</guid>
      <dc:creator>jmfs</dc:creator>
      <dc:date>2020-10-29T09:06:29Z</dc:date>
    </item>
    <item>
      <title>Re: flash erase verify</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/flash-erase-verify/m-p/161040#M4432</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just a quick thought, would doing this work?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;if(FCDIV_FDIVLD){  /*...*/  return FSTAT_FBLANK;}else  return 0;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2020 09:06:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/flash-erase-verify/m-p/161040#M4432</guid>
      <dc:creator>AirDragon</dc:creator>
      <dc:date>2020-10-29T09:06:31Z</dc:date>
    </item>
    <item>
      <title>Re: flash erase verify</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/flash-erase-verify/m-p/161041#M4433</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think that Erase Verify blankchecks all flash memory (not just block) and that it is not useful for application running on this chip. It is useful for BDM programmers. I think it is needed to disengage chip security after mass erase via BDM port.&lt;/P&gt;&lt;P&gt;Just search for non-0xFF byte to determine if it is blank or not.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Aug 2011 12:32:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/flash-erase-verify/m-p/161041#M4433</guid>
      <dc:creator>kef</dc:creator>
      <dc:date>2011-08-23T12:32:28Z</dc:date>
    </item>
    <item>
      <title>Re: flash erase verify</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/flash-erase-verify/m-p/161042#M4434</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, and welcome to the forum.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;From the reference manual for the device, Table 4.23, for the erase verify command -&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT color="#ff0000"&gt;Verify all memory bytes in the flash array memory are erased.&lt;/FONT&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT color="#ff0000"&gt;If the flash array memory is erased, the FBLANK flag in the FSTAT register will set upon&lt;/FONT&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT color="#ff0000"&gt;command completion.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Therefore, the erase verify command&amp;nbsp;tests whether the &lt;U&gt;whole&lt;/U&gt; flash array has been erased, i.e. a mass erase has succeeded.&amp;nbsp; Running the code from flash cannot work as intended, since a mass erase would erase the code that executes the command.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the event that no mass erase has occurred, the situation that you currently seem to have, I would expect that&amp;nbsp;the returned result would be zero.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You may assume that a &lt;EM&gt;sector erase&lt;/EM&gt; process has succeeded&amp;nbsp;if the FSTAT_FACCERR and FSTAT_FPVIOL error&amp;nbsp;flags are clear upon exit from the sector erase function.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have attached some sample code for a different 9S08 device,&amp;nbsp;that is capable of erasing a single flash sector, and provides byte by byte flash&amp;nbsp;programming.&amp;nbsp; But&amp;nbsp;you should be able to adapt.&amp;nbsp; It uses a fixed block of RAM for the code that requires to be RAM resident.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mac&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Aug 2011 12:44:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/flash-erase-verify/m-p/161042#M4434</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2011-08-23T12:44:43Z</dc:date>
    </item>
    <item>
      <title>Re: flash erase verify</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/flash-erase-verify/m-p/161043#M4435</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the help all. My problem was that I didn't got the part that It verifies all the array. I was trying to use it to verify 512 bytes blocks. while running I'll try to use flags to control the state&amp;nbsp; of each used block and check the values of all the addresses only after a reset.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Aug 2011 16:27:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/flash-erase-verify/m-p/161043#M4435</guid>
      <dc:creator>jmfs</dc:creator>
      <dc:date>2011-08-23T16:27:13Z</dc:date>
    </item>
  </channel>
</rss>

