<?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: Issue while calculating the CRC for logical address block in Flash</title>
    <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Issue-while-calculating-the-CRC-for-logical-address-block-in/m-p/240195#M9537</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You have to use far pointers.&lt;/P&gt;&lt;P&gt;In attachment you can find simple example code for CRC calculation.&lt;/P&gt;&lt;P&gt;Note: I created this example code for S12G. In case of S12XS we can use global addresses (default for far pointers in case of S12X) and calculate checksum in one loop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note: More details about checksum calculation and automatic checksum calculation by CW you can find in example codes on your disk. Example path is:&lt;/P&gt;&lt;P&gt;"C:\Program Files\Freescale\CWS12v5.1\(CodeWarrior_Examples)\HC12\Checksums\2. Single App"&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>Wed, 26 Jun 2013 15:04:24 GMT</pubDate>
    <dc:creator>RadekS</dc:creator>
    <dc:date>2013-06-26T15:04:24Z</dc:date>
    <item>
      <title>Issue while calculating the CRC for logical address block in Flash</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Issue-while-calculating-the-CRC-for-logical-address-block-in/m-p/240194#M9536</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 came accross with an issue , while i am calculating the CRC for particular location in Flash memory.&lt;/P&gt;&lt;P&gt;In File1.c(for reference), i am passing start and end address of the block to fucntion where calculating the CRC.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="color: #ff0000;"&gt;But, while Debuging&amp;nbsp; i noticed that, CRC calculating for 8000 to FFFF instead of 7EC000 to 7EFFFF&lt;/SPAN&gt;.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff0000;"&gt;&lt;STRONG&gt; and while returning the value it's returning 2 byte value instead of 4 byte value.&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff0000;"&gt;&lt;STRONG&gt;but variable crc holding the 4 bytes values&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;IDE: CW&lt;/P&gt;&lt;P&gt;Microcontroller: MC9S12XS128&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;file1.c&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;#define BLOCK1START&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0xFB8000&lt;/P&gt;&lt;P&gt;#define BLOCK1END&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0xFBBFFF&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;crcBoot[0]= _Checksum_CheckAreaCRC32_PreCalc(BLOCK1START,((BLOCK1END+0x1)-BLOCK1START));&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;file2.c&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;_CheckSum4ByteType _Checksum_CheckAreaCRC32_PreCalc(_CHECKSUM_ConstMemBytePtr start, unsigned int len) {&lt;/P&gt;&lt;P&gt;&amp;nbsp; const _CheckSum1ByteType*_CHECKSUM_QUALI ptr= (const _CheckSum1ByteType* _CHECKSUM_QUALI)start;&lt;/P&gt;&lt;P&gt;&amp;nbsp; _CheckSum4ByteType crc = 0xFFFFFFFF;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; const _CheckSum1ByteType* _CHECKSUM_QUALI endPtr= ptr + len;&lt;/P&gt;&lt;P&gt;&amp;nbsp; while (ptr != endPtr) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; crc= CheckSumByteCRC32_PreCalc(crc, *ptr);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //__FEED_COP;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* COP enabled? If so, feed it */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; PTM=PTM^0x04;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* toggle self reset */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ptr++;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;return (&lt;SPAN style="color: #ff0000;"&gt;crc&lt;/SPAN&gt;);&lt;/STRONG&gt; /*== check-&amp;gt;checkSumCRC32 *&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;please help me on above issue, how to pass address properly and how to return values correctly without losing 2 bytes value...&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks in advance&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Jun 2013 12:43:59 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Issue-while-calculating-the-CRC-for-logical-address-block-in/m-p/240194#M9536</guid>
      <dc:creator>sudheerrajulapu</dc:creator>
      <dc:date>2013-06-26T12:43:59Z</dc:date>
    </item>
    <item>
      <title>Re: Issue while calculating the CRC for logical address block in Flash</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Issue-while-calculating-the-CRC-for-logical-address-block-in/m-p/240195#M9537</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You have to use far pointers.&lt;/P&gt;&lt;P&gt;In attachment you can find simple example code for CRC calculation.&lt;/P&gt;&lt;P&gt;Note: I created this example code for S12G. In case of S12XS we can use global addresses (default for far pointers in case of S12X) and calculate checksum in one loop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note: More details about checksum calculation and automatic checksum calculation by CW you can find in example codes on your disk. Example path is:&lt;/P&gt;&lt;P&gt;"C:\Program Files\Freescale\CWS12v5.1\(CodeWarrior_Examples)\HC12\Checksums\2. Single App"&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>Wed, 26 Jun 2013 15:04:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Issue-while-calculating-the-CRC-for-logical-address-block-in/m-p/240195#M9537</guid>
      <dc:creator>RadekS</dc:creator>
      <dc:date>2013-06-26T15:04:24Z</dc:date>
    </item>
  </channel>
</rss>

