Flash erase byte routine


Closed Thread
Results 1 to 21 of 21

Hybrid View

  1. #1
    Join Date
    Feb 2012
    Location
    PERTH AUSTRALIA
    Posts
    838


    Did you find this post helpful? Yes | No

    Default Re: Flash erase byte routine

    yep steve i was thing something like this

    1. erase sector 0

    2 write the changed bytes to sector 0 for page / byte /length data

    3. using the address and number of byte to change length( assumes 1- 256 bytes contiguous) get the all OTHER pages/ bytes in orginal sector and write to sector 0

    so need to find value of entered page address and read into the buffer (256kb) , then write
    a. input page + 1 (data above the input page) for next loop 1 -
    b. input page -1 ( data below the input page) for next loop 2
    c. allow for input page location = 0 or 255 - so for next loop 1 only

    this then copy of all pages EXCEPT that which need to change
    If the input length was 255 then sector 0 has copy of the completed changed data

    if length <255 bytes change then

    then use the input length and byte start address value to read / write
    a. read bytes start address + length + 1 - for next loop1 - ( read the bytes above that dont need to change)
    b. read bytes start address + length - 1 - for next loop2 - ( read the bytes below that dont need to change)
    c. allow for input bytes location + length of 0 or 255 - so for next loop 1 only

    this then copy of all bytes except that which have been changed

    now do a sector erase of the orginal sector

    now read/ write each page back from sector 0 each page


    not easy but as hedric said the smaller the sector erase size the less time it takes

  2. #2
    Join Date
    Apr 2011
    Location
    Welches, Oregon
    Posts
    198


    Did you find this post helpful? Yes | No

    Default Re: Flash erase byte routine

    Sorry to interrupt... I'm just following along for the sake of understanding how this is managed.

    Do I read you right? Using sector 0 as a scratchpad? Reading X sector to 0 WITH changes, then erasing X sector, then writing sector 0 to X? Finally, erasing sector 0, so its blank for the next go-round? Or did I miss something?

    I think I'll read your post a few more times... see if I can't follow your thinking better. Thanks.

Similar Threads

  1. Erase error
    By waynepauly in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 29th June 2012, 02:23
  2. Internal eeprom - erase block
    By ruijc in forum mel PIC BASIC Pro
    Replies: 32
    Last Post: - 13th February 2008, 11:11
  3. 18F2431 won't program or erase.
    By HenrikOlsson in forum mel PIC BASIC Pro
    Replies: 24
    Last Post: - 28th September 2006, 07:55
  4. 12F675 won't reprogram or erase
    By modifyit in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 19th May 2006, 05:07
  5. 12F629 won't erase and bandgap save?
    By Keith55555 in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 6th April 2004, 01:28

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts