<?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>S12 / MagniV Microcontrollers中的主题 Flash data lost</title>
    <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Flash-data-lost/m-p/275045#M9960</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Hi,guys!&lt;/P&gt;&lt;P&gt;The use of MC9S12C64 is as a ECU controller, a few days ago, there is a problem: at first, the engine works well, but after the vehicle has drivered 3000km,the code which is in&amp;nbsp; the MCU is erased directly, the specific address is 0x6000 to 0x6400, the code of other regional is no problem, so is there anybody can tell me what is the cause?&lt;/P&gt;&lt;P&gt;Any help offered would be greatly appreciated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 05 Jun 2013 02:58:14 GMT</pubDate>
    <dc:creator>gexiaocheng</dc:creator>
    <dc:date>2013-06-05T02:58:14Z</dc:date>
    <item>
      <title>Flash data lost</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Flash-data-lost/m-p/275045#M9960</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Hi,guys!&lt;/P&gt;&lt;P&gt;The use of MC9S12C64 is as a ECU controller, a few days ago, there is a problem: at first, the engine works well, but after the vehicle has drivered 3000km,the code which is in&amp;nbsp; the MCU is erased directly, the specific address is 0x6000 to 0x6400, the code of other regional is no problem, so is there anybody can tell me what is the cause?&lt;/P&gt;&lt;P&gt;Any help offered would be greatly appreciated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Jun 2013 02:58:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Flash-data-lost/m-p/275045#M9960</guid>
      <dc:creator>gexiaocheng</dc:creator>
      <dc:date>2013-06-05T02:58:14Z</dc:date>
    </item>
    <item>
      <title>Re: Flash data lost</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Flash-data-lost/m-p/275046#M9961</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are you using S12C flash for data EEPROM emulation? Then most likely you have a bug in emulation routines.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Jun 2013 08:02:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Flash-data-lost/m-p/275046#M9961</guid>
      <dc:creator>kef</dc:creator>
      <dc:date>2013-06-06T08:02:39Z</dc:date>
    </item>
    <item>
      <title>Re: Flash data lost</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Flash-data-lost/m-p/275047#M9962</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes,your inference is right, I am using S12C flash for data EEPROM emulation.&lt;/P&gt;&lt;P&gt;But the address of flash for data EEPROM emulation is 0xC000~0xC400, and the command for erase the flash is just &lt;STRONG&gt;sector erase&lt;/STRONG&gt; (FCMD=0x40), but the address which the data was lost is 0x6000~0x6400.&lt;/P&gt;&lt;P&gt;Other thing is the data is correct in the flash when we test it on the Demo board and routines is running well.&lt;/P&gt;&lt;P&gt;So can you give me some suggestion to repeat this phenomenon or other help? Thank you!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Jun 2013 02:12:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Flash-data-lost/m-p/275047#M9962</guid>
      <dc:creator>gexiaocheng</dc:creator>
      <dc:date>2013-06-07T02:12:55Z</dc:date>
    </item>
    <item>
      <title>Re: Flash data lost</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Flash-data-lost/m-p/275048#M9963</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, if it's not the problem in emulation routines, then maybe other part of code by mistake writes to flash status register or something like that. I recommend you to move your data area to 0x4000.. and use flash write protection. I like it. On S12C it is possible to have initially only bootloader write protected, and then extend write protection to lower addresses keeping data area at 0x4000 not write protected. Just a single write to FPROT and no worry about accidental code erasure. Of course real cause of issue still should be investigated.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Jun 2013 07:20:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Flash-data-lost/m-p/275048#M9963</guid>
      <dc:creator>kef</dc:creator>
      <dc:date>2013-06-07T07:20:18Z</dc:date>
    </item>
    <item>
      <title>Re: Flash data lost</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Flash-data-lost/m-p/275049#M9964</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;First point (How): From you description it seems that data on address 0x6000 to 0x6400 was erased accidentally by your software. You mentioned that you use EEPROM emulation at 0xC000~0xC400. I suppose that probably initial code for EEPROM emulation was executed however with wrong parameter. There is too many similarities (0x400 data area, 0xC=0b1100, 0x6=0b0110).&lt;/P&gt;&lt;P&gt;Could you please check your software if there is somewhere used bit shift for address of erased area?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Second point (Why): I suppose that erase code was executed accidentally. Typical reasons where CPU gets lost are:&lt;/P&gt;&lt;OL style="list-style-type: decimal;"&gt;&lt;LI&gt;Unexpected interrupt&lt;/LI&gt;&lt;LI&gt;Stack overflow&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;I would like to recommend specify interrupt function for every interrupt source even if this function contains just single NOP or BGND instruction. Default values of unused reset vectors (0xFFFF) are not valid and MCU will work unpredictable in case of unexpected interrupt. Unfortunately S12C doesn’t have illegal address reset. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you please check your stack placement and variables which are placed under stack (if there are any)?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyway investigating will be probably difficult.&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Jun 2013 16:05:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Flash-data-lost/m-p/275049#M9964</guid>
      <dc:creator>RadekS</dc:creator>
      <dc:date>2013-06-07T16:05:29Z</dc:date>
    </item>
    <item>
      <title>Re: Flash data lost</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Flash-data-lost/m-p/275050#M9965</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P align="left" style="text-align: left; margin-top: auto; text-indent: 0cm; margin-bottom: auto;"&gt;&lt;SPAN lang="EN-US" style="font-family: 'Arial','sans-serif';"&gt;I am very glad to see your replies. and thank you very much for everybody. :smileyhappy:&lt;/SPAN&gt;&lt;/P&gt;&lt;P align="left" style="text-align: left; margin-top: auto; text-indent: 0cm; margin-bottom: auto;"&gt;&lt;SPAN lang="EN-US" style="font-family: 'Arial','sans-serif';"&gt;One thing need to confirm is&amp;nbsp; just the MCU lost the code on address 0x6000 to 0x6400, we don't know the specific reason ,we just guess the possible reason is the&amp;nbsp; 0x6000~0x6400 flash was erased accidentally when we used S12C flash for data EEPROM emulation.&lt;/SPAN&gt;&lt;/P&gt;&lt;P align="left" style="text-align: left; margin-top: auto; text-indent: 0cm; margin-bottom: auto;"&gt;&lt;SPAN lang="EN-US" style="font-family: 'Arial','sans-serif';"&gt;According to your analysis, I do check the software, and&amp;nbsp; the result as follows:&lt;/SPAN&gt;&lt;/P&gt;&lt;P align="left" style="text-align: left; margin-top: auto; text-indent: 0cm; margin-bottom: auto;"&gt;&lt;SPAN lang="EN-US" style="font-family: 'Arial','sans-serif';"&gt;&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-family: 'Arial','sans-serif';"&gt;1. The function which is for flash erase, got the address by taking pointer of the array, and it desn't use bit shift. The function is like that:&lt;/SPAN&gt;&lt;/P&gt;&lt;P align="left" style="text-align: left; margin-top: auto; text-indent: 0cm; margin-bottom: auto;"&gt;&lt;SPAN lang="EN-US" style="font-family: 'Arial','sans-serif';"&gt;fburner ( (unsigned int *)&amp;amp;InputEepromInFlashRecorded, (unsigned int *)&amp;amp;InputEepromInRam, sizeof(InputEepromInFlashRecorded)/2);&lt;/SPAN&gt;&lt;/P&gt;&lt;P align="left" style="text-align: left; margin-top: auto; text-indent: 0cm; margin-bottom: auto;"&gt;&lt;SPAN lang="EN-US" style="font-family: 'Arial','sans-serif';"&gt;"InputEepromInFlashRecorded" is an array which defined by myself.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="font-family: 'Arial','sans-serif';"&gt;2. Unexpected interrput.&lt;/SPAN&gt;&lt;/P&gt;&lt;P align="left" style="text-align: left; margin-top: auto; text-indent: 0cm; margin-bottom: auto;"&gt;&lt;SPAN lang="EN-US" style="font-family: 'Arial','sans-serif';"&gt;Now we used 13 interrupts, they are &lt;/SPAN&gt;&lt;SPAN style="font-family: 宋体;"&gt;：&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-family: 'Arial','sans-serif';"&gt;System Reset&lt;/SPAN&gt;&lt;SPAN style="font-family: 宋体;"&gt;，&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-family: 'Arial','sans-serif';"&gt;Real Time Interrupt&lt;/SPAN&gt;&lt;SPAN style="font-family: 宋体;"&gt;，&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-family: 'Arial','sans-serif';"&gt;Standard Timer Channel 0~7&lt;/SPAN&gt;&lt;SPAN style="font-family: 宋体;"&gt;，&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-family: 'Arial','sans-serif';"&gt;Standard Timer Overflow&lt;/SPAN&gt;&lt;SPAN style="font-family: 宋体;"&gt;，&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-family: 'Arial','sans-serif';"&gt;SCI&lt;/SPAN&gt;&lt;SPAN style="font-family: 宋体;"&gt;，&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-family: 'Arial','sans-serif';"&gt;PortP Interrupt. Other unimplemented Interrupts have an same interrupt function. The function is like that:&lt;/SPAN&gt;&lt;/P&gt;&lt;P align="left" style="text-align: left; margin-top: auto; text-indent: 0cm; margin-bottom: auto;"&gt;&lt;SPAN lang="EN-US" style="font-family: 'Arial','sans-serif';"&gt;__interrupt void unimplementISR( void )&lt;/SPAN&gt;&lt;/P&gt;&lt;P align="left" style="text-align: left; margin-top: auto; text-indent: 0cm; margin-bottom: auto;"&gt;&lt;SPAN lang="EN-US" style="font-family: 'Arial','sans-serif';"&gt;{&lt;/SPAN&gt;&lt;/P&gt;&lt;P align="left" style="text-align: left; margin-top: auto; text-indent: 0cm; margin-bottom: auto;"&gt;&lt;SPAN lang="EN-US" style="font-family: 'Arial','sans-serif';"&gt;&amp;nbsp; return;&lt;/SPAN&gt;&lt;/P&gt;&lt;P align="left" style="text-align: left; margin-top: auto; text-indent: 0cm; margin-bottom: auto;"&gt;&lt;SPAN lang="EN-US" style="font-family: 'Arial','sans-serif';"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P align="left" style="text-align: left; margin-top: auto; text-indent: 0cm; margin-bottom: auto;"&gt;&lt;SPAN lang="EN-US" style="font-family: 'Arial','sans-serif';"&gt;So I think unexpected interrupt will not cause flash erase.&lt;/SPAN&gt;&lt;/P&gt;&lt;P align="left" style="text-align: left; margin-top: auto; text-indent: 0cm; margin-bottom: auto;"&gt;&lt;SPAN lang="EN-US" style="font-family: 'Arial','sans-serif';"&gt;Another thing: I changed the highest priority interrupt which is standard timer channal 0 interrupt( HPRIO=0xEE;).&lt;/SPAN&gt;&lt;/P&gt;&lt;P align="left" style="text-align: left; margin-top: auto; text-indent: 0cm; margin-bottom: auto;"&gt;&lt;SPAN lang="EN-US" style="font-family: 'Arial','sans-serif';"&gt;&lt;/SPAN&gt;&lt;SPAN lang="EN-US" style="font-family: 'Arial','sans-serif';"&gt;3. Stack overflow&lt;/SPAN&gt;&lt;/P&gt;&lt;P align="left" style="text-align: left; margin-top: auto; text-indent: 0cm; margin-bottom: auto;"&gt;&lt;SPAN lang="EN-US" style="font-family: 'Arial','sans-serif';"&gt; Now stack size is 0x100 bytes.and&amp;nbsp; I didn't clear the I-bit and other interrupts were forbid during the routines was running in any interrupt. So I think stack overflow is almost impossible, however, I haven't test it, I am not sure.&lt;/SPAN&gt;&lt;/P&gt;&lt;P align="left" style="text-align: left; margin-top: auto; text-indent: 0cm; margin-bottom: auto;"&gt;&lt;SPAN lang="EN-US" style="font-family: 'Arial','sans-serif';"&gt;The variables which are placed under stack are static variables, and these variables are used for SCI communication and other control logic, there is no relationship with flash address.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-US" style="font-family: 'Arial','sans-serif';"&gt;4. Flash Security&lt;/SPAN&gt;&lt;/P&gt;&lt;P align="left" style="text-align: left; margin-top: auto; text-indent: 0cm; margin-bottom: auto;"&gt;&lt;SPAN lang="EN-US" style="font-family: 'Arial','sans-serif';"&gt;Now I didn't used flash security function( $FF0F=0xFE ); my colleage told me the flash was erased maybe by BKGD port for electrical noise. If we used this function of flash security, all flash memory will be protect and flash was erased by BKGD will be prevented. So how do you think about it?&lt;/SPAN&gt;&lt;/P&gt;&lt;P align="left" style="text-align: left; margin-top: auto; text-indent: 0cm; margin-bottom: auto;"&gt;&lt;SPAN lang="EN-US" style="font-family: 'Arial','sans-serif';"&gt;According to the trouble shooting rules, I think now the urgent thing is how to repeat this issue, then we can find the real&amp;nbsp; cause.&lt;/SPAN&gt;&lt;/P&gt;&lt;P align="left" style="text-align: left; margin-top: auto; text-indent: 0cm; margin-bottom: auto;"&gt;&lt;SPAN lang="EN-US" style="font-family: 'Arial','sans-serif';"&gt;Thank you again for all of you!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 09 Jun 2013 01:06:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Flash-data-lost/m-p/275050#M9965</guid>
      <dc:creator>gexiaocheng</dc:creator>
      <dc:date>2013-06-09T01:06:46Z</dc:date>
    </item>
    <item>
      <title>Re: Flash data lost</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Flash-data-lost/m-p/275051#M9966</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Security disables reads over BDM, but doesn't disable writes to registers, so it doesn't disable flash erase. Instead you should use flash write protection.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 09 Jun 2013 13:51:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Flash-data-lost/m-p/275051#M9966</guid>
      <dc:creator>kef</dc:creator>
      <dc:date>2013-06-09T13:51:29Z</dc:date>
    </item>
  </channel>
</rss>

