EEPROM in MC9S12XEQ512 - How to configure and access read/write in EEPROM

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

EEPROM in MC9S12XEQ512 - How to configure and access read/write in EEPROM

2,533 Views
Vicky
Contributor I
Hi,
I'm using MC9S12XEQ512 variant which has 4k of EEPROM. Now, I'm not getting clear picture here, how to configure and perform read/write opertions in EEPROM.

PS:
We are migrating from MC9S12XDP512 to MC9S12XEQ512. Since earlier version had dedicated EEPROM module and set of registers to access the same, here, in new variant story is different. It would be great if any one can help in clarify my questions:

Questions:
1. In section 3.1 of the S12XD and S12XE compatibility document, it seems very easy to access EEPROM since it is emulated as RAM of same size 4K. my question here is,
       1.1. How I have to read content from EEPROM?
       1.2. How I have to write the contents in EEPROM. Do I have to wait for message for write success?
       1.3. Where to mention the address for read/write (if any) -?

2.  Is there any difference between D-Flash and EEE? Do i have to worry about whether its D-Flash or EEE when writing in EEE.

May be my question seems to be awkward. I have used previous versions of EEPROM, where we have complete set of registers. we know, how and when to read/write in EEPROM.

It would be great if you any one can help in resolving the same.

Regards
Vignesh
Labels (1)
0 Kudos
2 Replies

652 Views
NLFSJ
Contributor III
Hi Vicky,
 
I know that our engineering team responded to you directly via email, but I will post their reply in the forum for the rest of the public.
 
Most of your questions regarding S12XE EEEPROM will be answered by application note AN3490:

http://www.freescale.com/files/microcontrollers/doc/app_note/AN3490.pdf

Some notes:

Flash:

The algorithm of writing to flash is different comparing to S12XD. The S12XE flash module provides ECC

Error Correction Code that can resolve single bit fault and that can detect double bit fault. The ECC implementation requires that programming can be done on an aligned 8 byte basis (so called phrase). It’s very simple we just have to write flash command, global address and data to appropriate registers and then launch the command.  EEPROM:

There are two ways how to access the EEPROM:

- Direct access to Data Flash. The algorithm is very similar to writing to flash (described above). The disadvantage is that the erase sector is 256 bytes (the sector size of S12XD is 4 bytes). 

- Using of Emulated EEPROM (S12XS doesn’t have this feature). In short - there’s a "Buffer RAM" which behaves like EEPROM

the internal mechanism copies the data from Data Flash to Buffer RAM after reset and stores data written to Buffer RAM to Data Flash. The user doesn’t care about this operation, just the initialization of Emulated EEPROM is necessary.

Regards,
Nina

0 Kudos

652 Views
Vicky
Contributor I
Hi,
Yup, I got support from team. however, I stuck with some more issues. So, i mailed them back with my questions which is below. I dont know if others encountered similar issues with EEPROM.
---------
I tried both options.. Dflash option worked for me, however, I would like to use EEE option due to Project requirement.
 
For D-Flash:
1. I Understand that, Writing the data in D-Flash uses FCCOBIX register and maximum value of FCCOBIX can be 8. This means, I can not write data more than 16bytes in single attempt. Please confirm it...?
 
For EEE:
1. Above limitation of D-Flash is not there. Please confirm it...?
 
Issues facing in Configuring EEE Option:
1. In Start-up I'm trying to perform DFlash partition to support EEE by DFPART = 0 and ERPART = 16. But, if I read the respective registers 0x12_0000 and 0x12_0004, Partition value is not changed.
 
I assume that, since partition is not correct, my EEE option is not working. Please see below for my pesudo code.
 
Psueudo code:
1. Check if EEE parition is done or not.
2. If not, partition the Dflash for EEE.
3. If partition is successful, address in 0x120000 is updated accordingly.
 
   eee_partition_stat_dfpart is read from 0x12_0000 and eee_partition_stat_erpart is read from 0x12_0004.
 
   if( (eee_partition_stat_dfpart != 0) || (eee_partition_stat_erpart != 16) )
   {
       DFlash_Partitiion(0, 16);
       /* Enable EEE for usage by application */
       EmulatedEE_Enable();
       part_executed = TRUE;
    }

 
Kindly let  me know, if I have missed something or performing wrong operations. It is urgent and Important.
0 Kudos