[FLASH] erase and program

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

[FLASH] erase and program

跳至解决方案
1,565 次查看
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

标签 (1)
0 项奖励
回复
1 解答
1,092 次查看
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 项奖励
回复
2 回复数
1,093 次查看
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 项奖励
回复
1,092 次查看
Pogo
Contributor III

Hi Kef,

Thanks a lot.

 

Regards,

Pogo

0 项奖励
回复