In our project for storing of NVM data we are having 2 options one is EEPROM (external to MPC5606B) and also D-Flash which is within MPC5606B ( Limited to 64KB).
I would like to use the 64KB D-Flash area to store,read and write application specific NVM data. I need suggestion or sample code to know how could i access this area for my application.
Basically i would like to store,read and flash data into this section separately when compared to C-Flash area.
Also during compilation itself i would like to tell/address to compiler that these NVM data resides in D-Flash area.
Please suggest me different design options so that i can choose the best needed for my application.
Below is my environment details :
Board : MPC5606B
Compiler : GreenHills
Configuration Tool for Firmware : RappiD
IDE : Eclipse
P.S : When we exceed 64kb then we will use EEPROM chip for NVM store,read and write.
I have already shared some SW examples how to program the flash memory. For example here:
If you want to have some initial values at the beginning in flash, see attached example - see the main.c and linker file to see how to force some constants to defined area.
You can use SSD flash drivers:
Next option is to use Emulated EEPROM driver:
The data flash has 16KB blocks. This is the smallest portion of flash that can be erased. If you want to modify just part of this block, it is necessary to copy the data to RAM, update the data and program everything back to flash. Emulated EEPROM driver helps to avoid this operation. See the user manual for details.
I am using Rappid Tool for configuration of firmware of MPC-5606B and it also generates the LDF file (linker file).
We are using the Trace32-Lauterbach and ICDPROGNEXUS-PEMICRO MULTILINK UNIVERSAL FX for flashing and debug.
As such flashing is done with a cmm script in case of Trace32 or using ICDPROGNEXUS software from PE Micro.
We are developing a application and every application has some tunable configuration parameters and i would like to store this in the NVM data flash so that it could changed frequently during the work.
MPC5606B has 64KB data flash and we could use an external chip EEPROM if the NVM data exceeds 64KB for our application.
I am really not sure on how to safely access Dataflash for read and write and how best i could do the design.
I am thinking like :
After Power On :
Probably i would like to copy all the NVM related data to RAM from DataFlash once after new power on and application can read the RAM copy and perform their operation.
And if i want change some NVM data then i would like to change it then in order to reflect it in the RAM copy then i would like to a reset so that changes values are reflected in the RAM
If you have a better design then please share. I hope i have addressed in detail on what i am trying to do.
Many thanks for your assistance.
yes, you can copy the content of data flash to RAM after power on. But notice that there's only 80KB RAM, so you will have only 16KB for all other operations.
The only weak point is the update of data flash. If unexpected reset or power down occurs during the update, you can lose the data because they are not programmed in the flash yet and they will be lost in RAM. If it is a problem for your application, it is good idea to have some backup in code flash memory. Everything else is just matter of software implementation and it depends on your needs.
Thanks for your response.
I don't want complete DataFlash to be loaded into RAM. I need let say only 10kb of data flash which has application tuning/configuration parameters to be loaded into RAM. Will i able to do so with flash driver files?
I was not able to download the Emulated EEPRom driver due to firewall issue.
Is Emulated EEPROM driver related DATA Flash handling?
yes, you can use the flash driver for this purpose. You can read the data flash as any other memory, for example via pointers or whatever (there are no read functions in drivers because that's not necessary). Then you can use the drivers to erase the flash and to program the flash.
The SSD flash drivers are the basic ones, it allows you to erase a flash block and to program defined data to flash. Emulated EEPROM drivers use record format and it implements something like circular buffer mechanism. It is supposed to be used on data flash because data flash allows you to do more erase/program cycles than the code flash memory.