<?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: Flash memory array integrity check on MPC5746C in MPC5xxx</title>
    <link>https://community.nxp.com/t5/MPC5xxx/Flash-memory-array-integrity-check-on-MPC5746C/m-p/2167536#M28032</link>
    <description>&lt;P&gt;We did not understand how the tool works to calculate the expected Golden signature.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Could you please provide the steps to calculate the expected signature. and How the tool present in the example works?&lt;/P&gt;</description>
    <pubDate>Thu, 11 Sep 2025 07:14:10 GMT</pubDate>
    <dc:creator>VinayYammanuru</dc:creator>
    <dc:date>2025-09-11T07:14:10Z</dc:date>
    <item>
      <title>Flash memory array integrity check on MPC5746C</title>
      <link>https://community.nxp.com/t5/MPC5xxx/Flash-memory-array-integrity-check-on-MPC5746C/m-p/2146090#M27837</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;We are working on checking the flash memory array integrity check on MPC5746C.&lt;BR /&gt;Based on the steps mentioned in the MPC5746C reference manual we have written the function. When execute this function, continuous reset is happening.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="VinayYammanuru_0-1754298537859.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/350790i55187F51388A7F50/image-size/medium?v=v2&amp;amp;px=400" role="button" title="VinayYammanuru_0-1754298537859.png" alt="VinayYammanuru_0-1754298537859.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Besed on the steps, below code is written. And it is giving continuous reset in while loop. But if I keep breakpoints and go step by step it is working.&lt;/P&gt;&lt;P&gt;Could you check once and provide your feedback or solution?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;static void WaitForAIDBitSet(uint32_t timeout)&lt;BR /&gt;{&lt;BR /&gt;volatile int delay;&lt;BR /&gt;for (delay = 0; delay &amp;lt; 1000; delay++) { __asm__ volatile ("nop"); }&lt;BR /&gt;while ((C55FMC.UT0.B.AID == 0) &amp;amp;&amp;amp; (timeout &amp;gt; 0U))&lt;BR /&gt;{&lt;BR /&gt;timeout--;&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;uint8 Flash_Memory_Integrity_Test(void)&lt;BR /&gt;{&lt;BR /&gt;uint32_t misr_result[10];&lt;/P&gt;&lt;P&gt;/* Disable watchdog */&lt;BR /&gt;Wdg_modeSwitchInt(FALSE);&lt;/P&gt;&lt;P&gt;/* Step 1: Enter UTest Mode */&lt;BR /&gt;C55FMC_UT0 = 0xF9F99999;&lt;/P&gt;&lt;P&gt;/* Step 2: ECC Config - Disable ECC error reporting */&lt;BR /&gt;C55FMC.MCR.B.EER = 0; // ECC Event Reporting&lt;BR /&gt;C55FMC.MCR.B.SBC = 0; // Single Bit Correction&lt;/P&gt;&lt;P&gt;/* Step 3: Configure PFLASH read behavior */&lt;BR /&gt;PFLASH.PFCR1.B.RWSC = 0x04; // Wait States&lt;BR /&gt;PFLASH.PFCR1.B.APC = 0x01; // Prefetch Enable&lt;/P&gt;&lt;P&gt;/* Step 4: Select flash blocks to test via SELx */&lt;BR /&gt;C55FMC.SEL0.R = 0x00FF0FFC;&amp;nbsp;&lt;BR /&gt;C55FMC.SEL1.R = 0x00000000;&lt;BR /&gt;C55FMC.SEL2.R = 0x00000000;&lt;BR /&gt;C55FMC.SEL3.R = 0x00000000;&lt;/P&gt;&lt;P&gt;/* Step 5: Use sequential addressing */&lt;BR /&gt;C55FMC.UT0.B.AIS = 1;&lt;/P&gt;&lt;P&gt;/* Step 6: Seed the MISR registers */&lt;BR /&gt;C55FMC_UM0 = MISR_SEED;&lt;BR /&gt;C55FMC_UM1 = MISR_SEED;&lt;BR /&gt;C55FMC_UM2 = MISR_SEED;&lt;BR /&gt;C55FMC_UM3 = MISR_SEED;&lt;BR /&gt;C55FMC_UM4 = MISR_SEED;&lt;BR /&gt;C55FMC_UM5 = MISR_SEED;&lt;BR /&gt;C55FMC_UM6 = MISR_SEED;&lt;BR /&gt;C55FMC_UM7 = MISR_SEED;&lt;BR /&gt;C55FMC_UM8 = MISR_SEED;&lt;BR /&gt;C55FMC_UM9 = MISR_SEED;&lt;/P&gt;&lt;P&gt;/* Step 7: Start Array Integrity Operation */&lt;BR /&gt;C55FMC.UT0.B.AIE = 1;&lt;/P&gt;&lt;P&gt;/* Step 8: Wait for AID = 1 (operation complete) */&lt;BR /&gt;WaitForAIDBitSet(0xFFFFFF); // Add a timeout limit&lt;/P&gt;&lt;P&gt;/* Step 9: Read back MISR values */&lt;BR /&gt;misr_result[0] = C55FMC_UM0;&lt;BR /&gt;misr_result[1] = C55FMC_UM1;&lt;BR /&gt;misr_result[2] = C55FMC_UM2;&lt;BR /&gt;misr_result[3] = C55FMC_UM3;&lt;BR /&gt;misr_result[4] = C55FMC_UM4;&lt;BR /&gt;misr_result[5] = C55FMC_UM5;&lt;BR /&gt;misr_result[6] = C55FMC_UM6;&lt;BR /&gt;misr_result[7] = C55FMC_UM7;&lt;BR /&gt;misr_result[8] = C55FMC_UM8;&lt;BR /&gt;misr_result[9] = C55FMC_UM9;&lt;/P&gt;&lt;P&gt;/* Step 10: Clear AIE */&lt;BR /&gt;C55FMC.UT0.B.AIE = 0;&lt;/P&gt;&lt;P&gt;/* Step 11: Enable watchdog back if needed */&lt;BR /&gt;Wdg_modeSwitchInt(TRUE);&lt;/P&gt;&lt;P&gt;/* Step 12: Compare MISR results */&lt;BR /&gt;if ((misr_result[0] == MISR_UM0) &amp;amp;&amp;amp;&lt;BR /&gt;(misr_result[1] == MISR_UM1) &amp;amp;&amp;amp;&lt;BR /&gt;(misr_result[2] == MISR_UM2) &amp;amp;&amp;amp;&lt;BR /&gt;(misr_result[3] == MISR_UM3) &amp;amp;&amp;amp;&lt;BR /&gt;(misr_result[4] == MISR_UM4) &amp;amp;&amp;amp;&lt;BR /&gt;(misr_result[5] == MISR_UM5) &amp;amp;&amp;amp;&lt;BR /&gt;(misr_result[6] == MISR_UM6) &amp;amp;&amp;amp;&lt;BR /&gt;(misr_result[7] == MISR_UM7) &amp;amp;&amp;amp;&lt;BR /&gt;(misr_result[8] == MISR_UM8) &amp;amp;&amp;amp;&lt;BR /&gt;(misr_result[9] == MISR_UM9))&lt;BR /&gt;{&lt;BR /&gt;return FLS_SAFE_STATE_INACTIVE;&lt;BR /&gt;}&lt;BR /&gt;else&lt;BR /&gt;{&lt;BR /&gt;return FLS_SAFE_STATE_ACTIVE; // Integrity check failed&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Mon, 04 Aug 2025 09:10:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MPC5xxx/Flash-memory-array-integrity-check-on-MPC5746C/m-p/2146090#M27837</guid>
      <dc:creator>VinayYammanuru</dc:creator>
      <dc:date>2025-08-04T09:10:28Z</dc:date>
    </item>
    <item>
      <title>Re: Flash memory array integrity check on MPC5746C</title>
      <link>https://community.nxp.com/t5/MPC5xxx/Flash-memory-array-integrity-check-on-MPC5746C/m-p/2146579#M27838</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;Since reset is not happening when you are in debug mode, I would assume that issue is caused by some timer. Like SWT which is disabled by debuggers.&lt;/P&gt;
&lt;P&gt;You can read reset reason from the RGM [FES/DES] registers.&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;
&lt;P&gt;Peter&lt;/P&gt;</description>
      <pubDate>Tue, 05 Aug 2025 05:42:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MPC5xxx/Flash-memory-array-integrity-check-on-MPC5746C/m-p/2146579#M27838</guid>
      <dc:creator>petervlna</dc:creator>
      <dc:date>2025-08-05T05:42:15Z</dc:date>
    </item>
    <item>
      <title>Re: Flash memory array integrity check on MPC5746C</title>
      <link>https://community.nxp.com/t5/MPC5xxx/Flash-memory-array-integrity-check-on-MPC5746C/m-p/2148939#M27862</link>
      <description>&lt;P&gt;The reset is occurring because of a &lt;STRONG&gt;Machine Check Exception&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;I also have another question - how can we &lt;STRONG&gt;validate the calculated MISR signature value&lt;/STRONG&gt;? In other words, how can we determine whether the signature we’re getting is correct?&lt;BR /&gt;&lt;BR /&gt;Could you please share &lt;STRONG&gt;sample code&lt;/STRONG&gt; that calculates and validates the MISR signature value in order to complete the array integrity checks?&lt;/P&gt;</description>
      <pubDate>Fri, 08 Aug 2025 06:45:27 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MPC5xxx/Flash-memory-array-integrity-check-on-MPC5746C/m-p/2148939#M27862</guid>
      <dc:creator>VinayYammanuru</dc:creator>
      <dc:date>2025-08-08T06:45:27Z</dc:date>
    </item>
    <item>
      <title>Re: Flash memory array integrity check on MPC5746C</title>
      <link>https://community.nxp.com/t5/MPC5xxx/Flash-memory-array-integrity-check-on-MPC5746C/m-p/2149174#M27867</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;I also have another question - how can we &lt;STRONG&gt;validate the calculated MISR signature value&lt;/STRONG&gt;? In other words, how can we determine whether the signature we’re getting is correct?&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;H3&gt;Validation Strategy Overview&lt;/H3&gt;
&lt;OL&gt;
&lt;LI&gt;Calculate the MISR signature&amp;nbsp;for a known memory region (e.g., a test array).&lt;/LI&gt;
&lt;LI&gt;Compare the result&amp;nbsp;against a precomputed reference signature (golden value).&lt;/LI&gt;
&lt;LI&gt;If the values match, the memory content is considered valid.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&lt;BR /&gt;Could you please share &lt;STRONG&gt;sample code&lt;/STRONG&gt; that calculates and validates the MISR signature value in order to complete the array integrity checks?&lt;/P&gt;
&lt;PRE&gt;#include "MPC5746C.h" // Replace with actual header for your environment&lt;BR /&gt;&lt;BR /&gt;#define ARRAY_SIZE 256&lt;BR /&gt;#define CRC_BASE_ADDRESS 0xFF000000 // Replace with actual CRC module base address&lt;BR /&gt;&lt;BR /&gt;uint32_t test_array[ARRAY_SIZE] = { /* Fill with known values */ };&lt;BR /&gt;uint32_t expected_signature = 0x12345678; // Replace with your golden MISR value&lt;BR /&gt;&lt;BR /&gt;void init_crc_module(void) {&lt;BR /&gt;// Enable CRC module clock&lt;BR /&gt;// Configure CRC settings (polynomial, seed, etc.)&lt;BR /&gt;// This is platform-specific and may require register-level access&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;uint32_t calculate_misr_signature(uint32_t *data, uint32_t size) {&lt;BR /&gt;volatile uint32_t *crc_data_reg = (uint32_t *)(CRC_BASE_ADDRESS + 0x04); // Data input register&lt;BR /&gt;volatile uint32_t *crc_result_reg = (uint32_t *)(CRC_BASE_ADDRESS + 0x10); // Result register&lt;BR /&gt;&lt;BR /&gt;for (uint32_t i = 0; i &amp;lt; size; i++) {&lt;BR /&gt;*crc_data_reg = data[i];&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;return *crc_result_reg;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;int main(void) {&lt;BR /&gt;init_crc_module();&lt;BR /&gt;&lt;BR /&gt;uint32_t signature = calculate_misr_signature(test_array, ARRAY_SIZE);&lt;BR /&gt;&lt;BR /&gt;if (signature == expected_signature) {&lt;BR /&gt;// Signature matches&lt;BR /&gt;// Memory integrity is validated&lt;BR /&gt;} else {&lt;BR /&gt;// Signature mismatch&lt;BR /&gt;// Possible memory corruption&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;return 0;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;
&lt;P&gt;You can have a look at this example, it is for same C55 flash module.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.nxp.com/t5/MPC5xxx-Knowledge-Base/Example-MPC5744P-FlashArrayIntegrityCheck-test-SSD-GHS614/ta-p/1099524" target="_blank"&gt;https://community.nxp.com/t5/MPC5xxx-Knowledge-Base/Example-MPC5744P-FlashArrayIntegrityCheck-test-SSD-GHS614/ta-p/1099524&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;
&lt;P&gt;Peter&lt;/P&gt;</description>
      <pubDate>Fri, 08 Aug 2025 11:29:30 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MPC5xxx/Flash-memory-array-integrity-check-on-MPC5746C/m-p/2149174#M27867</guid>
      <dc:creator>petervlna</dc:creator>
      <dc:date>2025-08-08T11:29:30Z</dc:date>
    </item>
    <item>
      <title>Re: Flash memory array integrity check on MPC5746C</title>
      <link>https://community.nxp.com/t5/MPC5xxx/Flash-memory-array-integrity-check-on-MPC5746C/m-p/2167536#M28032</link>
      <description>&lt;P&gt;We did not understand how the tool works to calculate the expected Golden signature.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Could you please provide the steps to calculate the expected signature. and How the tool present in the example works?&lt;/P&gt;</description>
      <pubDate>Thu, 11 Sep 2025 07:14:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MPC5xxx/Flash-memory-array-integrity-check-on-MPC5746C/m-p/2167536#M28032</guid>
      <dc:creator>VinayYammanuru</dc:creator>
      <dc:date>2025-09-11T07:14:10Z</dc:date>
    </item>
    <item>
      <title>Re: Flash memory array integrity check on MPC5746C</title>
      <link>https://community.nxp.com/t5/MPC5xxx/Flash-memory-array-integrity-check-on-MPC5746C/m-p/2168668#M28035</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;The function compares the actual MISR values of the flash blocks with the expected values from output.txt.&lt;/P&gt;
&lt;P&gt;To setup a MISR tool you can refer to detailed readme.txt and folder start address examples.&lt;/P&gt;
&lt;P&gt;Attached is the complete tool, as it seems that some doc/example files are missing from the one in web example.&lt;/P&gt;
&lt;P&gt;Hope this will clear all doubts.&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;
&lt;P&gt;Peter&lt;/P&gt;</description>
      <pubDate>Fri, 12 Sep 2025 06:45:04 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MPC5xxx/Flash-memory-array-integrity-check-on-MPC5746C/m-p/2168668#M28035</guid>
      <dc:creator>petervlna</dc:creator>
      <dc:date>2025-09-12T06:45:04Z</dc:date>
    </item>
  </channel>
</rss>

