<?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 Why the FLASH_VerifyProgram does not report a failed address and data? in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/Why-the-FLASH-VerifyProgram-does-not-report-a-failed-address-and/m-p/1839385#M55804</link>
    <description>&lt;P&gt;Hello to the community!&lt;/P&gt;&lt;P&gt;A little question/report about behavior of the flash memory API embedded into the LPC5528 MCU.&lt;/P&gt;&lt;P class="lia-align-left"&gt;I'm currently debugging some flash-related issue and while doing that noted, that the "&lt;EM&gt;FLASH_VerifyProgram&lt;/EM&gt;" does not actually report neither address nor data when it meets&amp;nbsp; a discrepancy. The code snippet is the following:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;uint8_t buffer[512];

void flashTest(void) {
  uint32_t failedAddress = 0x01234567;
  uint32_t failedData = 0x89ABCDEF;

  FLASH_Init(&amp;amp;flashConfig);

  for (size_t byte = 0; byte &amp;lt; sizeof checkBuffer; ++byte) {
    buffer[byte] = byte;
  }

  for (uint8_t lap = 0; lap &amp;lt; 10; ++lap) {
    FLASH_Erase(&amp;amp;flashConfig, 0x0007B600, 0x4A00, kFLASH_ApiEraseKey);
    FLASH_Program(&amp;amp;flashConfig, 0x0007B600, buffer, sizeof buffer);

    if (lap == 9) {
      buffer[0] += 1;
    }

    if (FLASH_VerifyProgram(&amp;amp;flashConfig, 0x0007B600, 
                            sizeof buffer, buffer, 
                            &amp;amp;failedAddress, &amp;amp;failedData)) {
      ;
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As you can see, I perform a series of the erase-program operation and alter a single byte at the very end to trigger the verification error.&lt;/P&gt;&lt;P&gt;And the "&lt;EM&gt;FLASH_VerifyProgram&lt;/EM&gt;"&amp;nbsp;indeed reports an error, but both "&lt;EM&gt;failedAddress&lt;/EM&gt;" and "&lt;EM&gt;failedData&lt;/EM&gt;" variables remain unchanged.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is it a bug or I don't understand something?&lt;/P&gt;&lt;P&gt;Best regards!&lt;/P&gt;</description>
    <pubDate>Tue, 02 Apr 2024 13:15:58 GMT</pubDate>
    <dc:creator>GlebPlekhotko</dc:creator>
    <dc:date>2024-04-02T13:15:58Z</dc:date>
    <item>
      <title>Why the FLASH_VerifyProgram does not report a failed address and data?</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Why-the-FLASH-VerifyProgram-does-not-report-a-failed-address-and/m-p/1839385#M55804</link>
      <description>&lt;P&gt;Hello to the community!&lt;/P&gt;&lt;P&gt;A little question/report about behavior of the flash memory API embedded into the LPC5528 MCU.&lt;/P&gt;&lt;P class="lia-align-left"&gt;I'm currently debugging some flash-related issue and while doing that noted, that the "&lt;EM&gt;FLASH_VerifyProgram&lt;/EM&gt;" does not actually report neither address nor data when it meets&amp;nbsp; a discrepancy. The code snippet is the following:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;uint8_t buffer[512];

void flashTest(void) {
  uint32_t failedAddress = 0x01234567;
  uint32_t failedData = 0x89ABCDEF;

  FLASH_Init(&amp;amp;flashConfig);

  for (size_t byte = 0; byte &amp;lt; sizeof checkBuffer; ++byte) {
    buffer[byte] = byte;
  }

  for (uint8_t lap = 0; lap &amp;lt; 10; ++lap) {
    FLASH_Erase(&amp;amp;flashConfig, 0x0007B600, 0x4A00, kFLASH_ApiEraseKey);
    FLASH_Program(&amp;amp;flashConfig, 0x0007B600, buffer, sizeof buffer);

    if (lap == 9) {
      buffer[0] += 1;
    }

    if (FLASH_VerifyProgram(&amp;amp;flashConfig, 0x0007B600, 
                            sizeof buffer, buffer, 
                            &amp;amp;failedAddress, &amp;amp;failedData)) {
      ;
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As you can see, I perform a series of the erase-program operation and alter a single byte at the very end to trigger the verification error.&lt;/P&gt;&lt;P&gt;And the "&lt;EM&gt;FLASH_VerifyProgram&lt;/EM&gt;"&amp;nbsp;indeed reports an error, but both "&lt;EM&gt;failedAddress&lt;/EM&gt;" and "&lt;EM&gt;failedData&lt;/EM&gt;" variables remain unchanged.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is it a bug or I don't understand something?&lt;/P&gt;&lt;P&gt;Best regards!&lt;/P&gt;</description>
      <pubDate>Tue, 02 Apr 2024 13:15:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Why-the-FLASH-VerifyProgram-does-not-report-a-failed-address-and/m-p/1839385#M55804</guid>
      <dc:creator>GlebPlekhotko</dc:creator>
      <dc:date>2024-04-02T13:15:58Z</dc:date>
    </item>
    <item>
      <title>Re: Why the FLASH_VerifyProgram does not report a failed address and data?</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Why-the-FLASH-VerifyProgram-does-not-report-a-failed-address-and/m-p/1844682#M55841</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/221417"&gt;@GlebPlekhotko&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sorry for the inconvenient to you. And thanks for your report.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have taken ticket to our internal team.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;Alice&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2024 02:40:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Why-the-FLASH-VerifyProgram-does-not-report-a-failed-address-and/m-p/1844682#M55841</guid>
      <dc:creator>Alice_Yang</dc:creator>
      <dc:date>2024-04-11T02:40:09Z</dc:date>
    </item>
  </channel>
</rss>

