Hi guys ,
i am trying to do a erase byte routine for flash
The FLASH as i have learned is not the same as EEProm in that you cant just change bytes values as you may like to on the fly , changing byte to $FF requires your do a complete sector erase , depending on the chip and the size the sector erase can range from 4k bytes to 64k bytes at a time.
chip i am currently using has a sector erase of 64k bytes
I would like to have a routine that allows for a byte changes 1 to 256bytes at a time on the same sector/ page/ byte.
the current routine inputs give the 24bit start address , length of data of the bytes to be changed , and the data in the buffer
for easy naming i have broken the 24bit address in to 3 bytes named , sector/page/bytes for the 8mb chip i am working on sector size is 0-15, pages = 0-255,bytes = 0-255
method of approach i have is
1. erase temp swap sector 0
2. copy all data of sector/page/bytes to sector 0 EXCEPT the bytes that are to be changed
3. write the new bytes to correct location in sector 0
4. erase original sector
5. copy sector 0 to orginal sector
sounds simple , the only problem i have is item 2
whats a good approach
cheers
Sheldon
Bookmarks