Reference code to handle ECC errors in S32K144 Flash Memory (P-Flash, FlexNVM, FlexRAM)

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

Reference code to handle ECC errors in S32K144 Flash Memory (P-Flash, FlexNVM, FlexRAM)

122 Views
NJ_NXP
Contributor II
Hello NXP Community,
I am implementing safety mechanisms on the S32K144 and need reference code for non-correctable (double-bit) ECC errors, alongside a method to inject them for testing.
 
1. Double-Bit Handling
I need code examples to catch double-bit faults across:
  • P-Flash & FlexNVM:
  • FlexRAM (EEE): Detecting faults during background copies.
  • Exception Handlers: A BusFault or HardFault ISR routine to isolate the failing memory address.
 
2. Error Injection
What is the recommended way to simulate a double-bit fault in the Flash memory arrays
 
Any code snippets would be highly appreciated.
0 Kudos
Reply
1 Reply

93 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @NJ_NXP,

1.

If you are using RTD drivers, refer to the Integration Manual for the S32K1/S32M24x FLS Driver (RTD_FLS_IM.pdf), specifically Section 10.4.1 – ECC Management on Internal Flash.
The document can be found in the RTD installation directory, for example for RTD 3.0.0_QLP02:
SW32K1_S32M24x_RTD_4.4_3.0.0_QLP02\eclipse\plugins\Fls_TS_T40D2M30I0R0\doc\

Regarding FlexRAM, it does not implement ECC. However, if a double-bit error is detected during a copy-down operation, the EEPROM record is read as all 1s.
For more details, see application note AN11983 – Using the S32K1xx EEPROM Functionality:
https://www.nxp.com/docs/en/application-note/AN11983.pdf

danielmartynek_0-1781865940539.png

2.

The fault can be emulated in the flash controller by setting the FERCNFG[FDFD] bit and then performing a flash read.
Alternatively, the fault can be generated by reprogramming an already programmed flash phrase and subsequently reading it.

 

Regards,

Daniel

 

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2383378%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EReference%20code%20to%20handle%20ECC%20errors%20in%20S32K144%20Flash%20Memory%20(P-Flash%2C%20FlexNVM%2C%20FlexRAM)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2383378%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CDIV%20class%3D%22%22%3EHello%20NXP%20Community%2C%3C%2FDIV%3E%3CDIV%20class%3D%22%22%3EI%20am%20implementing%20safety%20mechanisms%20on%20the%20%3CSTRONG%3ES32K144%3C%2FSTRONG%3E%20and%20need%20reference%20code%20for%20%3CSTRONG%3Enon-correctable%20(double-bit)%20ECC%20errors%3C%2FSTRONG%3E%2C%20alongside%20a%20method%20to%20inject%20them%20for%20testing.%3C%2FDIV%3E%3CDIV%20class%3D%22%22%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%20class%3D%22%22%3E%3CSTRONG%3E1.%20Double-Bit%20Handling%3C%2FSTRONG%3E%3C%2FDIV%3E%3CDIV%20class%3D%22%22%3EI%20need%20code%20examples%20to%20catch%20double-bit%20faults%20across%3A%3C%2FDIV%3E%3CUL%3E%3CLI%3E%3CSPAN%20class%3D%22%22%3E%3CSTRONG%3EP-Flash%20%26amp%3B%20FlexNVM%3A%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FLI%3E%3CLI%3E%3CSPAN%20class%3D%22%22%3E%3CSTRONG%3EFlexRAM%20(EEE)%3A%3C%2FSTRONG%3E%20Detecting%20faults%20during%20background%20copies.%3C%2FSPAN%3E%3C%2FLI%3E%3CLI%3E%3CSPAN%20class%3D%22%22%3E%3CSTRONG%3EException%20Handlers%3A%3C%2FSTRONG%3E%20A%20BusFault%20or%20HardFault%20ISR%20routine%20to%20isolate%20the%20failing%20memory%20address.%3C%2FSPAN%3E%3C%2FLI%3E%3C%2FUL%3E%3CDIV%20class%3D%22%22%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%20class%3D%22%22%3E%3CSTRONG%3E2.%20Error%20Injection%3C%2FSTRONG%3E%3C%2FDIV%3E%3CDIV%20class%3D%22%22%3EWhat%20is%20the%20recommended%20way%20to%20simulate%20a%20double-bit%20fault%20in%20the%20%3CSTRONG%3EFlash%20memory%20arrays%3C%2FSTRONG%3E%3F%26nbsp%3B%3C%2FDIV%3E%3CDIV%20class%3D%22%22%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%20class%3D%22%22%3EAny%20code%20snippets%20would%20be%20highly%20appreciated.%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2383501%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Reference%20code%20to%20handle%20ECC%20errors%20in%20S32K144%20Flash%20Memory%20(P-Flash%2C%20FlexNVM%2C%20FlexRAM)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2383501%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F199505%22%20target%3D%22_blank%22%3E%40NJ_NXP%3C%2FA%3E%2C%3C%2FP%3E%0A%3CP%3E1.%3C%2FP%3E%0A%3CP%3EIf%20you%20are%20using%20RTD%20drivers%2C%20refer%20to%20the%20Integration%20Manual%20for%20the%20S32K1%2FS32M24x%20FLS%20Driver%20(RTD_FLS_IM.pdf)%2C%20specifically%20Section%2010.4.1%20%E2%80%93%20ECC%20Management%20on%20Internal%20Flash.%3CBR%20%2F%3EThe%20document%20can%20be%20found%20in%20the%20RTD%20installation%20directory%2C%20for%20example%20for%20RTD%203.0.0_QLP02%3A%3CBR%20%2F%3ESW32K1_S32M24x_RTD_4.4_3.0.0_QLP02%5Ceclipse%5Cplugins%5CFls_TS_T40D2M30I0R0%5Cdoc%5C%3C%2FP%3E%0A%3CP%3ERegarding%20FlexRAM%2C%20it%20does%20not%20implement%20ECC.%20However%2C%20if%20a%20double-bit%20error%20is%20detected%20during%20a%20copy-down%20operation%2C%20the%20EEPROM%20record%20is%20read%20as%20all%201s.%3CBR%20%2F%3EFor%20more%20details%2C%20see%20application%20note%20AN11983%20%E2%80%93%20Using%20the%20S32K1xx%20EEPROM%20Functionality%3A%3CBR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Fwww.nxp.com%2Fdocs%2Fen%2Fapplication-note%2FAN11983.pdf%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.nxp.com%2Fdocs%2Fen%2Fapplication-note%2FAN11983.pdf%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22danielmartynek_0-1781865940539.png%22%20style%3D%22width%3A%20752px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22danielmartynek_0-1781865940539.png%22%20style%3D%22width%3A%20752px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F389474iDA56119C2DE6AAF4%2Fimage-dimensions%2F752x173%3Fv%3Dv2%22%20width%3D%22752%22%20height%3D%22173%22%20role%3D%22button%22%20title%3D%22danielmartynek_0-1781865940539.png%22%20alt%3D%22danielmartynek_0-1781865940539.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E2.%3C%2FP%3E%0A%3CP%3EThe%20fault%20can%20be%20emulated%20in%20the%20flash%20controller%20by%20setting%20the%20FERCNFG%5BFDFD%5D%20bit%20and%20then%20performing%20a%20flash%20read.%3CBR%20%2F%3EAlternatively%2C%20the%20fault%20can%20be%20generated%20by%20reprogramming%20an%20already%20programmed%20flash%20phrase%20and%20subsequently%20reading%20it.%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3ERegards%2C%3C%2FP%3E%0A%3CP%3EDaniel%3C%2FP%3E%0A%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E