S32K118 D-flash and EEEPROM configuration

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

S32K118 D-flash and EEEPROM configuration

Jump to solution
1,464 Views
HiddenSquid
Contributor III

Hello,

I am bit new to the NXP ecosystem and would desperately require help.

I am using the S32K118 and have been trying to use D-Flash as non volatile memory, but I can't seem to make it work which ever way I try..

At first I tried to partition the FlexNVM to emulate EEEPROM, but that constantly gave me ACCERR. I tried to go over all the reason for it in the datasheet, but the only one I could think of was, that the function was written to P-Flash, but had to be in RAM ("The
Program Partition command must not be launched from flash memory, since flash
memory resources are not accessible during Program Partition command execution."). I couldn't get the function to RAM either, because then I ran in to some linker problems...

Since that didn't work I figured I'd try to just write manually to D-FLASH, but I get the MGSTAT error, which means it has not been cleared. When I tried to clear it, I get to HardFault... AI suggests that it might be the problem of not running the function from RAM again, but I can't get it to work as mentioned earilier...

I will add my files down below and would greatly appreciate any help.

0 Kudos
Reply
1 Solution
1,411 Views
davidtosenovjan
NXP TechSupport
NXP TechSupport

First you need to perform program partition operation to configure FlexRAM/FlexNVM as you needed according AN11983, section 2.2.2.

There is an example code in S32DS SDK (flash_partitioning_s32k144). It needs to be blank new device or with performed mass erase operation before programming the example code. There is no default values, this needs to be done once.

You may also use example code I did in the past. It configure FlexRAM as RAM what was the intention of example code but it also sets up FlexNVM as D-flash:

https://community.nxp.com/t5/S32K-Knowledge-Base/Example-S32K146-Set-whole-FlexRAM-as-RAM-v0-0-S32DS...

 

EEPROM portion of FlexNVM will be accesses over FlexRAM memory address space.

Data flash portion of FlexNVM will be accesses ordinary way i.e. reading of flash address directly and erasing/programming of flash address.

Simple example how to program flash you may see for instance here:

https://community.nxp.com/t5/S32K-Knowledge-Base/Example-S32K144-Flash-RW-simple/ta-p/1110000

View solution in original post

1 Reply
1,412 Views
davidtosenovjan
NXP TechSupport
NXP TechSupport

First you need to perform program partition operation to configure FlexRAM/FlexNVM as you needed according AN11983, section 2.2.2.

There is an example code in S32DS SDK (flash_partitioning_s32k144). It needs to be blank new device or with performed mass erase operation before programming the example code. There is no default values, this needs to be done once.

You may also use example code I did in the past. It configure FlexRAM as RAM what was the intention of example code but it also sets up FlexNVM as D-flash:

https://community.nxp.com/t5/S32K-Knowledge-Base/Example-S32K146-Set-whole-FlexRAM-as-RAM-v0-0-S32DS...

 

EEPROM portion of FlexNVM will be accesses over FlexRAM memory address space.

Data flash portion of FlexNVM will be accesses ordinary way i.e. reading of flash address directly and erasing/programming of flash address.

Simple example how to program flash you may see for instance here:

https://community.nxp.com/t5/S32K-Knowledge-Base/Example-S32K144-Flash-RW-simple/ta-p/1110000

%3CLINGO-SUB%20id%3D%22lingo-sub-2250309%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ES32K118%20D-flash%20and%20EEEPROM%20configuration%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2250309%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%2C%3CBR%20%2F%3E%3CBR%20%2F%3EI%20am%20bit%20new%20to%20the%20NXP%20ecosystem%20and%20would%20desperately%20require%20help.%3C%2FP%3E%3CP%3EI%20am%20using%20the%20S32K118%20and%20have%20been%20trying%20to%20use%20D-Flash%20as%20non%20volatile%20memory%2C%20but%20I%20can't%20seem%20to%20make%20it%20work%20which%20ever%20way%20I%20try..%3C%2FP%3E%3CP%3EAt%20first%20I%20tried%20to%20partition%20the%20FlexNVM%20to%20emulate%20EEEPROM%2C%20but%20that%20constantly%20gave%20me%20ACCERR.%20I%20tried%20to%20go%20over%20all%20the%20reason%20for%20it%20in%20the%20datasheet%2C%20but%20the%20only%20one%20I%20could%20think%20of%20was%2C%20that%20the%20function%20was%20written%20to%20P-Flash%2C%20but%20had%20to%20be%20in%20RAM%20(%22The%3CBR%20%2F%3EProgram%20Partition%20command%20must%20not%20be%20launched%20from%20flash%20memory%2C%20since%20flash%3CBR%20%2F%3Ememory%20resources%20are%20not%20accessible%20during%20Program%20Partition%20command%20execution.%22).%20I%20couldn't%20get%20the%20function%20to%20RAM%20either%2C%20because%20then%20I%20ran%20in%20to%20some%20linker%20problems...%3CBR%20%2F%3E%3CBR%20%2F%3ESince%20that%20didn't%20work%20I%20figured%20I'd%20try%20to%20just%20write%20manually%20to%20D-FLASH%2C%20but%20I%20get%20the%20MGSTAT%20error%2C%20which%20means%20it%20has%20not%20been%20cleared.%20When%20I%20tried%20to%20clear%20it%2C%20I%20get%20to%20HardFault...%20AI%20suggests%20that%20it%20might%20be%20the%20problem%20of%20not%20running%20the%20function%20from%20RAM%20again%2C%20but%20I%20can't%20get%20it%20to%20work%20as%20mentioned%20earilier...%3CBR%20%2F%3E%3CBR%20%2F%3EI%20will%20add%20my%20files%20down%20below%20and%20would%20greatly%20appreciate%20any%20help.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2251257%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20S32K118%20D-flash%20and%20EEEPROM%20configuration%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2251257%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EFirst%20you%20need%20to%20perform%20program%20partition%20operation%20to%20configure%20FlexRAM%2FFlexNVM%20as%20you%20needed%20according%20AN11983%2C%20section%202.2.2.%3C%2FP%3E%0A%3CP%3EThere%20is%20an%20example%20code%20in%20S32DS%20SDK%20(flash_partitioning_s32k144).%20It%20needs%20to%20be%20blank%20new%20device%20or%20with%20performed%20mass%20erase%20operation%20before%20programming%20the%20example%20code.%20There%20is%20no%20default%20values%2C%20this%20needs%20to%20be%20done%20once.%3C%2FP%3E%0A%3CP%3EYou%20may%20also%20use%20example%20code%20I%20did%20in%20the%20past.%20It%20configure%20FlexRAM%20as%20RAM%20what%20was%20the%20intention%20of%20example%20code%20but%20it%20also%20sets%20up%20FlexNVM%20as%20D-flash%3A%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2FS32K-Knowledge-Base%2FExample-S32K146-Set-whole-FlexRAM-as-RAM-v0-0-S32DS-ARM-2-2%2Fta-p%2F1245841%22%20target%3D%22_blank%22%3Ehttps%3A%2F%2Fcommunity.nxp.com%2Ft5%2FS32K-Knowledge-Base%2FExample-S32K146-Set-whole-FlexRAM-as-RAM-v0-0-S32DS-ARM-2-2%2Fta-p%2F1245841%3C%2FA%3E%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3EEEPROM%20portion%20of%20FlexNVM%20will%20be%20accesses%20over%20FlexRAM%20memory%20address%20space.%3C%2FP%3E%0A%3CP%3EData%20flash%20portion%20of%20FlexNVM%20will%20be%20accesses%20ordinary%20way%20i.e.%20reading%20of%20flash%20address%20directly%20and%20erasing%2Fprogramming%20of%20flash%20address.%3C%2FP%3E%0A%3CP%3ESimple%20example%20how%20to%20program%20flash%20you%20may%20see%20for%20instance%20here%3A%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2FS32K-Knowledge-Base%2FExample-S32K144-Flash-RW-simple%2Fta-p%2F1110000%22%20target%3D%22_blank%22%3Ehttps%3A%2F%2Fcommunity.nxp.com%2Ft5%2FS32K-Knowledge-Base%2FExample-S32K144-Flash-RW-simple%2Fta-p%2F1110000%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E