S32K324 DFlash exception causing BUS FAULT

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

S32K324 DFlash exception causing BUS FAULT

Jump to solution
1,082 Views
zzt
Contributor I

Hello NXP Community and Experts,

I am encountering a persistent Bus Fault exception on S32K324 microcontroller, which seems to be triggered when accessing the DFlash memory.

Observations:

When debugging, BFSR and BFAR registers show a bus fault on access to address 0x1000a000. I obsecured that some abnormal behaviors happened in DFlash(At the beginning of one Fee bank)Some bytes of contents kept alternating between "????????" and "FFFFFFFF". Other flash banks operate normally. 

registers.pngdump.png

      Alternating between "????????" and "FFFFFFFFF"

What I have tried:

The same abnormal behavior persists whether the MCU is under set or stopped at breakpoint. 

Could you please point out the potential causes for a DFlash exception? Any suggestions or guidance would be greatly appreciated. Thank you in advance for your support!

#S32K3 

 

Tags (1)
0 Kudos
Reply
1 Solution
1,055 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi @zzt 

If the debugger shows ???????? characters, such data are corrupted due to double bit ECC error.
Generally, ECC error can occur due to:
1. Overprogramming. ECC is handled on 64bit (one double word) boundary. Users are allowed to program only a double word which is in fully erased state. If the double word is not in erased state (all bytes are 0xFF), it's necessary to erase whole sector (8KB).
2. Program or erase operation is terminated by unexpected reset, so the flash is left in undeterministic state.
3. Flash wear-out - when too many program/erase cycles have been performed on the flash.

In your case, it's caused by (2), most likely. Please take a look at:
https://community.nxp.com/t5/S32K/S32K3-Hard-fault-exception-on-startup-for-ECC-error-in-DFlash/m-p/...

Regards,
Lukas

View solution in original post

2 Replies
1,056 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi @zzt 

If the debugger shows ???????? characters, such data are corrupted due to double bit ECC error.
Generally, ECC error can occur due to:
1. Overprogramming. ECC is handled on 64bit (one double word) boundary. Users are allowed to program only a double word which is in fully erased state. If the double word is not in erased state (all bytes are 0xFF), it's necessary to erase whole sector (8KB).
2. Program or erase operation is terminated by unexpected reset, so the flash is left in undeterministic state.
3. Flash wear-out - when too many program/erase cycles have been performed on the flash.

In your case, it's caused by (2), most likely. Please take a look at:
https://community.nxp.com/t5/S32K/S32K3-Hard-fault-exception-on-startup-for-ECC-error-in-DFlash/m-p/...

Regards,
Lukas

897 Views
zzt
Contributor I

Hello Lukas,

Thank you for your explanation! It was very helpful. I have some follow-up questions and would appreciate your further insights.

I hope to make a conditional check for Dflash ECC Errors once the software enters HardFault, and execute an erase operation if this specific fault is detected. I plan to check these conditions:

  1. BFARVALID bit in SCB->BFSR is set.

  2. Either PRECISERR or IMPRECISERR bit in SCB->BFSR is set.

  3. The fault address in SCB->BFAR in the DFLASH address range.

     Do you think this logic is sufficient enough to identify a DFLASH ECC error? Are there any other flags or registers that I should also check to make this condition more precise and avoid false positives? (I noticed that MCRS[31] EER sometimes not set to 1 even though dflash ecc error happened)

    Thank you for your assistance. It is greatly appreciated.

Best,

Zzt

S32K3 

 

Tags (1)
0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2175671%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ES32K324%20DFlash%20exception%20causing%20BUS%20FAULT%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2175671%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%20NXP%20Community%20and%20Experts%2C%3C%2FP%3E%3CP%3EI%20am%20encountering%20a%20persistent%20Bus%20Fault%20exception%20on%20S32K324%20microcontroller%2C%20which%20seems%20to%20be%20triggered%20when%20accessing%20the%20DFlash%20memory.%3C%2FP%3E%3CP%3EObservations%3A%3C%2FP%3E%3CP%3EWhen%20debugging%2C%20BFSR%20and%20BFAR%20registers%20show%20a%20bus%20fault%20on%20access%20to%20address%200x1000a000.%20I%20obsecured%20that%20some%20abnormal%20behaviors%20happened%20in%20DFlash%EF%BC%88At%20the%20beginning%20of%20one%20Fee%20bank%EF%BC%89Some%20bytes%20of%20contents%20kept%20alternating%20between%20%22%3F%3F%3F%3F%3F%3F%3F%3F%22%20and%20%22FFFFFFFF%22.%20Other%20flash%20banks%20operate%20normally.%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22registers.png%22%20style%3D%22width%3A%20909px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22registers.png%22%20style%3D%22width%3A%20909px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F358501iCCC0DC9FA59C6BD6%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22registers.png%22%20alt%3D%22registers.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22dump.png%22%20style%3D%22width%3A%20475px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22dump.png%22%20style%3D%22width%3A%20475px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F358502i68E34B9E8A6070D9%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22dump.png%22%20alt%3D%22dump.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20Alternating%20between%20%22%3F%3F%3F%3F%3F%3F%3F%3F%22%20and%20%22FFFFFFFFF%22%3C%2FP%3E%3CP%3EWhat%20I%20have%20tried%3A%3C%2FP%3E%3CP%3EThe%20same%20abnormal%20behavior%20persists%20whether%20the%20MCU%20is%20under%20set%20or%20stopped%20at%20breakpoint.%26nbsp%3B%3C%2FP%3E%3CP%3ECould%20you%20please%20point%20out%20the%20potential%20causes%20for%20a%20DFlash%20exception%3F%20Any%20suggestions%20or%20guidance%20would%20be%20greatly%20appreciated.%26nbsp%3BThank%20you%20in%20advance%20for%20your%20support!%3C%2FP%3E%3CP%3E%23S32K3%26nbsp%3B%3C%2FP%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2185440%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20S32K324%20DFlash%20exception%20causing%20BUS%20FAULT%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2185440%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%20Lukas%2C%3C%2FP%3E%3CP%3EThank%20you%20for%20your%20explanation!%20It%20was%20very%20helpful.%20I%20have%20some%20follow-up%20questions%20and%20would%20appreciate%20your%20further%20insights.%3C%2FP%3E%3CP%3EI%20hope%20to%20make%20a%20conditional%20check%20for%20Dflash%20ECC%20Errors%20once%20the%20software%20enters%20HardFault%2C%20and%20execute%20an%20erase%20operation%20if%20this%20specific%20fault%20is%20detected.%20I%20plan%20to%20check%20these%20conditions%3A%3C%2FP%3E%3COL%3E%3CLI%3E%3CP%20class%3D%22%22%3EBFARVALID%3CSPAN%3E%26nbsp%3Bbit%20in%26nbsp%3B%3C%2FSPAN%3ESCB-%26gt%3BBFSR%3CSPAN%3E%26nbsp%3Bis%20set.%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%20class%3D%22%22%3E%3CSPAN%3EEither%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3EPRECISERR%3CSPAN%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eor%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3EIMPRECISERR%3CSPAN%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Ebit%20in%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3ESCB-%26gt%3BBFSR%3CSPAN%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eis%20set.%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLI%3E%3CLI%3E%3CP%20class%3D%22%22%3E%3CSPAN%3EThe%20fault%20address%20in%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3ESCB-%26gt%3BBFAR%3CSPAN%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Ein%20the%20DFLASH%20address%20range.%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLI%3E%3C%2FOL%3E%3CP%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3BDo%20you%20think%20this%20logic%20is%20sufficient%20enough%20to%20identify%20a%20DFLASH%20ECC%20error%3F%20Are%20there%20any%20other%20flags%20or%20registers%20that%20I%20should%20also%20check%20to%20make%20this%20condition%20more%20precise%20and%20avoid%20false%20positives%3F%20(I%20noticed%20that%20MCRS%5B31%5D%20EER%20sometimes%20not%20set%20to%201%20even%20though%20dflash%20ecc%20error%20happened)%3C%2FP%3E%3CP%3E%26nbsp%3B%20%26nbsp%3B%20Thank%20you%20for%20your%20assistance.%20It%20is%20greatly%20appreciated.%3C%2FP%3E%3CP%3EBest%2C%3C%2FP%3E%3CP%3EZzt%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fc-pwmxy87654%2FS32K3%2Fpd-p%2FS32K3%22%20class%3D%22lia-product-mention%22%20data-product%3D%221688-1%22%20target%3D%22_blank%22%3ES32K3%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2175888%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20S32K324%20DFlash%20exception%20causing%20BUS%20FAULT%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2175888%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%2F234220%22%20target%3D%22_blank%22%3E%40zzt%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20the%20debugger%20shows%20%3F%3F%3F%3F%3F%3F%3F%3F%20characters%2C%20such%20data%20are%20corrupted%20due%20to%20double%20bit%20ECC%20error.%20%3CBR%20%2F%3EGenerally%2C%20ECC%20error%20can%20occur%20due%20to%3A%3CBR%20%2F%3E1.%20Overprogramming.%20ECC%20is%20handled%20on%2064bit%20(one%20double%20word)%20boundary.%20Users%20are%20allowed%20to%20program%20only%20a%20double%20word%20which%20is%20in%20fully%20erased%20state.%20If%20the%20double%20word%20is%20not%20in%20erased%20state%20(all%20bytes%20are%200xFF)%2C%20it's%20necessary%20to%20erase%20whole%20sector%20(8KB).%20%3CBR%20%2F%3E2.%20Program%20or%20erase%20operation%20is%20terminated%20by%20unexpected%20reset%2C%20so%20the%20flash%20is%20left%20in%20undeterministic%20state.%3CBR%20%2F%3E3.%20Flash%20wear-out%20-%20when%20too%20many%20program%2Ferase%20cycles%20have%20been%20performed%20on%20the%20flash.%3C%2FP%3E%0A%3CP%3EIn%20your%20case%2C%20it's%20caused%20by%20(2)%2C%20most%20likely.%20Please%20take%20a%20look%20at%3A%3CBR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2FS32K%2FS32K3-Hard-fault-exception-on-startup-for-ECC-error-in-DFlash%2Fm-p%2F2109306%2Fhighlight%2Ftrue%23M49516%22%20target%3D%22_blank%22%3Ehttps%3A%2F%2Fcommunity.nxp.com%2Ft5%2FS32K%2FS32K3-Hard-fault-exception-on-startup-for-ECC-error-in-DFlash%2Fm-p%2F2109306%2Fhighlight%2Ftrue%23M49516%3C%2FA%3E%3C%2FP%3E%0A%3CP%3ERegards%2C%3CBR%20%2F%3ELukas%3C%2FP%3E%3C%2FLINGO-BODY%3E