EVB9S12XEP100 Bootloader project -- EPROM/D-FLASH

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

EVB9S12XEP100 Bootloader project -- EPROM/D-FLASH

4,581 Views
Pedrito
Contributor I

Dear Sir/Madam

I am working on a Bootloader project for Ford, and I can not handle the EPROM/D-FLASH.

I use codewarrior 4.5, and a EVB9S12XEP100 EVB. I have had no problem with the common P-Flash but I cannot read/erase/write the D-Flash only can read 4k EEEPROM (at FC0800-FC0BFF,FD..,FE..,FF..) with the debugger. Can You please send me the address list where I can reach EEPROM and D-Flash with the debugger?

I have to erase and download in D-Flash but I cannot even enable D-flash, I always get access error.

The init code:
/* EEE IFR visible in the memory map */
MMCCTL1 |= EEEIFRO;
/* Clear error flags */
FSTAT |= (PVIOL | ACCERR);
/* Enable D-Flash */
FCCOBIX = 0;
FCCOBHI = ENABLE_D_FLASH; //0x0f
FCCOBLO = 0;
FCCOBIX = 1;
FCCOB = D_FLASH_SIZE_32K; //128
FCCOBIX = 2;
FCCOB = (uint16)0;
FSTAT |= CCIF;
/* until finished or error occured */
while(((FSTAT & (PVIOL | ACCERR))==0) && ((FSTAT & CCIF) == 0))
{}

Can You please send me an application note about D-Flash and EEPROM handling?

Regards,
Peter Laczko
Embedded Software Engineer
Mentor Graphics
Automotive Networking Business Unit
Montevideo u. 2/C
H-1037 Budapest
HUNGARY

Alban changed subject

Message Edited by Alban on 2007-02-02 07:49 PM

Labels (1)
0 Kudos
Reply
2 Replies

1,938 Views
dog
Contributor I
Hi Peter,
 
Several points -
 
1) I recommend always following Generic Flash Command Write Sequence Flow in the data book as a MUST else you can be violating the spec for the part.
 
2) I suspect that, apart from mybe not having set FCLKDIV and not checking CCIF == 1 (both of which are checked in the Generic Flash Command Write Sequence Flow), one of your problems is certainly coming from the '|=' in this line
 
FSTAT |= (PVIOL | ACCERR);
 
the OR-EQUALS is a read modify write operation which is a real hazzard on any registers containing 'write 1' to clear flags and an absolute MUST NOT DO especially on the FSTAT register. Here's what it does
 
a) reads the FSTAT register (CCIF will probably be 1, or at least it should be if you are trying to execute an FTM command (and you should be checking))
 
b) OR's (PVIOL|ACCERR) with it  - NOTE you now have at least CCIF set in this intermediate result
 
c) writes the result back to FSTAT
 
and writing a 1 to the CCIF bit launches the FTM command !!!!!!!!!!
 
So you should use FSTAT = (PVIOL | ACCERR);
Same goes for FSTAT |= CCIF, probably won't cause any probelms in fact but better practice to just use FSTAT = CCIF. 
 
3) FYI, the ENABLE_D_FLASH command was renamed to FULL_PARTITION_DFLASH some time ago - make sure you have the latest data book from the Freescale web.
 
4) Also, I would recommend leaving the MMCCTL1 register at it's default -no need to enable the IFR visibility at all.
 
5) Something else to watch out for if you are debugging programming the Flash in CodeWarrior and want to see the value change:
 
In your cable menu you'll find a option called Debugging Memory Map (or similar)
 
double click on global 00100000-0013FFFF global eeprom and make sure 'refresh memory when halting' is set (by default it isn't) 
 
this will result in the D-Flash changes being updated in the memory window. 
 
6) An EEE ApNote will be available on the web site shortly. 
 
cheers,
dog
0 Kudos
Reply

1,938 Views
Steve
NXP Employee
NXP Employee
There are currently two main sources of information about the emulated EEPROM and D-Flash. Firstly, the Reference Manual and AN3242. The EEPROM system on the EP100 is an emulated EEPROM system which you must configure before using it. Depending on how you configure the EEPROM you may or may not have D-Flash available too.
As far as I can understand your code you are attempting to use the part with no EEPROM.
Line by line:
The IFR and the D-Flash are two different things - it's unlikely you will want to see the IFR.
I don't see you writing to FCLKDIV but since the P-Flash works I expect that you are doing this elsewhere.
The CCOB command will configure the part not to use EEPROM but it must be executed in a special mode (see the Functional Description section in the flash chapter). If you execute it in normal mode it will not work. Also this is an execute once command - it is like partitioning a hard disk. You can partition again but you will lose all the contents of your D-Flash.
D-Flash is in the memory map at 0x100000 and you access it via global memory or in local memory using the EPAGE.
0 Kudos
Reply