View previous topic :: View next topic |
Author |
Message |
lor3nzo
Joined: 19 Jan 2014 Posts: 4
|
flash variable erased |
Posted: Tue Feb 10, 2015 12:33 pm |
|
|
I reserved a small flash area of a 18f45k22 to save some variables.
A device returned with this area erased.
How is this possible ? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19587
|
|
Posted: Tue Feb 10, 2015 1:25 pm |
|
|
as an 'add on' to the threads suggested by PCM_programmer, if you are 'reserving a small flash area to save some variables', have you studied how this has to be done. Flash is _not_ like EEPROM. You can't just write a byte. To change one byte, you have to read an entire _page_ (64bytes on this chip), change the single byte you want to modify, and write the whole page back. A write to the first byte of a page, _will_ erase the whole page. |
|
|
lor3nzo
Joined: 19 Jan 2014 Posts: 4
|
|
Posted: Tue Feb 10, 2015 5:23 pm |
|
|
When flash erase size is equal to flash write size, bytes outside the range of the write block are not changed. Is this true? |
|
|
|