S12XE EEPROM Emulation query command

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

S12XE EEPROM Emulation query command

1,335 Views
jsmcortina
Contributor III
Ok,
I've got my application and a port of the monitor code running on the S12XE and have D-flash partitioned and programmed. However I cannot understand the datasheet on the emulation query command.

It says:
The EEPROM Emulation Query command returns EEE partition and status variables.
            Table 24-73. EEPROM Emulation Query Command FCCOB Requirements
                CCOBIX[2:0]                   FCCOB Parameters
                    000               0x15                      Not required
                    001                         Return DFPART
                    010                         Return ERPART
                                               Return ECOUNT1
                    011
                    100      Return Dead Sector Count    Return Ready Sector Count

Upon clearing CCIF to launch the EEPROM Emulation Query command, the CCIF flag will set after the
EEE partition and status variables are stored in the FCCOBIX register.If the Emulation Query command
is executed prior to partitioning (Partition D-Flash Command Section 24.4.2.14), the following reset
values are returned: DFPART = 0x_FFFF, ERPART = 0x_FFFF, ECOUNT = 0x_FFFF, Dead Sector
Count = 0x_00, Ready Sector Count = 0x_00.


But also it says:
Register Error Bit                                 Error Condition
                   Set if CCOBIX[2:0] != 000 at command launch
         ACCERR
                   Set if command not available in current mode (see Table 24-30)

I'm not understanding this, how do I set FCCOBIX to anything other than zero without getting ACCERR

I want to read DFPART in the monitor to determine whether to do a d-flash partition or erase all d-flash sectors.
Reading from 0x12_0000/0x12_0001 which is supposed to be DFPART yields zero when I was expecting 0x80

The d-flash seems to work correctly from my application, but I'm not getting a complete write from the monitor code and need to ensure I have it initialised correctly.

Has anyone got a code example?

James
Labels (1)
0 Kudos
1 Reply

266 Views
Pedro_
Contributor III
One of the conditions for the Emulation Query command to execute is to have the CCOB index register set to zero. You will notice that other commands require the index register to be within certain range to execute.
 
You have to make sure then that the value of FCCOBIX is zero by the time you launch the command.
 
FCCOBIX = 0;
FCCOB = 0x1500; /* Emulation Query */
FSTAT = 0x80 /* Launch command */
 
You can read the results stored in the indexed CCOB registers
 
while ( !(FSTAT & 0x80) ); /* wait for command to complete */
 
FCCOBIX = 1;
DfpartVal = FCCOB;
 
FCCOBIX = 2;
ErpartVal = FCCOB;
 
I hope it helps
 
 
 


Message Edited by Pedro_ on 2008-10-24 02:02 PM
0 Kudos