<?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 Re: Program Once field in [MC9S12XET256] in S12 / MagniV Microcontrollers</title>
    <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Program-Once-field-in-MC9S12XET256/m-p/647026#M13726</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN class="" lang="en"&gt;&lt;SPAN class=""&gt;Thank you for your answer. I will check your code, and in case of problems I write to you. &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 10 Jan 2017 08:32:57 GMT</pubDate>
    <dc:creator>g_g1</dc:creator>
    <dc:date>2017-01-10T08:32:57Z</dc:date>
    <item>
      <title>Program Once field in [MC9S12XET256]</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Program-Once-field-in-MC9S12XET256/m-p/647022#M13722</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to write a Serial Number of a device to the CPU memory. I don't want to change it in the future so it would be the best to use Program Once field placed at 0x400100 address but I'm not albe to write there anything. &lt;BR /&gt;If I set PGMIFRON bit in the MMCCTL1 register and then try writing under the Program Once field address via far pointer I'm getting ILLEGAL_BP in HiWave. &lt;BR /&gt;I've tried using debugger commands but all i'm getting is "Error: error while writing to the memory".&lt;BR /&gt;Could someone please give me a simple step by step instruction how can I do this?&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Dec 2016 13:52:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Program-Once-field-in-MC9S12XET256/m-p/647022#M13722</guid>
      <dc:creator>g_g1</dc:creator>
      <dc:date>2016-12-28T13:52:51Z</dc:date>
    </item>
    <item>
      <title>Re: Program Once field in [MC9S12XET256]</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Program-Once-field-in-MC9S12XET256/m-p/647023#M13723</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;To answer my own question - I've worked it out. However a new problem has arosed. &lt;BR /&gt;I used CCOBIX and FCCOB registers (all listed below) to launch Program Once command. &lt;BR /&gt;Everythings looks good, memory is written but after this operation I'm getting an ILLEGAL_BP and processor goes to the reset. &lt;BR /&gt;How can I solve this problem?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp; COPCTL = 0x0u; // disable COP (Computer Operating Properly) watchdog [is it required?]&lt;BR /&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp; FCLKDIV = 0x05u; // clock divider = 5 (4 MHz) [is it required?]&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FSTAT = 0x30u; // clear any error flags&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FCCOBIX = 0x0u; // CCOBIX = 0&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FCCOBHI = 0x07u; // load Program Once command&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FCCOBLO = 0x0u;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FCCOBIX = 0x1u; // CCOBIX = 1&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FCCOBHI = 0x0u; // load Program Once phrase index&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FCCOBLO = 0x0u; // load Program Once phrase index&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FCCOBIX = 0x2u; // CCOBIX = 2&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FCCOBHI = 0xDEu; // load Program Once word 0 value&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FCCOBLO = 0xAD; // load Program Once word 0 value&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FCCOBIX = 0x3u; // CCOBIX = 3&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FCCOBHI = 0xBEu; // load Program Once word 1 value&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FCCOBLO = 0xEFu; // load Program Once word 1 value&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FCCOBIX = 0x4u; // CCOBIX = 4&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FCCOBHI = 0xDEu; // load Program Once word 2 value&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FCCOBLO = 0xADu; // load Program Once word 2 value&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FCCOBIX = 0x5u; // CCOBIX = 5&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FCCOBHI = 0xCAu; // load Program Once word 3 value&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FCCOBLO = 0xFEu; // load Program Once word 3 value&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FSTAT = 0x80u; // launch command&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;g g&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Dec 2016 14:45:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Program-Once-field-in-MC9S12XET256/m-p/647023#M13723</guid>
      <dc:creator>g_g1</dc:creator>
      <dc:date>2016-12-29T14:45:28Z</dc:date>
    </item>
    <item>
      <title>Re: Program Once field in [MC9S12XET256]</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Program-Once-field-in-MC9S12XET256/m-p/647024#M13724</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;gg,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The issue here is that when programming the "Write Once" field, the program memory becomes in accessible. That is, it is the same issue as if you had tried to program the PFlash block. In order to program the&amp;nbsp;"Write Once" field, the code that launches the "WriteOnce" command and waits for it to complete must execute from RAM. In fact, even when reading the&amp;nbsp;"Write Once" field, the code must execute from RAM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is a code snippet I used:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;/*************************************************************************************/&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;static void near LaunchFCCOBCmd(void)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt; DisableInterrupts;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt; FSTAT = 0x80;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt; while ((FSTAT &amp;amp; 0x80) == 0)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt; ;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt; EnableInterrupts;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt; }&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;/*************************************************************************************/&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;static void near LaunchFCCOBCmdEnd(void)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt; }&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;/*************************************************************************************/&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;static ErrorNum GetProgramOnceData(char *ROData)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;{&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;/* Variable Declarations */&lt;/SPAN&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt; uchar StackCode[32];&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt; uint x, CodeLen;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt; uchar *CodeByteP;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt; void (* near LaunchCmd)(void) = (void *)StackCode; /* initialize the function pointer to point to the code we'll copy onto the stack */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;/* Begin Function GetProgramOnceData() */&lt;/SPAN&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt; CodeLen = (uint)((uchar *)LaunchFCCOBCmdEnd - (uchar *)LaunchFCCOBCmd); /* Get the size of the code */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt; CodeByteP = (uchar *)LaunchFCCOBCmd; /* init pointer to the code we'll copy */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;for (x = 0; x &amp;lt; CodeLen; x++) /* copy code onto the stack, one byte at a time */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt; StackCode[x] = *CodeByteP++;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Gordon&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Dec 2016 17:31:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Program-Once-field-in-MC9S12XET256/m-p/647024#M13724</guid>
      <dc:creator>gordondoughman</dc:creator>
      <dc:date>2016-12-29T17:31:58Z</dc:date>
    </item>
    <item>
      <title>Re: Program Once field in [MC9S12XET256]</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Program-Once-field-in-MC9S12XET256/m-p/647025#M13725</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;in the attachment you can find more complex code which checks, reads and writes the field.&lt;/P&gt;&lt;P&gt;Just go to main function and the program flow will lead you.&lt;/P&gt;&lt;P&gt;If you have any doubt just ask.&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>Wed, 04 Jan 2017 14:50:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Program-Once-field-in-MC9S12XET256/m-p/647025#M13725</guid>
      <dc:creator>lama</dc:creator>
      <dc:date>2017-01-04T14:50:31Z</dc:date>
    </item>
    <item>
      <title>Re: Program Once field in [MC9S12XET256]</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Program-Once-field-in-MC9S12XET256/m-p/647026#M13726</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN class="" lang="en"&gt;&lt;SPAN class=""&gt;Thank you for your answer. I will check your code, and in case of problems I write to you. &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jan 2017 08:32:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Program-Once-field-in-MC9S12XET256/m-p/647026#M13726</guid>
      <dc:creator>g_g1</dc:creator>
      <dc:date>2017-01-10T08:32:57Z</dc:date>
    </item>
  </channel>
</rss>

