[FLASH] erase and program

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

[FLASH] erase and program

Jump to solution
1,080 Views
Pogo
Contributor III

Hi,

I've one question about erase and program Flash. When I erased one sector(1K) on FLASH, but I didn't program one sector and just program 8 bytes. If I read those non-program data, it will return what data? keep data before erased or can't be read?

If the answer is it can't be read. That's mean that if I want to write only 8 bytes data to FLASH, I still need to erase one sector and program one sector. Or the non-program part can't be read. Is it right?

 

Regards,

Pogo

Labels (1)
0 Kudos
Reply
1 Solution
607 Views
kef
Specialist I

After erase you should see all ones, each bit of flash in erased sector should read as =1. Each byte in flash sector should read as =0xFF. Old data is lost. Yes, to reprogram just 8 bytes you need to erase whole sector.

 

Maybe CW debugger confused you? For faster operation this debugger by default caches contents of NV memory and doesn't update it from flash, EEPROM etc. It may look as if data didn't change after erase. You may change this behaviour going to Multilink->Debugging memory map menu and checking update-on-halt checkboxes to make debugger updating data from MCU memory.

View solution in original post

0 Kudos
Reply
2 Replies
608 Views
kef
Specialist I

After erase you should see all ones, each bit of flash in erased sector should read as =1. Each byte in flash sector should read as =0xFF. Old data is lost. Yes, to reprogram just 8 bytes you need to erase whole sector.

 

Maybe CW debugger confused you? For faster operation this debugger by default caches contents of NV memory and doesn't update it from flash, EEPROM etc. It may look as if data didn't change after erase. You may change this behaviour going to Multilink->Debugging memory map menu and checking update-on-halt checkboxes to make debugger updating data from MCU memory.

0 Kudos
Reply
607 Views
Pogo
Contributor III

Hi Kef,

Thanks a lot.

 

Regards,

Pogo

0 Kudos
Reply