<?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 FSTAT_BLANK bit in FSTAT on S12NE64? in S12 / MagniV Microcontrollers</title>
    <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/FSTAT-BLANK-bit-in-FSTAT-on-S12NE64/m-p/166272#M5404</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I don't see any errata on this, but am also not seeing any example code using FSTAT_BLANK.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This code is located in RAM and issues commands to the FLASH system:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#pragma MESSAGE DISABLE C12002&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;static void near&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ram_flash_cmd( UINT08 cmd, UINT08 page, UINT16 *address, UINT16 data )&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;UINT08 old_page; // don't know if this is important to save&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;_RESET_COP_();&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;// clear access and protection bits&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;FSTAT = ( FSTAT_ACCERR_MASK | FSTAT_PVIOL_MASK );&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;old_page = PPAGE; // save&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;PPAGE = page; // set&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;*address = data; // Sets data and address for FLASH state machine&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;FCMD = cmd;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;FSTAT_CBEIF = 1; // start FLASH command execution&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;nop();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;nop();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;nop();&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;while( FSTAT_CBEIF != 1 ) // infinite loop until set&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;if( FSTAT &amp;amp; ( FSTAT_ACCERR_MASK | FSTAT_PVIOL_MASK ) )&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ram_errno = 10;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;PPAGE = old_page; // restore&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;#pragma MESSAGE DEFAULT C12002&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When called ram_flash_cmd( 0x05, 0x3e, 0x8000, 0xffff ) to check the blank status FSTAT returns containing 0xC2, bit 1 is set. Manuals and #include files say bit 2 (mask 0x04) is the one we are looking for. Having previously called this routine with cmd = 0x40 I would expect the area to be erased, and looking with the memory window in the debugger confirms the apparent erased state. In all references bit 2 is undefined, said to always read as 0.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is this an error in documentation? My chip's mask? Debugger anomaly? Or a caffeine deficiency?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 21 Jun 2008 00:33:38 GMT</pubDate>
    <dc:creator>dkelly</dc:creator>
    <dc:date>2008-06-21T00:33:38Z</dc:date>
    <item>
      <title>FSTAT_BLANK bit in FSTAT on S12NE64?</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/FSTAT-BLANK-bit-in-FSTAT-on-S12NE64/m-p/166272#M5404</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I don't see any errata on this, but am also not seeing any example code using FSTAT_BLANK.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This code is located in RAM and issues commands to the FLASH system:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#pragma MESSAGE DISABLE C12002&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;static void near&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ram_flash_cmd( UINT08 cmd, UINT08 page, UINT16 *address, UINT16 data )&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;UINT08 old_page; // don't know if this is important to save&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;_RESET_COP_();&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;// clear access and protection bits&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;FSTAT = ( FSTAT_ACCERR_MASK | FSTAT_PVIOL_MASK );&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;old_page = PPAGE; // save&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;PPAGE = page; // set&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;*address = data; // Sets data and address for FLASH state machine&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;FCMD = cmd;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;FSTAT_CBEIF = 1; // start FLASH command execution&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;nop();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;nop();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;nop();&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;while( FSTAT_CBEIF != 1 ) // infinite loop until set&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;if( FSTAT &amp;amp; ( FSTAT_ACCERR_MASK | FSTAT_PVIOL_MASK ) )&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ram_errno = 10;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;PPAGE = old_page; // restore&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;#pragma MESSAGE DEFAULT C12002&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When called ram_flash_cmd( 0x05, 0x3e, 0x8000, 0xffff ) to check the blank status FSTAT returns containing 0xC2, bit 1 is set. Manuals and #include files say bit 2 (mask 0x04) is the one we are looking for. Having previously called this routine with cmd = 0x40 I would expect the area to be erased, and looking with the memory window in the debugger confirms the apparent erased state. In all references bit 2 is undefined, said to always read as 0.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is this an error in documentation? My chip's mask? Debugger anomaly? Or a caffeine deficiency?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 21 Jun 2008 00:33:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/FSTAT-BLANK-bit-in-FSTAT-on-S12NE64/m-p/166272#M5404</guid>
      <dc:creator>dkelly</dc:creator>
      <dc:date>2008-06-21T00:33:38Z</dc:date>
    </item>
    <item>
      <title>Re: FSTAT_BLANK bit in FSTAT on S12NE64?</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/FSTAT-BLANK-bit-in-FSTAT-on-S12NE64/m-p/166273#M5405</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Erase verify command verifies if all bytes in&amp;nbsp;flash block are erased. It checks not&amp;nbsp;only&amp;nbsp;sector&amp;nbsp;you just&amp;nbsp;erased, but whole flash block, which probably is not blank.&amp;nbsp;FSTAT bit 1 is documented. It's a FAIL bit. See NE64 datasheet rev1.1.&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 21 Jun 2008 01:15:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/FSTAT-BLANK-bit-in-FSTAT-on-S12NE64/m-p/166273#M5405</guid>
      <dc:creator>kef</dc:creator>
      <dc:date>2008-06-21T01:15:15Z</dc:date>
    </item>
    <item>
      <title>Re: FSTAT_BLANK bit in FSTAT on S12NE64?</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/FSTAT-BLANK-bit-in-FSTAT-on-S12NE64/m-p/166274#M5406</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Ah, thanks! Not the sector but the whole shooting match (in my case the NE64 which has only one FLASH block)!&lt;BR /&gt;&lt;BR /&gt;Guess I'm just being too smart for my own good and should always erase a sector before writing to it rather than check to see if its already erased before erasing.&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 21 Jun 2008 01:41:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/FSTAT-BLANK-bit-in-FSTAT-on-S12NE64/m-p/166274#M5406</guid>
      <dc:creator>dkelly</dc:creator>
      <dc:date>2008-06-21T01:41:35Z</dc:date>
    </item>
    <item>
      <title>Re: FSTAT_BLANK bit in FSTAT on S12NE64?</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/FSTAT-BLANK-bit-in-FSTAT-on-S12NE64/m-p/166275#M5407</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Or just read the whole sector to see if it is blank?&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 21 Jun 2008 06:04:02 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/FSTAT-BLANK-bit-in-FSTAT-on-S12NE64/m-p/166275#M5407</guid>
      <dc:creator>peg</dc:creator>
      <dc:date>2008-06-21T06:04:02Z</dc:date>
    </item>
    <item>
      <title>Re: FSTAT_BLANK bit in FSTAT on S12NE64?</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/FSTAT-BLANK-bit-in-FSTAT-on-S12NE64/m-p/166276#M5408</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Yes, could read the sector of memory to verify blank but for all I knew there was a flag indicating whether any writes had occurred since last erase. There is an admonition in the data sheet against multiple writes to the same cell, for example when one might clear bits when external events occur. Or possibly someone had written 0xffff and the cell isn't the same as an erased 0xffff?&lt;BR /&gt;&lt;BR /&gt;Anyway, the command was there and I tried to use it only to discover it only applied to the entire 64K block and not a 512 byte sector.&lt;BR /&gt;&lt;BR /&gt;Rather than test for blank I'll simply erase the entire sector as I'm about to write it anyway. It should never be blank but thought it would be nice to verify it was blank after erased. Rather than blank check manually its more useful to verify my writes. And if the write fails I'll loop back, erase and try again.&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Jun 2008 20:46:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/FSTAT-BLANK-bit-in-FSTAT-on-S12NE64/m-p/166276#M5408</guid>
      <dc:creator>dkelly</dc:creator>
      <dc:date>2008-06-30T20:46:39Z</dc:date>
    </item>
  </channel>
</rss>

