<?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 S12G128 Write to EEPROM in S12 / MagniV Microcontrollers</title>
    <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/S12G128-Write-to-EEPROM/m-p/708586#M14680</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, I want to write to EEPROM in S12G128.&lt;/P&gt;&lt;P&gt;But my CW(Code Warrior) show me the error message (Label 'Send_Command Undefined).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is my code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;byte EEPROM_Program(word address, word *ptr, byte number_of_words) &lt;BR /&gt;{&lt;BR /&gt;word i;&lt;BR /&gt; &lt;BR /&gt;if((number_of_words &amp;lt; 1) || (number_of_words &amp;gt; 4))&lt;BR /&gt;return LENGTH_OUT_OF_RANGE;&lt;BR /&gt; &lt;BR /&gt;// check if address is aligned (global address [0] != 0)&lt;BR /&gt;if((address &amp;amp; 0x0001) != 0)&lt;BR /&gt;return MISALIGEND_ADDRESS;&lt;BR /&gt; &lt;BR /&gt;// check if the word(s) is/are erased&lt;BR /&gt;if((EEPROM_Erase_Verify_Section(address, number_of_words)) == NON_ERASED)&lt;BR /&gt;return NON_ERASED;&lt;BR /&gt; &lt;BR /&gt;while(FSTAT_CCIF == 0);&lt;BR /&gt;FSTAT = 0x30;&lt;BR /&gt; &lt;BR /&gt;FCCOBIX = 0x00;&lt;BR /&gt;FCCOB = 0x1100;&lt;BR /&gt; &lt;BR /&gt;FCCOBIX = 0x01;&lt;BR /&gt;FCCOB = address;&lt;BR /&gt; &lt;BR /&gt;for(i=1; i&amp;lt;=number_of_words; i++) &lt;BR /&gt;{&lt;BR /&gt;FCCOBIX = i+1;&lt;BR /&gt;FCCOB = *ptr;&lt;BR /&gt;ptr++;&lt;BR /&gt;}&lt;BR /&gt; &lt;BR /&gt;asm JSR Send_Command;&lt;BR /&gt; &lt;BR /&gt;if((FSTAT &amp;amp; (FSTAT_ACCERR_MASK | FSTAT_FPVIOL_MASK)) != 0) return ACCESS_ERROR;&lt;BR /&gt;if(FSTAT_MGSTAT != 0) return VERIFICATION_FAILED;&lt;BR /&gt; &lt;BR /&gt;return OK;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What am I forgot something?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 18 Oct 2017 04:32:19 GMT</pubDate>
    <dc:creator>kimkang-mok</dc:creator>
    <dc:date>2017-10-18T04:32:19Z</dc:date>
    <item>
      <title>S12G128 Write to EEPROM</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/S12G128-Write-to-EEPROM/m-p/708586#M14680</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, I want to write to EEPROM in S12G128.&lt;/P&gt;&lt;P&gt;But my CW(Code Warrior) show me the error message (Label 'Send_Command Undefined).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is my code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;byte EEPROM_Program(word address, word *ptr, byte number_of_words) &lt;BR /&gt;{&lt;BR /&gt;word i;&lt;BR /&gt; &lt;BR /&gt;if((number_of_words &amp;lt; 1) || (number_of_words &amp;gt; 4))&lt;BR /&gt;return LENGTH_OUT_OF_RANGE;&lt;BR /&gt; &lt;BR /&gt;// check if address is aligned (global address [0] != 0)&lt;BR /&gt;if((address &amp;amp; 0x0001) != 0)&lt;BR /&gt;return MISALIGEND_ADDRESS;&lt;BR /&gt; &lt;BR /&gt;// check if the word(s) is/are erased&lt;BR /&gt;if((EEPROM_Erase_Verify_Section(address, number_of_words)) == NON_ERASED)&lt;BR /&gt;return NON_ERASED;&lt;BR /&gt; &lt;BR /&gt;while(FSTAT_CCIF == 0);&lt;BR /&gt;FSTAT = 0x30;&lt;BR /&gt; &lt;BR /&gt;FCCOBIX = 0x00;&lt;BR /&gt;FCCOB = 0x1100;&lt;BR /&gt; &lt;BR /&gt;FCCOBIX = 0x01;&lt;BR /&gt;FCCOB = address;&lt;BR /&gt; &lt;BR /&gt;for(i=1; i&amp;lt;=number_of_words; i++) &lt;BR /&gt;{&lt;BR /&gt;FCCOBIX = i+1;&lt;BR /&gt;FCCOB = *ptr;&lt;BR /&gt;ptr++;&lt;BR /&gt;}&lt;BR /&gt; &lt;BR /&gt;asm JSR Send_Command;&lt;BR /&gt; &lt;BR /&gt;if((FSTAT &amp;amp; (FSTAT_ACCERR_MASK | FSTAT_FPVIOL_MASK)) != 0) return ACCESS_ERROR;&lt;BR /&gt;if(FSTAT_MGSTAT != 0) return VERIFICATION_FAILED;&lt;BR /&gt; &lt;BR /&gt;return OK;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What am I forgot something?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Oct 2017 04:32:19 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/S12G128-Write-to-EEPROM/m-p/708586#M14680</guid>
      <dc:creator>kimkang-mok</dc:creator>
      <dc:date>2017-10-18T04:32:19Z</dc:date>
    </item>
    <item>
      <title>Re: S12G128 Write to EEPROM</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/S12G128-Write-to-EEPROM/m-p/708587#M14681</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I think your code is missing the routine you are trying to call by command. The code looks like code taken from some example provided by us (NXP technical support).&lt;/P&gt;&lt;P&gt;asm JSR Send_Command&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The routine is an array of ASM commands (placed in the RAM) which must be executed out of the memory which is currently E/W. In order to avoid accidental access if the routine is place either in EEPROM or Flash EEPROM it is placed inside the RAM.&lt;/P&gt;&lt;P&gt;It, of course, must be defined somewhere:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//******************************************************************************&lt;BR /&gt;//EEPROM Send_Command&lt;BR /&gt;//******************************************************************************&lt;BR /&gt;//this function is stored in RAM memory&lt;BR /&gt;//in C language:&lt;BR /&gt;//&amp;nbsp; {&lt;BR /&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp; FSTAT_CCIF = 1;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //launch command&lt;BR /&gt;//&amp;nbsp;&amp;nbsp;&amp;nbsp; while(FSTAT_CCIF == 0); //wait for done&lt;BR /&gt;//&amp;nbsp; }&lt;BR /&gt;static byte Send_Command[]=&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp; 0x1C, 0x01, 0x06, 0x80, 0x1F, 0x01, 0x06, 0x80, 0xFB, 0x3D&lt;BR /&gt;};&lt;BR /&gt;//******************************************************************************&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>Wed, 18 Oct 2017 07:49:07 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/S12G128-Write-to-EEPROM/m-p/708587#M14681</guid>
      <dc:creator>lama</dc:creator>
      <dc:date>2017-10-18T07:49:07Z</dc:date>
    </item>
    <item>
      <title>Re: S12G128 Write to EEPROM</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/S12G128-Write-to-EEPROM/m-p/708588#M14682</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN&gt;Thanks. I solved this problem to your answer.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Oct 2017 03:34:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/S12G128-Write-to-EEPROM/m-p/708588#M14682</guid>
      <dc:creator>kimkang-mok</dc:creator>
      <dc:date>2017-10-19T03:34:35Z</dc:date>
    </item>
  </channel>
</rss>

