<?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 How to reset FPROT register in CodeWarrior Development Tools</title>
    <link>https://community.nxp.com/t5/CodeWarrior-Development-Tools/How-to-reset-FPROT-register/m-p/376578#M2117</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I want to update the bootloader in the flash area from 0xE000 to 0xFFFF of the MC9S12DP512. The guys before me had protected this area by programming the FPROT register to 0xD7. To update this bootloader I have a program for maintenance running in RAM. It has to erase this flash area and write the new booloader. But with the protection in the FPROT register, this flash area cannot be erased.&lt;/P&gt;&lt;P&gt;Does someone know how to reset the FPROT register to 0xFF to unlock the flash area or how to mass erase the whole flash if needed. I don't mind what is in the flash memory of the MCU, everything can be erased. &lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;I have set the FPROT to 0xFF in my maintenance program but it does not change.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt; I don't have USBDM but only a serial line RS232 to upload the maintenance program into RAM.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Let me know if you need more information.&lt;/P&gt;&lt;P&gt;Thanks a lot&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 14 Feb 2015 17:56:26 GMT</pubDate>
    <dc:creator>beejondlam</dc:creator>
    <dc:date>2015-02-14T17:56:26Z</dc:date>
    <item>
      <title>How to reset FPROT register</title>
      <link>https://community.nxp.com/t5/CodeWarrior-Development-Tools/How-to-reset-FPROT-register/m-p/376578#M2117</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I want to update the bootloader in the flash area from 0xE000 to 0xFFFF of the MC9S12DP512. The guys before me had protected this area by programming the FPROT register to 0xD7. To update this bootloader I have a program for maintenance running in RAM. It has to erase this flash area and write the new booloader. But with the protection in the FPROT register, this flash area cannot be erased.&lt;/P&gt;&lt;P&gt;Does someone know how to reset the FPROT register to 0xFF to unlock the flash area or how to mass erase the whole flash if needed. I don't mind what is in the flash memory of the MCU, everything can be erased. &lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;I have set the FPROT to 0xFF in my maintenance program but it does not change.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt; I don't have USBDM but only a serial line RS232 to upload the maintenance program into RAM.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Let me know if you need more information.&lt;/P&gt;&lt;P&gt;Thanks a lot&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 14 Feb 2015 17:56:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-Development-Tools/How-to-reset-FPROT-register/m-p/376578#M2117</guid>
      <dc:creator>beejondlam</dc:creator>
      <dc:date>2015-02-14T17:56:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to reset FPROT register</title>
      <link>https://community.nxp.com/t5/CodeWarrior-Development-Tools/How-to-reset-FPROT-register/m-p/376579#M2118</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am very sorry I do not have good news for you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If we are able to unprotect the flash then protection loses sense. The protection can only be increased by changing FPROT. The protection also protects flash protection option field FF0A~FF0D so you are not able to avoid protection setup during reset if the protection is set by flash configuration field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The only case when we are able to play a game with FPROT is in the special mode when FROT register can be written to any value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The only possibility is a mass erase command which erases entire flash memory. If you use this command you must think about flash security byte (@ address FF0F) rewriting. (I hope you know difference between security and protection) After mass erase is executed the flash security byte is 0xFF which means the bits FSEC1 and FSEC0 has combination 0B11 so the MCU will be after next reset secured and you will not be able to acces the flash. The only possibility will be mass erase command (also almost all BDM commands are disabled). Correct value for these bits is 0B10 - the device is unsecured.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If your maintenance program is able to load some code to RAM and run it from it then there is possibility to erase entire flash by mass erase. Note, after reset, your maintenance code will disappear from RAM, flash is already erased so the MCU is clear and the only possibility to do anything is BDM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P align="left" style="text-align: left;"&gt;If you see this answer as correct answer please mark it as correct and helpful to help others to find good answers faster. Thank you in advance.&lt;/P&gt;&lt;P align="left"&gt;&lt;/P&gt;&lt;P&gt;Best Regards, Ladislav&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Feb 2015 12:26:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-Development-Tools/How-to-reset-FPROT-register/m-p/376579#M2118</guid>
      <dc:creator>lama</dc:creator>
      <dc:date>2015-02-17T12:26:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to reset FPROT register</title>
      <link>https://community.nxp.com/t5/CodeWarrior-Development-Tools/How-to-reset-FPROT-register/m-p/376580#M2119</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;We have run into a similar predicament in our application. Would it be possible to:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Make a temporary copy of just the sector containing the FPROT registers (0xFC00-0xFFFF)&lt;/LI&gt;&lt;LI&gt;Do a sector erase on (0xFC00-0xFFFF). BTW - how is the desired sector specified to be erased?&lt;/LI&gt;&lt;LI&gt;Modify the portion of the temporary copy corresponding to the FPROT registers, setting them to 0xFF.&lt;/LI&gt;&lt;LI&gt;Write the temporary copy to the now-erased sector.&lt;/LI&gt;&lt;/OL&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Jun 2016 18:41:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-Development-Tools/How-to-reset-FPROT-register/m-p/376580#M2119</guid>
      <dc:creator>bradsevers</dc:creator>
      <dc:date>2016-06-13T18:41:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to reset FPROT register</title>
      <link>https://community.nxp.com/t5/CodeWarrior-Development-Tools/How-to-reset-FPROT-register/m-p/376581#M2120</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am sorry for delay caused by vacation.&lt;/P&gt;&lt;P&gt;I have another idea. You have to connect debugger to the device in the special single chip mode (MODC=1, MODB=MODA=0). Then also write once registers are writeable. FPROT can also be written as you want and you also can change content of FLASH. The procedure can be similar as the CodeWarrior uses in the p&amp;amp;e_erase_unsecure_hcs12.cmd&amp;nbsp;&amp;nbsp; file presented below. You only omit mas erase code and you can rewrite flash as well as FPROT reg.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// ver 1.1 (7/7/04)&lt;/P&gt;&lt;P&gt;// HCS12X Core erasing + unsecuring command file:&lt;/P&gt;&lt;P&gt;// These commands mass erase the chip then program the security byte to 0xFE (unsecured state).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Evaluate the clock divider to set in ECLKDIV/FCLKDIV registers:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DEFINEVALUEDLG "Information required to unsecure the device" "CLKDIV" 0x49 "To unsecure the device, the command script needs \nthe correct value for ECLKDIV/FCLKDIV onchip\nregisters.\nIf the bus frequency is less than 10 MHz, the value\nto store in ECLKDIV/FCLKDIV is equal to:\n \"bus frequency (kHz) / 175\"\n\nIf the bus frequency is higher than 10 MHz, the value\nto store in ECLKDIV/FCLKDIV is equal to:\n \" bus frequency (kHz) / 1400&amp;nbsp; + 64\"\n(+64 (0x40) is to set PRDIV8 flag)\n\nDatasheet proposed values:\n\nbus frequency\t\tE/FCLKDIV value (decimal)\n\n 16 \tMHz\t\t73\n&amp;nbsp; 8 \tMHz\t\t39\n&amp;nbsp; 4 \tMHz\t\t19\n&amp;nbsp; 2 \tMHz\t\t9\n&amp;nbsp; 1 \tMHz\t\t4\n"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// An average programming clock of 175 kHz is chosen.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// If the oscillator frequency is less than 10 MHz, the value to store&lt;/P&gt;&lt;P&gt;// in ECLKDIV/FCLKDIV is equal to " oscillator frequency (kHz) / 175 ".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// If the oscillator frequency is higher than 10 MHz, the value to store&lt;/P&gt;&lt;P&gt;// in ECLKDIV/FCLKDIV is equal to " oscillator frequency (kHz) / 1400&amp;nbsp; + 0x40 (to set PRDIV8 flag)".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Datasheet proposed values:&lt;/P&gt;&lt;P&gt;//&lt;/P&gt;&lt;P&gt;// oscillator frequency&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ECLKDIV/FCLKDIV value (hexadecimal)&lt;/P&gt;&lt;P&gt;// &lt;/P&gt;&lt;P&gt;//&amp;nbsp; 16 MHz&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $49&lt;/P&gt;&lt;P&gt;//&amp;nbsp;&amp;nbsp; 8 MHz&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $27&lt;/P&gt;&lt;P&gt;//&amp;nbsp;&amp;nbsp; 4 MHz&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $13&lt;/P&gt;&lt;P&gt;//&amp;nbsp;&amp;nbsp; 2 MHz&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $9&lt;/P&gt;&lt;P&gt;//&amp;nbsp;&amp;nbsp; 1 MHz&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $4&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FLASH RELEASE&amp;nbsp;&amp;nbsp; // do not interact with regular flash programming monitor&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//mass erase flash&lt;/P&gt;&lt;P&gt;reset&lt;/P&gt;&lt;P&gt;wb 0x03c 0x00&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //disable cop&lt;/P&gt;&lt;P&gt;wait 20&lt;/P&gt;&lt;P&gt;wb 0x100 CLKDIV&amp;nbsp; // set FCLKDIV clock divider&lt;/P&gt;&lt;P&gt;wb 0x104 0xFF&amp;nbsp;&amp;nbsp;&amp;nbsp; // FPROT all protection disabled&lt;/P&gt;&lt;P&gt;wb 0x105 0x30&amp;nbsp;&amp;nbsp;&amp;nbsp; // clear PVIOL and ACCERR in FSTAT register &lt;/P&gt;&lt;P&gt;wb 0x102 0x00&amp;nbsp;&amp;nbsp;&amp;nbsp; // clear the WRALL bit in FTSTMOD&lt;/P&gt;&lt;P&gt;wb 0x105 0x02&lt;/P&gt;&lt;P&gt;wb 0x102 0x10&amp;nbsp;&amp;nbsp;&amp;nbsp; // set the WRALL bit in FTSTMOD to affect all blocks&lt;/P&gt;&lt;P&gt;ww 0x108 0xFFFE&lt;/P&gt;&lt;P&gt;ww 0x10A 0xFFFF&lt;/P&gt;&lt;P&gt;wb 0x106 0x41&amp;nbsp;&amp;nbsp;&amp;nbsp; // write MASS ERASE command in FCMD register&lt;/P&gt;&lt;P&gt;wb 0x105 0x80&amp;nbsp;&amp;nbsp;&amp;nbsp; // clear CBEIF in FSTAT register to execute the command &lt;/P&gt;&lt;P&gt;wait 20&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // wait for command to complete&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//mass erase eeprom&lt;/P&gt;&lt;P&gt;wb 0x110 CLKDIV&amp;nbsp; // set ECLKDV clock divider &lt;/P&gt;&lt;P&gt;wb 0x114 0xFF&amp;nbsp;&amp;nbsp;&amp;nbsp; // EPROT all protection disabled&lt;/P&gt;&lt;P&gt;wb 0x115 0x30&amp;nbsp;&amp;nbsp;&amp;nbsp; // clear PVIOL and ACCERR in ESTAT register &lt;/P&gt;&lt;P&gt;wb 0x112 0x00&amp;nbsp;&amp;nbsp;&amp;nbsp; // clear the WRALL bit in FTSTMOD&lt;/P&gt;&lt;P&gt;wb 0x115 0x02&lt;/P&gt;&lt;P&gt;ww 0x118 0x0C00&amp;nbsp; // write to EADDR eeprom address register&lt;/P&gt;&lt;P&gt;ww 0x11A 0x0000&amp;nbsp; // write to EDATA eeprom data register&lt;/P&gt;&lt;P&gt;wb 0x116 0x41&amp;nbsp;&amp;nbsp;&amp;nbsp; // write MASS ERASE command in ECMD register&lt;/P&gt;&lt;P&gt;wb 0x115 0x80&amp;nbsp;&amp;nbsp;&amp;nbsp; // clear CBEIF in ESTAT register to execute the command&lt;/P&gt;&lt;P&gt;wait 20&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // wait for command to complete&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//reprogram Security byte to Unsecure state&lt;/P&gt;&lt;P&gt;reset&lt;/P&gt;&lt;P&gt;wb 0x03c 0x00&amp;nbsp;&amp;nbsp;&amp;nbsp; //disable cop&lt;/P&gt;&lt;P&gt;wait 20&lt;/P&gt;&lt;P&gt;wb 0x102 0x00&amp;nbsp;&amp;nbsp;&amp;nbsp; // clear the WRALL bit in FTSTMOD&lt;/P&gt;&lt;P&gt;wb 0x105 0x02&lt;/P&gt;&lt;P&gt;wb 0x100 CLKDIV&amp;nbsp; // set FCLKDIV clock divider&lt;/P&gt;&lt;P&gt;wb 0x100 CLKDIV&amp;nbsp; // set FCLKDIV clock divider&lt;/P&gt;&lt;P&gt;wb 0x104 0xFF&amp;nbsp;&amp;nbsp;&amp;nbsp; // FPROT all protection disabled&lt;/P&gt;&lt;P&gt;wb 0x105 0x30&amp;nbsp;&amp;nbsp;&amp;nbsp; // clear PVIOL and ACCERR in FSTAT register &lt;/P&gt;&lt;P&gt;wb 0x102 0x00&amp;nbsp;&amp;nbsp;&amp;nbsp; // clear the WRALL bit in FTSTMOD&lt;/P&gt;&lt;P&gt;wb 0x105 0x02&lt;/P&gt;&lt;P&gt;ww 0xFF0E 0xFFFE // write security byte to "Unsecured" state&lt;/P&gt;&lt;P&gt;wb 0x106 0x20&amp;nbsp;&amp;nbsp;&amp;nbsp; // write MEMORY PROGRAM command in FCMD register&lt;/P&gt;&lt;P&gt;wb 0x105 0x80&amp;nbsp;&amp;nbsp;&amp;nbsp; // clear CBEIF in FSTAT register to execute the command &lt;/P&gt;&lt;P&gt;wait 20&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // wait for command to complete&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;reset&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;undef CLKDIV&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // undefine variable &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&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>Mon, 27 Jun 2016 09:50:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-Development-Tools/How-to-reset-FPROT-register/m-p/376581#M2120</guid>
      <dc:creator>lama</dc:creator>
      <dc:date>2016-06-27T09:50:31Z</dc:date>
    </item>
  </channel>
</rss>

