Flash usage for data storage

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

Flash usage for data storage

Jump to solution
1,269 Views
jabitbe2_jcplc
Contributor I
Hello,
 
There are some configuration/calibration data we want to be able to save in memory (as we do not have an EEPROM). I'm trying to locate the best place in the MCXN947's memory architecture to do so without changing the current location of our application code (as it stands right now it's from 0x00000000 to 
0x001FFFFF) or its allocated size (which seems to be the max of 2mb). You can see where that address range is in the image below.
 
 
thumbnail_image.png
 
For the configuration data we would like to save, we would like to be able to overwrite them.  In chapter 8 of the reference manual, it mentions the following:

 
thumbnail_image (1).png
 
Am I to understand that if I dedicate 8kb of the flash for these configuration values, in order to overwrite them I would first need to erase the full 8kb first? As in, I'd need to set aside flash sections in 8kb tranches at least in order to not mess around with the rest of the flash.
 
Also, in the first image above, there are sections called Flash Bank 0 IFR 0 and Flash Bank 1 IFR 0. What are those exactly? Can I use them (4 x 8kb sectors) to store the configuration values?
 
Thank you!
0 Kudos
Reply
1 Solution
1,235 Views
paulvernoun
Contributor I

Good question! Yeah, you’ve got it right — with flash memory, you can’t just overwrite individual values directly. You need to erase the entire 8KB sector first before writing new data. So reserving a dedicated 8KB (or multiple) section just for your config makes sense.

About the Flash Bank IFR areas — those are usually for factory info and calibration data, not really meant for general user storage. It’s better to keep your config in a reserved flash sector instead of using those IFR blocks.

View solution in original post

0 Kudos
Reply
1 Reply
1,236 Views
paulvernoun
Contributor I

Good question! Yeah, you’ve got it right — with flash memory, you can’t just overwrite individual values directly. You need to erase the entire 8KB sector first before writing new data. So reserving a dedicated 8KB (or multiple) section just for your config makes sense.

About the Flash Bank IFR areas — those are usually for factory info and calibration data, not really meant for general user storage. It’s better to keep your config in a reserved flash sector instead of using those IFR blocks.

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2188496%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EFlash%20usage%20for%20data%20storage%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2188496%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CDIV%3EHello%2C%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3EThere%20are%20some%20configuration%2Fcalibration%20data%20we%20want%20to%20be%20able%20to%20save%20in%20memory%20(as%20we%20do%20not%20have%20an%20EEPROM).%20I'm%20trying%20to%20locate%20the%20best%20place%20in%20the%20MCXN947's%20memory%20architecture%20to%20do%20so%20without%20changing%20the%20current%20location%20of%20our%20application%20code%20(as%20it%20stands%20right%20now%20it's%20from%200x00000000%20to%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E0x001FFFFF)%20or%20its%20allocated%20size%20(which%20seems%20to%20be%20the%20max%20of%202mb).%20You%20can%20see%20where%20that%20address%20range%20is%20in%20the%20image%20below.%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CDIV%3E%3CDIV%20class%3D%22%22%3E%26nbsp%3B%3C%2FDIV%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22thumbnail_image.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22thumbnail_image.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F361471iA5FB26CB000CDD94%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22thumbnail_image.png%22%20alt%3D%22thumbnail_image.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3EFor%20the%20configuration%20data%20we%20would%20like%20to%20save%2C%20we%20would%20like%20to%20be%20able%20to%20overwrite%20them.%26nbsp%3B%20In%20chapter%208%20of%20the%20reference%20manual%2C%20it%20mentions%20the%20following%3A%3C%2FDIV%3E%3CDIV%3E%3CBR%20%2F%3E%3CDIV%20class%3D%22%22%3E%26nbsp%3B%3C%2FDIV%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22thumbnail_image%20(1).png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22thumbnail_image%20(1).png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F361472i1C7106E71170EA95%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22thumbnail_image%20(1).png%22%20alt%3D%22thumbnail_image%20(1).png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3EAm%20I%20to%20understand%20that%20if%20I%20dedicate%208kb%20of%20the%20flash%20for%20these%20configuration%20values%2C%20in%20order%20to%20overwrite%20them%20I%20would%20first%20need%20to%20erase%20the%20full%208kb%20first%3F%20As%20in%2C%20I'd%20need%20to%20set%20aside%20flash%20sections%20in%208kb%20tranches%20at%20least%20in%20order%20to%20not%20mess%20around%20with%20the%20rest%20of%20the%20flash.%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3EAlso%2C%20in%20the%20first%20image%20above%2C%20there%20are%20sections%20called%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EFlash%20Bank%200%20IFR%200%3C%2FSTRONG%3E%26nbsp%3Band%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EFlash%20Bank%201%20IFR%200%3C%2FSTRONG%3E.%20What%20are%20those%20exactly%3F%20Can%20I%20use%20them%20(4%20x%208kb%20sectors)%20to%20store%20the%20configuration%20values%3F%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3EThank%20you!%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2188632%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20Flash%20usage%20for%20data%20storage%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2188632%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EGood%20question!%20Yeah%2C%20you%E2%80%99ve%20got%20it%20right%20%E2%80%94%20with%20flash%20memory%2C%20you%20can%E2%80%99t%20just%20overwrite%20individual%20values%20directly.%20You%20need%20to%20erase%20the%20entire%208KB%20sector%20first%20before%20writing%20new%20data.%20So%20reserving%20a%20dedicated%208KB%20(or%20multiple)%20section%20just%20for%20your%20config%20makes%20sense.%3C%2FP%3E%3CP%3EAbout%20the%20Flash%20Bank%20IFR%20areas%20%E2%80%94%20those%20are%20usually%20for%20factory%20info%20and%20calibration%20data%2C%20not%20really%20meant%20for%20general%20user%20storage.%20It%E2%80%99s%20better%20to%20keep%20your%20config%20in%20a%20reserved%20flash%20sector%20instead%20of%20using%20those%20IFR%20blocks.%3C%2FP%3E%3C%2FLINGO-BODY%3E