David Suelzle

Writing to flash memory on MCF 5235

Discussion created by David Suelzle on Mar 19, 2010
Latest reply on Mar 24, 2010 by stzari



I'm relatively new to coldfire microprocessors and I am attempting to write a single byte of data to the flash memory on the 5235 evaluation board. The flash memory device on my board is the M29W160EB. I have consulted the data sheet for the flash memory and it is possible to write a byte of data by issuing the following sequence of write commands:


Address             Data

555                      AA

2AA                      55

555                      A0

PA                        PD                      where PA is the address to write to and PD is the data to write


I thought this would be straight forward to implement, but I can't seem to get it to work. I am working with the CodeWarrior IDE  which includes a basic hello world application specifically for the 5235evb which I am attempting to modify to accomplish my flash write. The base memory address of the flash is 0xFFE00000. I am running my code from external RAM. Here is the c code that I thought would accomplish the job:


vuint8 *faddr;


int main(void)


          faddr = (vuint8*)0xFFE00555;

          *faddr = 0xAA;

          faddr = (vuint8*)0xFFE002AA;

          *faddr = 0x55;

          faddr = (vuint8*)0xFFE00555;

          *faddr = 0xA0;

          faddr = (vuint8*)0xFFE00000; /* Write some byte to some address*/

          *faddr = 0x11;



I've played around with the wait state value in the Chip Select Control Register as I was concerned that it may be a timing issue but I have not had success with that. Also, I would have thought that this would be configured properly by default.


Anyway, if someone can shed some light on what I am doing wrong and steer me in the write direction (haha) I would really appreciate it.