I'm developing firmware for an LPC55S66JBD64 and need to read internal flash reliably, including erased or partially programmed pages that may contain invalid ECC information.
The application stores configuration data in two redundant flash regions, with CRC validation and power-loss recovery. At startup, it must determine which copy is valid without risking a HardFault when reading erased or corrupted flash.
Hardware identification:
Background:
I initially investigated the SDK's FLASH_Read() function. For boot ROM major version 4, the driver selects the hardcoded address 0x130043A3.
However, examining the ROM using GDB indicates that this address points into the middle of another routine, after its stack initialization. Therefore, I am reluctant to call this function without confirmation that it is compatible with ROM 4.3.0.
I subsequently found NXP's example project lpcxpresso55s69_led_blinky_memoryread.zip, which demonstrates reading flash through the controller's READ_SINGLE_WORD command rather than using the ROM FLASH_Read() function.
I would prefer to use this documented controller-based method.
My questions:
When running at 96 MHz, what initialization and timing configuration is required before issuing the flash controller's READ_SINGLE_WORD, BLANK_CHECK, and REPORT_ECC commands?
Can the controller's automatic initialization following reset be relied upon, or must software explicitly configure additional timing or trim settings?
If a READ_SINGLE_WORD command fails to complete, what is the supported recovery procedure? Is a system reset sufficient, or is a controller-specific reset or abort sequence required?
Is there an official NXP example showing robust handling of erased or ECC-corrupted flash pages on the LPC55S66?
Alternatively, can NXP confirm whether the SDK's FLASH_Read() ROM address 0x130043A3 is valid for boot ROM 4.3.0?
I have reviewed UM11126, AN12949, the FLASHIAP SDK driver, and the LPC55S69 memory-read demonstration. The demonstration clarifies the read-command sequence but does not appear to address timeout recovery or the precise initialization requirements.
Any clarification or reference to a supported implementation would be appreciated.
Thank you.