<?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: Checksum Method for MC9S12ZVCA(192)</title>
    <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Checksum-Method-for-MC9S12ZVCA-192/m-p/1038915#M17115</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;UL&gt;&lt;LI&gt;2. some times it is not correct, seems one byte can not read out from flash, so the result is not correct(during debug, Still not find the root cause)&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Do you calculate your sum from application image? Perhaps you didn't take into account security byte, which may be changed by your flash programmer? If you indeed take this into account, perhaps you should be aware about S12(X) vs S12Z difference. On older S12(X) after mass erase and unsecure&amp;nbsp;flash state&amp;nbsp;was all ones, even for security byte. Later, software like P&amp;amp;E Unsecure could program security byte to 0xFE (security off) to ease your debugging. On S12Z after unsecure command flash security byte is already 0xFE. It is provided by S12Z itself, not by software running on PC. Anyway I think you should remove security byte from your checksum check area.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;1. It cost a lot of time, more than 20ms. We want it can decrease&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;How many ms is acceptable? Do you want fast startup to functional state? What about fast startup as usual and checksum check in background? This would allow you to use slower but proper CRC, not just semi-working sum check.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;192/4 = 48kDwords&amp;nbsp;in 20ms&amp;nbsp;at 32MHz&amp;nbsp; is ~13 bus cycles for one dword. Optimized loop code should look like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;L1:&amp;nbsp; add&amp;nbsp; D6, (X+)&lt;/P&gt;&lt;P&gt;&amp;nbsp; cmp&amp;nbsp; X, #top_of_flash&lt;/P&gt;&lt;P&gt;&amp;nbsp; blo&amp;nbsp;&amp;nbsp;&amp;nbsp; L1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This should take&amp;nbsp;about 5 bus cycles for single Dword and thus still about 8ms for whole flash array. Reducing loop overhead and adding several Dwords per iteration will reduce effective cycles per dword to 3+, still about 5ms for whole array,&amp;nbsp;if not more.&lt;/P&gt;&lt;P&gt;L1:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;add&amp;nbsp; D6, (X+)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;add&amp;nbsp; D6, (X+)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;add&amp;nbsp; D6, (X+)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;add&amp;nbsp; D6, (X+)&lt;/P&gt;&lt;P&gt;&amp;nbsp; cmp&amp;nbsp; X, #top_of_flash&lt;/P&gt;&lt;P&gt;&amp;nbsp; blo&amp;nbsp;&amp;nbsp;&amp;nbsp; L1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edward&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 16 Apr 2020 08:50:14 GMT</pubDate>
    <dc:creator>kef2</dc:creator>
    <dc:date>2020-04-16T08:50:14Z</dc:date>
    <item>
      <title>Checksum Method for MC9S12ZVCA(192)</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Checksum-Method-for-MC9S12ZVCA-192/m-p/1038914#M17114</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;During my developing I need to calculate checksum of flash for an fixed area.&amp;nbsp; I use the method below to get every 4bytes from flash directly and sum them.&lt;/P&gt;&lt;P&gt;getFlash.twobytes = * ( (bl_u32_t *) ( (bl_u32_t)pu32FloatingPointer + (u32LocalIndex&amp;lt;&amp;lt;2)) )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I find two issues:&lt;/P&gt;&lt;P&gt;1. It cost a lot of time, more than 20ms. We want it can decrease&lt;/P&gt;&lt;P&gt;2. some times it is not correct, seems one byte can not read out from flash, so the result is not correct(during debug, Still not find the root cause)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you please help if we can use some other method to get the target. Calculate checksum or CRC and compare with the result(we saved in a place before).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you very much.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Apr 2020 00:36:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Checksum-Method-for-MC9S12ZVCA-192/m-p/1038914#M17114</guid>
      <dc:creator>charles_wangw</dc:creator>
      <dc:date>2020-04-16T00:36:51Z</dc:date>
    </item>
    <item>
      <title>Re: Checksum Method for MC9S12ZVCA(192)</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Checksum-Method-for-MC9S12ZVCA-192/m-p/1038915#M17115</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;UL&gt;&lt;LI&gt;2. some times it is not correct, seems one byte can not read out from flash, so the result is not correct(during debug, Still not find the root cause)&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Do you calculate your sum from application image? Perhaps you didn't take into account security byte, which may be changed by your flash programmer? If you indeed take this into account, perhaps you should be aware about S12(X) vs S12Z difference. On older S12(X) after mass erase and unsecure&amp;nbsp;flash state&amp;nbsp;was all ones, even for security byte. Later, software like P&amp;amp;E Unsecure could program security byte to 0xFE (security off) to ease your debugging. On S12Z after unsecure command flash security byte is already 0xFE. It is provided by S12Z itself, not by software running on PC. Anyway I think you should remove security byte from your checksum check area.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;1. It cost a lot of time, more than 20ms. We want it can decrease&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;How many ms is acceptable? Do you want fast startup to functional state? What about fast startup as usual and checksum check in background? This would allow you to use slower but proper CRC, not just semi-working sum check.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;192/4 = 48kDwords&amp;nbsp;in 20ms&amp;nbsp;at 32MHz&amp;nbsp; is ~13 bus cycles for one dword. Optimized loop code should look like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;L1:&amp;nbsp; add&amp;nbsp; D6, (X+)&lt;/P&gt;&lt;P&gt;&amp;nbsp; cmp&amp;nbsp; X, #top_of_flash&lt;/P&gt;&lt;P&gt;&amp;nbsp; blo&amp;nbsp;&amp;nbsp;&amp;nbsp; L1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This should take&amp;nbsp;about 5 bus cycles for single Dword and thus still about 8ms for whole flash array. Reducing loop overhead and adding several Dwords per iteration will reduce effective cycles per dword to 3+, still about 5ms for whole array,&amp;nbsp;if not more.&lt;/P&gt;&lt;P&gt;L1:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;add&amp;nbsp; D6, (X+)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;add&amp;nbsp; D6, (X+)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;add&amp;nbsp; D6, (X+)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;add&amp;nbsp; D6, (X+)&lt;/P&gt;&lt;P&gt;&amp;nbsp; cmp&amp;nbsp; X, #top_of_flash&lt;/P&gt;&lt;P&gt;&amp;nbsp; blo&amp;nbsp;&amp;nbsp;&amp;nbsp; L1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edward&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Apr 2020 08:50:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Checksum-Method-for-MC9S12ZVCA-192/m-p/1038915#M17115</guid>
      <dc:creator>kef2</dc:creator>
      <dc:date>2020-04-16T08:50:14Z</dc:date>
    </item>
    <item>
      <title>Re: Checksum Method for MC9S12ZVCA(192)</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Checksum-Method-for-MC9S12ZVCA-192/m-p/1038916#M17116</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Edward&lt;/P&gt;&lt;P&gt;Thank you for your share. Actually I have implement the method CRC32 with EDMA on&amp;nbsp;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;S32K144 with NXP support.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.nxp.com/thread/508251"&gt;Pflash completeness check&lt;/A&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But there is no CRC32 module and EDMA in MC9S12ZVCA. So I am testing checksum now.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I calculate two areas :&lt;/P&gt;&lt;P&gt;Area1:&lt;/P&gt;&lt;P&gt;#define PP4G_APPLICATION_ADDRESS_START (0x00FD0408u)&lt;BR /&gt;#define PP4G_APPLICATION_ADDRESS_END (0x00FF6DDFu)&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Area2:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;#define PP4G_CALIBRATION_ADDRESS_START (0x00FF7000u)&lt;BR /&gt;#define PP4G_CALIBRATION_ADDRESS_END (0x00FF77DFu)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_2.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/108179i1E90985D025AB6B7/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_2.png" alt="pastedImage_2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It seems I need 75ms for this part calculate. I will update the clock setting today as your suggestion.&lt;/P&gt;&lt;P&gt;By the way, should my method is the same as your Assembly language? C is convenient for my code in this status.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Charles&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Apr 2020 04:30:54 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Checksum-Method-for-MC9S12ZVCA-192/m-p/1038916#M17116</guid>
      <dc:creator>charles_wangw</dc:creator>
      <dc:date>2020-04-17T04:30:54Z</dc:date>
    </item>
    <item>
      <title>Re: Checksum Method for MC9S12ZVCA(192)</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Checksum-Method-for-MC9S12ZVCA-192/m-p/1038917#M17117</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Charles,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ghm, didn't older CW for MCUs have option to erase/program only used flash/eeprom areas? I&amp;nbsp;remember I had to use something like it in CW debugger settings to recover from S12Z machine exception on EEPROM ECC fault. I can't find such options in CW for MCUs 11.1. But if you had it enabled, it could lead as well to&amp;nbsp;problems verifying checksum.&amp;nbsp;You calculate checksum assuming all unused&amp;nbsp;bytes are 0xFF, than&amp;nbsp;if&amp;nbsp;program gets shorter so that not all previously used sectors are erased.. checksum check will fail.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My asm pseudocode uses 32 bits checksum, easy to adapt to 16 bits, bit longer though.&lt;/P&gt;&lt;P&gt;Yes, C is always convenient and often as effective as assembler, provided your algorithm is effective and CPU friendly, as well C code should give optimizer close&amp;nbsp;or even better nothing do do.&lt;/P&gt;&lt;P&gt;First line of your loop body 1) shifts index left, 2) adds result to pointer, then 3) dereferences pointer and 4) stores flash dword to some file or global scope variable. Then there are 4,5) two adds. Global scope variable&amp;nbsp;reduces optimizers freedom to optimize that store out as not needed and reuse values in CPU registers instead. Local variable on stack should be better, I think. Then for loop 6) increments&amp;nbsp; index, 7) compares to the limit and 8) branches to the start of loop body. Optimizer may group and eliminate some of these steps, but not all. My code 1) dereferences pointer, reads and adds data to the checksum&amp;nbsp;and advances pointer to the next location in one step, for 16 bits checksum it would be identical step 2).&amp;nbsp;&amp;nbsp;3) compare pointer to the limit, 3) branch to start. Quite faster, isn't it?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's routine for you to calculate 16 bits sum:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #7f0055; font-size: small; "&gt;&lt;STRONG&gt;__asm&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: small;"&gt; &lt;/SPAN&gt;&lt;STRONG style=": ; color: #7f0055; font-size: small; "&gt;unsigned&lt;/STRONG&gt;&lt;SPAN style="font-size: small;"&gt; &lt;/SPAN&gt;&lt;STRONG style=": ; color: #7f0055; font-size: small; "&gt;short&lt;/STRONG&gt;&lt;SPAN style="font-size: small;"&gt; &lt;STRONG&gt;cksum&lt;/STRONG&gt;(&lt;/SPAN&gt;&lt;STRONG style=": ; color: #7f0055; font-size: small; "&gt;unsigned&lt;/STRONG&gt;&lt;SPAN style="font-size: small;"&gt; &lt;/SPAN&gt;&lt;STRONG style=": ; color: #7f0055; font-size: small; "&gt;long&lt;/STRONG&gt;&lt;SPAN style="font-size: small;"&gt; start, &lt;/SPAN&gt;&lt;STRONG style=": ; color: #7f0055; font-size: small; "&gt;unsigned&lt;/STRONG&gt;&lt;SPAN style="font-size: small;"&gt; &lt;/SPAN&gt;&lt;STRONG style=": ; color: #7f0055; font-size: small; "&gt;long&lt;/STRONG&gt;&lt;SPAN style="font-size: small;"&gt; top)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: small;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #3f7f5f; font-size: small; "&gt;// load start to X pointer register&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: small;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #3f7f5f; font-size: small; "&gt;// first 32bits argument is passed in D6&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;TFR D6, X&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: small;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #3f7f5f; font-size: small; "&gt;// load Y with end address&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: small;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #3f7f5f; font-size: small; "&gt;// top is assumed to be word aligned, &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: small;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #3f7f5f; font-size: small; "&gt;// start-top 0x100..0x110 will return&amp;nbsp;identical result for 0x100..0x10F &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: small;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #3f7f5f; font-size: small; "&gt;// +1 because Y is 24 bits pointer, not 32 like top&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;LD Y, top+1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: small;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;CLR D2 &lt;/SPAN&gt;&lt;SPAN style="color: #3f7f5f; font-size: small; "&gt;// &lt;SPAN style="text-decoration: underline;"&gt;initialize&lt;/SPAN&gt; 16 bits checksum = 0&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: small;"&gt;L1: ADD D2, (X+) &lt;/SPAN&gt;&lt;SPAN style="color: #3f7f5f; font-size: small; "&gt;// add and advance pointer&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// ... ADD D2, (X+)&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: small;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;CMP X,Y &lt;/SPAN&gt;&lt;SPAN style="color: #3f7f5f; font-size: small; "&gt;// compare with top&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: small;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;BLO L1 &lt;/SPAN&gt;&lt;SPAN style="color: #3f7f5f; font-size: small; "&gt;// keep looping while X &amp;lt; Y&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3f7f5f; font-size: small; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// return value is in D2 already&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You may try as well uncomment second ADD provided start and top differ by multiple of&amp;nbsp;4. You may also replace two ADD's with 32 bits fetch, shift and adds to check if 32 bits access is faster. Try replacing code down from L1&amp;nbsp;with this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;L1:&amp;nbsp;&amp;nbsp;&amp;nbsp;LD&amp;nbsp;&amp;nbsp;&amp;nbsp;D6, (X+)&amp;nbsp;&amp;nbsp;&amp;nbsp;// 32 bits fetch&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ADD&amp;nbsp;&amp;nbsp;&amp;nbsp;D2, D6&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// add lo word&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;LSR&amp;nbsp;&amp;nbsp;&amp;nbsp;D6, D6, #16&amp;nbsp; // get high word&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ADD&amp;nbsp;&amp;nbsp;&amp;nbsp;D2, D6&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// add hi word&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;CMP X,Y &lt;/SPAN&gt;&lt;SPAN style="color: #3f7f5f; font-size: small; "&gt;// compare with top&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;BLO L1 &lt;/SPAN&gt;&lt;SPAN style="color: #3f7f5f; font-size: small; "&gt;// keep looping while X &amp;lt; Y&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3f7f5f; font-size: small; "&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// return value is in D2 already&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3f7f5f; font-size: small; "&gt;Edward&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Apr 2020 10:20:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Checksum-Method-for-MC9S12ZVCA-192/m-p/1038917#M17117</guid>
      <dc:creator>kef2</dc:creator>
      <dc:date>2020-04-17T10:20:29Z</dc:date>
    </item>
    <item>
      <title>Re: Checksum Method for MC9S12ZVCA(192)</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Checksum-Method-for-MC9S12ZVCA-192/m-p/1038918#M17118</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I want to correct myself about execution times. First of all I missed that when branch is taken, which happens every time our loop continues, instruction queue refill takes place and eats additional 1-2 bus cycles. 1 is in the case L1 labels address is dword aligned, 2 in all other 3 cases. Another missed fact is default flash wait states setting. It is enabled by default and told to be 1 additional cycle. But wait states off vs wait states seems adding 1.5 bus cycles&amp;nbsp;to single loop&amp;nbsp;iteration with 32 bits&amp;nbsp;fetch. &lt;/P&gt;&lt;P&gt;Real benchmarking.&amp;nbsp;With L1 dword aligned and wait states switched off 32 bit fetch + add + shift + add takes 10 bus cycles per loop iteration (sindle dword). Wait state enabled +1 bus cycle, L1 misaligned +1 bus cycle.&lt;/P&gt;&lt;P&gt;Two 16 bit adds variant, L1 aligned, no wait states - 9.5 bus cycles. Wait states enabled - 11 bus cycles. I wonder why +1.5 bus cycles instead of +2. L1 misalignment should add one more bus cycle. So the best you can get is 11*192/4*1024 / 32M ~ 17ms.&amp;nbsp;Wait states should be enabled above 25MHz, so practically no difference 32MHz with wait states or 25MHz without them.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edward&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Apr 2020 13:40:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Checksum-Method-for-MC9S12ZVCA-192/m-p/1038918#M17118</guid>
      <dc:creator>kef2</dc:creator>
      <dc:date>2020-04-17T13:40:39Z</dc:date>
    </item>
    <item>
      <title>Re: Checksum Method for MC9S12ZVCA(192)</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Checksum-Method-for-MC9S12ZVCA-192/m-p/1038919#M17119</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Edward&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your detail information. I have no time test today and will try tomorrow. Sorry I still need ask two more details below to help my quick test.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. How to config my MCU to 25Mhz with internal&amp;nbsp;&lt;SPAN style="font-size: 11.0pt;"&gt;oscillator&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt;"&gt;2. How to config to disable Watch Dog?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt;"&gt;Thank you again.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.0pt;"&gt;Charles&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Apr 2020 12:10:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Checksum-Method-for-MC9S12ZVCA-192/m-p/1038919#M17119</guid>
      <dc:creator>charles_wangw</dc:creator>
      <dc:date>2020-04-20T12:10:06Z</dc:date>
    </item>
    <item>
      <title>Re: Checksum Method for MC9S12ZVCA(192)</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Checksum-Method-for-MC9S12ZVCA-192/m-p/1038920#M17120</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Charles,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Well, if it's too hard for you to configure PLL, then perhaps try using CW Processor Expert to configure PLL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. COP watchdog is disabled by default. See CPMUCOP register.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edward&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Apr 2020 13:31:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Checksum-Method-for-MC9S12ZVCA-192/m-p/1038920#M17120</guid>
      <dc:creator>kef2</dc:creator>
      <dc:date>2020-04-20T13:31:24Z</dc:date>
    </item>
  </channel>
</rss>

