LPC55S66 Flash Controller READ_SINGLE_WORD Initialization and ECC Handling at 96 MHz

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

LPC55S66 Flash Controller READ_SINGLE_WORD Initialization and ECC Handling at 96 MHz

136 Views
ICE
Contributor I

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:

  • MCU: LPC55S66JBD64

  • DEVICE_ID0: 0x501022C2

  • DIEID: 0x000426B1

  • Boot ROM version: 4.3.0

  • ROM Flash API version: 1.0.0

  • SDK: SDK_2.x_LPC55S66, version 26.06.00

  • FLASHIAP driver: 2.1.5

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:

  1. 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?

  2. Can the controller's automatic initialization following reset be relied upon, or must software explicitly configure additional timing or trim settings?

  3. 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?

  4. Is there an official NXP example showing robust handling of erased or ECC-corrupted flash pages on the LPC55S66?

  5. 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.

0 Kudos
Reply
2 Replies

102 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @ICE 

Based on your requirements, I recommend referring to AN12327.
 
This application note demonstrates a dual-image secondary bootloader, which similarly checks multiple Flash regions during startup and determines whether the stored images are valid. It uses CRC32, version information, and an image marker/header to verify image integrity.
 
Referring to this application can help save development time.
 
Thank you.
 
BR
Alice

 

0 Kudos
Reply

96 Views
ICE
Contributor I

Thank you for recommending AN12327. I looked at the application note and its associated source code.

The example confirms that controller-based reads using READ_SINGLE_WORD can avoid the AHB HardFault issue associated with erased flash.

I also found that the MCUXpresso example configures SET_READ_MODE with a value of 8 when operating at 96 MHz.

I have three remaining questions:

  1. Timing: For the LPC55S66JBD64 at 96 MHz, is it correct to configure SET_READ_MODE using DATAW0 = 0x00000008, or are additional fields or trim values required?

  2. Initialization: Can I rely on the flash controller's automatic initialization and trim loading after reset, or must I call the ROM FLASH_Init function before using READ_SINGLE_WORD and BLANK_CHECK?

  3. Timeout recovery: If a flash-controller command fails to set DONE, or a controller register access stalls, what is the recommended recovery procedure? Is a system reset sufficient?

My hardware reports:

  • DEVICE_ID0: 0x501022C2

  • DIEID: 0x000426B1

  • Boot ROM: 4.3.0

  • Flash API version: 1.0.0

I'm specifically trying to ensure that startup reads of erased or partially programmed configuration flash are safe.

Thank you.

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2425633%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ELPC55S66%20Flash%20Controller%20READ_SINGLE_WORD%20Initialization%20and%20ECC%20Handling%20at%2096%20MHz%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2425633%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%3CSPAN%3EI'm%20developing%20firmware%20for%20an%20LPC55S66JBD64%20and%20need%20to%20read%20internal%20flash%20reliably%2C%20including%20erased%20or%20partially%20programmed%20pages%20that%20may%20contain%20invalid%20ECC%20information.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EThe%20application%20stores%20configuration%20data%20in%20two%20redundant%20flash%20regions%2C%20with%20CRC%20validation%20and%20power-loss%20recovery.%20At%20startup%2C%20it%20must%20determine%20which%20copy%20is%20valid%20without%20risking%20a%20HardFault%20when%20reading%20erased%20or%20corrupted%20flash.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSTRONG%3E%3CSPAN%3EHardware%20identification%3A%3C%2FSPAN%3E%3C%2FSTRONG%3E%3C%2FP%3E%3CUL%3E%3CLI%3E%3CP%3E%3CSPAN%3EMCU%3A%20LPC55S66JBD64%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%3E%3CSPAN%3EDEVICE_ID0%3A%200x501022C2%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%3E%3CSPAN%3EDIEID%3A%200x000426B1%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%3E%3CSPAN%3EBoot%20ROM%20version%3A%204.3.0%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%3E%3CSPAN%3EROM%20Flash%20API%20version%3A%201.0.0%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%3E%3CSPAN%3ESDK%3A%20SDK_2.x_LPC55S66%2C%20version%2026.06.00%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%3E%3CSPAN%3EFLASHIAP%20driver%3A%202.1.5%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLI%3E%3C%2FUL%3E%3CP%3E%3CSTRONG%3E%3CSPAN%3EBackground%3A%3C%2FSPAN%3E%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EI%20initially%20investigated%20the%20SDK's%20%3C%2FSPAN%3E%3CSPAN%3EFLASH_Read()%3C%2FSPAN%3E%3CSPAN%3E%20function.%20For%20boot%20ROM%20major%20version%204%2C%20the%20driver%20selects%20the%20hardcoded%20address%20%3C%2FSPAN%3E%3CSPAN%3E0x130043A3%3C%2FSPAN%3E%3CSPAN%3E.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EHowever%2C%20examining%20the%20ROM%20using%20GDB%20indicates%20that%20this%20address%20points%20into%20the%20middle%20of%20another%20routine%2C%20after%20its%20stack%20initialization.%20Therefore%2C%20I%20am%20reluctant%20to%20call%20this%20function%20without%20confirmation%20that%20it%20is%20compatible%20with%20ROM%204.3.0.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EI%20subsequently%20found%20NXP's%20example%20project%20%3C%2FSPAN%3E%3CSPAN%3Elpcxpresso55s69_led_blinky_memoryread.zip%3C%2FSPAN%3E%3CSPAN%3E%2C%20which%20demonstrates%20reading%20flash%20through%20the%20controller's%20%3C%2FSPAN%3E%3CSPAN%3EREAD_SINGLE_WORD%3C%2FSPAN%3E%3CSPAN%3E%20command%20rather%20than%20using%20the%20ROM%20%3C%2FSPAN%3E%3CSPAN%3EFLASH_Read()%3C%2FSPAN%3E%3CSPAN%3E%20function.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EI%20would%20prefer%20to%20use%20this%20documented%20controller-based%20method.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSTRONG%3E%3CSPAN%3EMy%20questions%3A%3C%2FSPAN%3E%3C%2FSTRONG%3E%3C%2FP%3E%3COL%3E%3CLI%3E%3CP%3E%3CSPAN%3EWhen%20running%20at%2096%20MHz%2C%20what%20initialization%20and%20timing%20configuration%20is%20required%20before%20issuing%20the%20flash%20controller's%20%3C%2FSPAN%3E%3CSPAN%3EREAD_SINGLE_WORD%3C%2FSPAN%3E%3CSPAN%3E%2C%20%3C%2FSPAN%3E%3CSPAN%3EBLANK_CHECK%3C%2FSPAN%3E%3CSPAN%3E%2C%20and%20%3C%2FSPAN%3E%3CSPAN%3EREPORT_ECC%3C%2FSPAN%3E%3CSPAN%3E%20commands%3F%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%3E%3CSPAN%3ECan%20the%20controller's%20automatic%20initialization%20following%20reset%20be%20relied%20upon%2C%20or%20must%20software%20explicitly%20configure%20additional%20timing%20or%20trim%20settings%3F%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%3E%3CSPAN%3EIf%20a%20%3C%2FSPAN%3E%3CSPAN%3EREAD_SINGLE_WORD%3C%2FSPAN%3E%3CSPAN%3E%20command%20fails%20to%20complete%2C%20what%20is%20the%20supported%20recovery%20procedure%3F%20Is%20a%20system%20reset%20sufficient%2C%20or%20is%20a%20controller-specific%20reset%20or%20abort%20sequence%20required%3F%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%3E%3CSPAN%3EIs%20there%20an%20official%20NXP%20example%20showing%20robust%20handling%20of%20erased%20or%20ECC-corrupted%20flash%20pages%20on%20the%20LPC55S66%3F%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%3E%3CSPAN%3EAlternatively%2C%20can%20NXP%20confirm%20whether%20the%20SDK's%20%3C%2FSPAN%3E%3CSPAN%3EFLASH_Read()%3C%2FSPAN%3E%3CSPAN%3E%20ROM%20address%20%3C%2FSPAN%3E%3CSPAN%3E0x130043A3%3C%2FSPAN%3E%3CSPAN%3E%20is%20valid%20for%20boot%20ROM%204.3.0%3F%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLI%3E%3C%2FOL%3E%3CP%3E%3CSPAN%3EI%20have%20reviewed%20UM11126%2C%20AN12949%2C%20the%20FLASHIAP%20SDK%20driver%2C%20and%20the%20LPC55S69%20memory-read%20demonstration.%20The%20demonstration%20clarifies%20the%20read-command%20sequence%20but%20does%20not%20appear%20to%20address%20timeout%20recovery%20or%20the%20precise%20initialization%20requirements.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EAny%20clarification%20or%20reference%20to%20a%20supported%20implementation%20would%20be%20appreciated.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EThank%20you.%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2426011%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20LPC55S66%20Flash%20Controller%20READ_SINGLE_WORD%20Initialization%20and%20ECC%20Handling%20at%2096%20MHz%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2426011%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F267903%22%20target%3D%22_blank%22%3E%40ICE%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CDIV%3EBased%20on%20your%20requirements%2C%20I%20recommend%20referring%20to%20AN12327.%3C%2FDIV%3E%0A%3CDIV%3E%3CA%20href%3D%22https%3A%2F%2Fwww.nxp.com.cn%2Fdocs%2Fen%2Fapplication-note%2FAN12327.pdf%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.nxp.com.cn%2Fdocs%2Fen%2Fapplication-note%2FAN12327.pdf%3C%2FA%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CDIV%3EThis%20application%20note%20demonstrates%20a%20dual-image%20secondary%20bootloader%2C%20which%20similarly%20checks%20multiple%20Flash%20regions%20during%20startup%20and%20determines%20whether%20the%20stored%20images%20are%20valid.%20It%20uses%20CRC32%2C%20version%20information%2C%20and%20an%20image%20marker%2Fheader%20to%20verify%20image%20integrity.%3C%2FDIV%3E%0A%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CDIV%3E%0A%3CDIV%3EReferring%20to%20this%20application%20can%20help%20save%20development%20time.%3C%2FDIV%3E%0A%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CDIV%3EThank%20you.%3C%2FDIV%3E%0A%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CDIV%3EBR%3C%2FDIV%3E%0A%3CDIV%3EAlice%3C%2FDIV%3E%0A%3C%2FDIV%3E%0A%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2426293%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20LPC55S66%20Flash%20Controller%20READ_SINGLE_WORD%20Initialization%20and%20ECC%20Handling%20at%2096%20MHz%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2426293%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%3CSPAN%3EThank%20you%20for%20recommending%20AN12327.%20I%20looked%20at%20the%20application%20note%20and%20its%20associated%20source%20code.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EThe%20example%20confirms%20that%20controller-based%20reads%20using%20READ_SINGLE_WORD%20can%20avoid%20the%20AHB%20HardFault%20issue%20associated%20with%20erased%20flash.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EI%20also%20found%20that%20the%20MCUXpresso%20example%20configures%20SET_READ_MODE%20with%20a%20value%20of%208%20when%20operating%20at%2096%20MHz.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EI%20have%20three%20remaining%20questions%3A%3C%2FSPAN%3E%3C%2FP%3E%3COL%3E%3CLI%3E%3CP%3E%3CSTRONG%3E%3CSPAN%3ETiming%3A%3C%2FSPAN%3E%3C%2FSTRONG%3E%3CSPAN%3E%20For%20the%20LPC55S66JBD64%20at%2096%20MHz%2C%20is%20it%20correct%20to%20configure%20SET_READ_MODE%20using%20DATAW0%20%3D%200x00000008%2C%20or%20are%20additional%20fields%20or%20trim%20values%20required%3F%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%3E%3CSTRONG%3E%3CSPAN%3EInitialization%3A%3C%2FSPAN%3E%3C%2FSTRONG%3E%3CSPAN%3E%20Can%20I%20rely%20on%20the%20flash%20controller's%20automatic%20initialization%20and%20trim%20loading%20after%20reset%2C%20or%20must%20I%20call%20the%20ROM%20FLASH_Init%20function%20before%20using%20READ_SINGLE_WORD%20and%20BLANK_CHECK%3F%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%3E%3CSTRONG%3E%3CSPAN%3ETimeout%20recovery%3A%3C%2FSPAN%3E%3C%2FSTRONG%3E%3CSPAN%3E%20If%20a%20flash-controller%20command%20fails%20to%20set%20DONE%2C%20or%20a%20controller%20register%20access%20stalls%2C%20what%20is%20the%20recommended%20recovery%20procedure%3F%20Is%20a%20system%20reset%20sufficient%3F%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLI%3E%3C%2FOL%3E%3CP%3E%3CSPAN%3EMy%20hardware%20reports%3A%3C%2FSPAN%3E%3C%2FP%3E%3CUL%3E%3CLI%3E%3CP%3E%3CSPAN%3EDEVICE_ID0%3A%200x501022C2%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%3E%3CSPAN%3EDIEID%3A%200x000426B1%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%3E%3CSPAN%3EBoot%20ROM%3A%204.3.0%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%3E%3CSPAN%3EFlash%20API%20version%3A%201.0.0%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLI%3E%3C%2FUL%3E%3CP%3E%3CSPAN%3EI'm%20specifically%20trying%20to%20ensure%20that%20startup%20reads%20of%20erased%20or%20partially%20programmed%20configuration%20flash%20are%20safe.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EThank%20you.%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E