EEPROM emulation on S12XEP100

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

EEPROM emulation on S12XEP100

3,476 Views
gavryus
Contributor I
Hello to all,
 
I have to use the emulated EEPROM on S12XEP100, but I do not know how to partition an area of the D-Flash block.
Can anyboby give some ideas about this?
 
After an area of the D-Flash is partitioned, can it be changed?
 
Thank you! :smileyhappy: 
 
 
Labels (1)
0 Kudos
5 Replies

685 Views
Steve
NXP Employee
NXP Employee
You use the command Partition D-Flash in the FTM. With this command you specify how many D-Flash sectors and EEEPROM sectors you want. There is a minimum ratio for these.
Once the EEEPROM is available you can control its use with the other FTM commands but basically you write to the EE parts of the RAM buffer and it works like an EEPROM.
Depending on your silicon version there may be some important errata related to this function so check that out. Also note that the Partition command is only available in special modes.
You can repartition the D-flash but you will lose the contents when you do so. The command is really a "do once for the life of the application" type of operation.
0 Kudos

685 Views
Venumadhav
Contributor I
Hi Steve,
I am currently working on S12XE micro. I have to work on Emulated EEPROM and D-Flash Functionality of the MICRO.
 
Could any of you please provide me some sample code for accessing the D-Flash and EEE of S12XE. I have the bootloader example for accessing P-Flash but now i want to work on D-Flash Driver.
 
Early response is appreciated.
 
Thanks in advance.
 
Regards,
Venumadhav
0 Kudos

685 Views
dog
Contributor I

Hi,

The partition commands just follow the 'Generic Flash Command Write Sequence' command flow in the data book

1) ensure that the flash clock divider is written

2) check that CCIF flag is set

3) clear the ACCERR & PVIOL flags (do this as a single write, not bit modify operations)

4) write CCOBIX = 0

5) write the command ID to CCOBHI, 0x0F for full partition

6) write CCOBIX = 1

7) write the number of D-flash sectors you don't want to use for EEE (DFPART) to CCOB

8) write CCOBIX = 2

9) write the number of 128 word regions in the buffer RAM you want to use for EEE (DFPART) to CCOB

10) write 0x80 to FSTAT to clear the CCIF flag and launch the command

11) wait for CCIF to become set

12) check the command generated no errors (FSTAT == 0x80)

The partition sizes neet to meet the rules for DFPART and ERPART in the data book else you get an ACCERR flag.

And you really should monitor the FSTAT value following commands because the memory controller supports a lot of error checking and sometimes you launch a command and then wonder why nothing seemed to happen - for example, for most commands it checks that the CCOBIX points to the last CCOB parameter for that type of command and if it doesn't it tells you you got it wronf with an ACCERR. 

The Full Partition D-flash Command (ID 0x0F) will only run in special mode and erases the D-flash before partitioning.

The normal mode Partition D-flash Command (ID 0x20) is only on xM48H mask sets and will olny work if the D-flash is fully erased in special mode with an Erase All Blocks command. (FYI, the EEE Query command is also only on the xM48H masks too).

Once the EEE is partitioned then you can run the Enable EEE command and write data to the EEE RAM and it will get backed up to the EEE NVM partition. Enable EEE command also follows the generic command flow. You can see when the data has written to the D-Flash by checking that the ETAG register == 0x0000 and the MGBUSY flag in the FSTAT register is clear.

Once the D-flash is partitioned it cannot be repartitioned in normal mode – but it can in special mode using the Full Partition D-Flash command or using the Erase All Blocks command and then the partition D-flash command.

cheers,

Martyn

0 Kudos

685 Views
olgo2392
Contributor I
Hallo.

Sorry but i have the same problem. Is there any programming example or somethink else.
0 Kudos

685 Views
S12XE_newbie
Contributor I
Hello,
 
the EEE-Partition-Thing seems to be very difficult. Some sample code would be very nice :smileywink:
 
 
Nils
0 Kudos