This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Flash proramming

I am trying to use flash memory to store one byte of data in a P89LPC922 and am using a EPM900 to debug my application. The map file shows that the address I am using is not used by my application code. My flash programming function (taken from the device users manual) is: -

EA = 0; // interrupts not allowed
FMCON = 0x00; // load command
FMADRH = 0x01; // 1K sector address
FMADRL = Addr; // address (0) within sector
FMDATA = Value; // 1 byte to write
FMCON = 0x68; // erase and program
EA = 1; // reinstate interrupts

Nothing is written, although I can change the contents using the memory window in the Debugger. When I put a break point on the last line of the above code and read the FMCON register the SV flag is set (Security Violation). All Sector Security bytes are set to zero.
Is my code wrong or is this not possible when using the EPM900? If this is the case, how can I debug my application?

0