<?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のトピックRe: COPCTL loading problem at start from flash</title>
    <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/COPCTL-loading-problem-at-start-from-flash/m-p/229275#M9345</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you very much for the answer, it solves the problem.&lt;/P&gt;&lt;P&gt;I add the "FLASH NOUNSECURE" command and now the values are correct and the COP work correctly. :-)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the first case I was able to read the registers because my application has a display and I was able to print them on it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 19 Jan 2013 09:22:03 GMT</pubDate>
    <dc:creator>xak</dc:creator>
    <dc:date>2013-01-19T09:22:03Z</dc:date>
    <item>
      <title>COPCTL loading problem at start from flash</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/COPCTL-loading-problem-at-start-from-flash/m-p/229272#M9342</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I use the microcontroller S12XET256 with codewarrior 5.0.&lt;/P&gt;&lt;P&gt;My application run in a noised environment so I must enable the COP at start by loading the COPCTL from flash at reset.&lt;/P&gt;&lt;P&gt;As recommended, I use this 4 instructions to program flash NV registers:&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;const byte NVFPROT_INIT @0x0000FF0C = 0x7F; //FULL PFLASH SECURED&lt;/P&gt;&lt;P&gt;const byte NVEPROT_INIT @0x0000FF0D = 0xFF;&lt;/P&gt;&lt;P&gt;const byte NVFOPT_INIT @0x0000FF0E&amp;nbsp;&amp;nbsp; = 0xF9; //COP CR[2:0]=6&lt;/P&gt;&lt;P&gt;const byte NVFSEC_INIT @0x0000FF0F&amp;nbsp;&amp;nbsp; = 0x7D //SECURED, KEY DISABLED&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But after start I read this by respective register and the COP, obviously, don't run:&lt;/P&gt;&lt;P&gt;FPROT=0x7F&amp;nbsp; (OK)&lt;/P&gt;&lt;P&gt;EPROT=0x7F&amp;nbsp; (wrong, should be 0x7F)&lt;/P&gt;&lt;P&gt;FOPT=0xFF&amp;nbsp;&amp;nbsp;&amp;nbsp; (wrong, should be 0xF9)&lt;/P&gt;&lt;P&gt;FSEC=0xFF&amp;nbsp;&amp;nbsp;&amp;nbsp; (wrong, should be 0x7D)&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I try also with this settings:&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;const byte NVFPROT_INIT @0x0000FF0C = 0xFF;&lt;/P&gt;&lt;P&gt;const byte NVEPROT_INIT @0x0000FF0D = 0xFF;&lt;/P&gt;&lt;P&gt;const byte NVFOPT_INIT @0x0000FF0E&amp;nbsp;&amp;nbsp; = 0xF9;&lt;/P&gt;&lt;P&gt;const byte NVFSEC_INIT @0x0000FF0F&amp;nbsp;&amp;nbsp; = 0xFF&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And I read this:&lt;/P&gt;&lt;P&gt;FPROT=0xFF (OK)&lt;/P&gt;&lt;P&gt;EPROT=0xFF (OK)&lt;/P&gt;&lt;P&gt;FOPT=0xFE&amp;nbsp; (wrong, should be 0xF9)&lt;/P&gt;&lt;P&gt;FSEC=0xFE&amp;nbsp; (wrong, should be 0xFF)&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;I use this funcion for another microcontroller (S12P128) without problems.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;I wondering if someone has used this function with success or know the cause of problem.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;Thanks in advance and best regards&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Jan 2013 11:08:04 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/COPCTL-loading-problem-at-start-from-flash/m-p/229272#M9342</guid>
      <dc:creator>xak</dc:creator>
      <dc:date>2013-01-18T11:08:04Z</dc:date>
    </item>
    <item>
      <title>Re: COPCTL loading problem at start from flash</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/COPCTL-loading-problem-at-start-from-flash/m-p/229273#M9343</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;By default codewarrior debugger reprograms NVSEC with 0xFE before loading your code. This worked for older S12(X), but failes for newer parts with ECC flash. You need to following command to your ???preload.cmd file:&lt;/P&gt;&lt;P&gt;FLASH NOUNSECURE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Are you sure your S12P project doesn't contain this command in preload.cmd?&lt;/P&gt;&lt;P&gt;Also, since you are enabling security, how do you read and verify&amp;nbsp; FOPT, FSEC values? It should be not possible using debugger.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Jan 2013 11:53:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/COPCTL-loading-problem-at-start-from-flash/m-p/229273#M9343</guid>
      <dc:creator>kef</dc:creator>
      <dc:date>2013-01-18T11:53:53Z</dc:date>
    </item>
    <item>
      <title>Re: COPCTL loading problem at start from flash</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/COPCTL-loading-problem-at-start-from-flash/m-p/229274#M9344</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, Eduard has true.&lt;/P&gt;&lt;P&gt;Obviously ECC algorithm tries fixing corrupted data by one bit changing.&lt;/P&gt;&lt;P&gt;For example I will take second case:&lt;/P&gt;&lt;P&gt;Prior your write was data 0xFF, 0xFF, 0xFF, 0xFE (MCU unsecured)&lt;/P&gt;&lt;P&gt;You write 0xFF, 0xFF, 0xF9, 0xFF&lt;/P&gt;&lt;P&gt;In flash is after that 0xFF, 0xFF, 0xF9, 0xFE, but there ECC checksum didn’t fits and when you read data, ECC algorithm try fixing 1bit error and you get: 0xFF, 0xFF, 0xFE, 0xFE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Problem is caused by cumulative write to the same phrase.&lt;/P&gt;&lt;P&gt;In attachment you can find short description of security feature at S12(X) devices.&lt;/P&gt;&lt;P&gt;Result behaviour depends on checksum value (of whole phrase) and therefore it is heavy predictable (sometimes it can work).&lt;/P&gt;&lt;P&gt;Anyway cumulative write to flash is not allowed. You should use FLASH NOUNSECURE command in preload file when you using loading code by CW.&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, 18 Jan 2013 12:25:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/COPCTL-loading-problem-at-start-from-flash/m-p/229274#M9344</guid>
      <dc:creator>RadekS</dc:creator>
      <dc:date>2013-01-18T12:25:24Z</dc:date>
    </item>
    <item>
      <title>Re: COPCTL loading problem at start from flash</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/COPCTL-loading-problem-at-start-from-flash/m-p/229275#M9345</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you very much for the answer, it solves the problem.&lt;/P&gt;&lt;P&gt;I add the "FLASH NOUNSECURE" command and now the values are correct and the COP work correctly. :-)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the first case I was able to read the registers because my application has a display and I was able to print them on it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 19 Jan 2013 09:22:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/COPCTL-loading-problem-at-start-from-flash/m-p/229275#M9345</guid>
      <dc:creator>xak</dc:creator>
      <dc:date>2013-01-19T09:22:03Z</dc:date>
    </item>
  </channel>
</rss>

