I'm working with "SimpleCortex" board, and have been stumbling on an issue with flash programming using the IAP functions. Basic implementation of flash write/erase is very straight forward; however, there are times when I need to just clear (write) one bit (changing it from a '1' to a '0') while leaving all other bits within a 256-byte range unchanged. I assume I am allowed to do this, as long as I read in the 256-byte block to ram, make the single-bit change, and then write that block back to the flash. Is this a valid assumption?
If it is, then more information on how I reproduce this problem is found here:
<a href="http://www.brc-electronics.nl/component/kunena/5-Programming-and-software/565-flash-programming-prob...">http://www.brc-electronics.nl/component/kunena/5-Programming-and-software/565-flash-programming-prob...</a>
Sure would be nice if someone could tell me what I'm doing wrong. This problem appears to be VERY data dependent; hence the reason for my use of what appears to be a random block of data (its not actually random, but its what I was using when I noticed the problem).
Thanks for any ideas!
Ok, I think I have the explanation. NXP tech support pointed me to this appnote which explains the problem:
http://www.lpcware.com/content/nxpfile/an11008-flash-based-non-volatile-storage-software
Bottom line: you can't treat this flash like typical NOR flash. It has some limitations.
I do erase the flash initially. The difference between what I'm trying to do and what I see is typically done in the examlpes I've seen is that I want to be able to clear a bit within a block of flash that I've previously written. This is a very typical operation with normal flash devices. With normal NOR flash, it is legal to write a bit from 1 to 0 regardless of the state of the surrounding bits. The limitation is that if I want to change the bit from 0 to 1, then I need to erase the entire sector to do that.
In my case, I simply want to be able to do what normal flash allows me to do. Is there any data sheet that describes the capability of the internal flash for these devices? Typically, all I see is the IAP command interface. I'd like to be able to read exactly what this internal flash is capable of.
Thanks for your help,
Ed
Hi edsut,
You need to erase sector before programming it. I am not sure if you are doing it. Please go through following link to better understand it.
<a href="http://lpcware.com/content/nxpfile/an10866-lpc1700-secondary-usb-bootloader">http://lpcware.com/content/nxpfile/an10866-lpc1700-secondary-usb-bootloader</a>
Thanks,
NXP Support