Why the FLASH_VerifyProgram does not report a failed address and data?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Why the FLASH_VerifyProgram does not report a failed address and data?

166 Views
GlebPlekhotko
Contributor II

Hello to the community!

A little question/report about behavior of the flash memory API embedded into the LPC5528 MCU.

I'm currently debugging some flash-related issue and while doing that noted, that the "FLASH_VerifyProgram" does not actually report neither address nor data when it meets  a discrepancy. The code snippet is the following:

uint8_t buffer[512];

void flashTest(void) {
  uint32_t failedAddress = 0x01234567;
  uint32_t failedData = 0x89ABCDEF;

  FLASH_Init(&flashConfig);

  for (size_t byte = 0; byte < sizeof checkBuffer; ++byte) {
    buffer[byte] = byte;
  }

  for (uint8_t lap = 0; lap < 10; ++lap) {
    FLASH_Erase(&flashConfig, 0x0007B600, 0x4A00, kFLASH_ApiEraseKey);
    FLASH_Program(&flashConfig, 0x0007B600, buffer, sizeof buffer);

    if (lap == 9) {
      buffer[0] += 1;
    }

    if (FLASH_VerifyProgram(&flashConfig, 0x0007B600, 
                            sizeof buffer, buffer, 
                            &failedAddress, &failedData)) {
      ;
    }
}

 

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.

And the "FLASH_VerifyProgram" indeed reports an error, but both "failedAddress" and "failedData" variables remain unchanged. 

Is it a bug or I don't understand something?

Best regards!

Labels (2)
Tags (1)
0 Kudos
1 Reply

85 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @GlebPlekhotko 

Sorry for the inconvenient to you. And thanks for your report. 

I have taken ticket to our internal team.

 

Thanks.

BR

Alice

0 Kudos