Data size setting in EEprom Emulation drvier

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

Data size setting in EEprom Emulation drvier

Jump to solution
2,095 Views
朱先生
Contributor III

Hi, All:

I download the "MPC5xxx_EEE_DRIVER.exe" from official website.

Then I  modified the "DATA_SIZE"  "BUFFER_SIZE" and "SCHEME_SELECT" values in order to match our project requirement.

 

The demo code is:

#define SCHEME_SELECT  ECC16_VARLENGTH

#define BUFFER_SIZE             0x50

 

#define DATA_SIZE                   0x40

our code is:

#define SCHEME_SELECT  ECC16_FIXLENGTH

#define BUFFER_SIZE             0x1000

 

#define DATA_SIZE                   0x300

 

After those changes, the code would not operate normally.

the return value of "FSL_WriteEeprom" function is  EE_ERROR_NO_ENOUGH_SPACE.

If Setting "DATA_SIZE" is less than 0x100, the return vlue is EE_OK, the code can run  properly.

 

But in manual, the "DATA_SIZE" is described as below:

153815_153815.pngpastedImage_9.png

 

so, if we wanted "DATA_SIZE" is greater than 0x500, which steps should I do ?

 

 

Regards,

Bryce

Labels (1)
0 Kudos
Reply
1 Solution
1,871 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

That's what I'm talking about - this demo code uses a lot of different IDs. Not just one. You need to modify the code to use just one unique ID.

The ID in the demo code is continuously incremented, so the flash block will be full after certain number of writes. And because the IDs are unique, the records can't be discarded and swapping can't be done. That's the nature of Emulated EEPROM.

pastedImage_1.png

Lukas

View solution in original post

8 Replies
1,871 Views
朱先生
Contributor III

Dear Lukas,

I only use one IDs. The data size of the IDs is 0x300 bytes.This IDs will write 100 times in on one Ignition cycle(Ignition on/off). In our project, there are three blocks ,each block has 0x4000 bytes. In my understanding, the write process is as below:

1. The first block is active, then the data will write from the start address(0x00800000). the actual data size is slightly greater than 0x300, After several write cycles, the first block is almost full filled,then it need to swap.

2. The second block will be active, the data will copy to the second block and third block and the first block will be erased. Next time the data will be written in the second block. Before this block is full filled, the write process doesn't need swapping.

3. All the process(writing and swapping) are handled by one function "FSL_WriteEeprom".

If the code run normally, it shouldn't return EE_ERROR_NO_ENOUGH_SPACE error.

But the error has occurred. I have no idea to handle this error. Could you help me to figure out this problem?

Regards,

Bryce

0 Kudos
Reply
1,871 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Could you share your project? I'm not able to say what's wrong without more details...

Lukas

0 Kudos
Reply
1,871 Views
朱先生
Contributor III

Dear Lukas,

The attachment is my demo code, Thanks for your help.

Regards,

Bryce

0 Kudos
Reply
1,872 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

That's what I'm talking about - this demo code uses a lot of different IDs. Not just one. You need to modify the code to use just one unique ID.

The ID in the demo code is continuously incremented, so the flash block will be full after certain number of writes. And because the IDs are unique, the records can't be discarded and swapping can't be done. That's the nature of Emulated EEPROM.

pastedImage_1.png

Lukas

1,871 Views
朱先生
Contributor III

Dear Lukas,

Thank you very much. You advise is very useful!

I forgot the ID would increase, so it could  cost so much memory. I modified the code, The return code of write function is "EE_OK".  Thanks again.

Regards,

Bryce

0 Kudos
Reply
1,871 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi,

Which device do you use? I guess it is MPC5604P, isn't it?

If you don't modify the demo code, it writes a lot of records with different IDs to flash. I don't know the demo code in detail but it seems that 40 records with unique ID is used. Because you have set the data size to 0x300, the flash is almost full after 40 writes and there's no space for swapping.

So, it works but you have to calculate how many IDs you can use.

Regards,

Lukas

0 Kudos
Reply
1,871 Views
朱先生
Contributor III

Dear Lukas,

My device is MPC5604B which flash is the same with MPC5604P.

In my setting, the EEE has three blocks, each block has 0x4000 bytes. If the DATA_SIZE is 0x300. 40 records may cost 0xC00 bytes. Assume there are some head information, the actual size will be greater than 0xC00 bytes, so it need to be swapping.

If there are no space for swapping, it should erase the suspend block then copy the current data into the new block.

I debug the demo code, I found if the DATA_SIZE equal to 0x40, it can swapping successfully. If the DATA_SIZE is 0x300, it didn't work. could you help me to config the EEE ? Thanks.

Regards,

Bryce

0 Kudos
Reply
1,871 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hello Bryce,

total size = data size * number of records = 0x300 * 40 = 0x7800

So, 40 unique records will occupy about two flash blocks. Plus we have to add size of record headers. That's simply too much and there's no space for swapping. Even if the size of all data is slightly less than 0x8000 (two blocks), each additional write would cause swapping. So, you will lose the advantage of emulation mechanism which should save the number of erase/write cycles.

To understand the mechanism, you can step the code to see the filling of data flash.

How many unique IDs / records do you need? Either decrease the number of IDs or use more flash blocks. There's no other solution.

Regards,

Lukas

0 Kudos
Reply