Alex Robinson

M5213EVB - having a hard time flash programming

Discussion created by Alex Robinson on Jul 13, 2007
Latest reply on Jul 13, 2007 by Paul McConkey
Running a RAM-based program under Code Warrior, I can't seem to get the CFM logic to work.

All the CFM registers (e.g. CFMPROT, SACC, DACC) are zeroed or have what seem like very friendly values, where appropriate.

The eval board has a system clock of 48mhz, so the CFMCLKD is 0xce (scaled by 8, divided by 15 (0xe + 1)).

First problem:

Example code and tortured reading of the "documentation" seems to indicate that one would, say, check whether the flash is erased or not by doing something like this:

        *((uint32 *) 0x1000)           = 0xFFFFffffLU;

        MCF_CFM_CFMCMD       = MCF_CFM_CFMCMD_RDARY1; // _RDARY1 is 0x5

Then wait for the CBEIF and CCIF bits to come high and see whether the BLANK bit is high (at any time).

With a completely erased flash, the BLANK bit never comes high. In fact, using similar logic to erase the flash or to program a word in the flash seems to have no effect on the flash.

Second problem:

That assignment statement to the flash memory causes a bus error. An rte interrupt handler seems to stop the fuss, but you gotta wonder. :smileyhappy:

So, I'm kinda out of ideas, here. Can anyone help with this?