Erasing and writing to the MC9S12XS128 D-Flash

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

Erasing and writing to the MC9S12XS128 D-Flash

1,475 次查看
aceshigh
Contributor I

Quick question:

I'm setting up my data flash write routines for the MC9S12XS128 MCU.  From my understanding, any location in the data flash that is to be written to must first be in the erase state (0xFF) or an error occurs.

 

It appears that the absolute minimum amount of data flash that can be erased is a single sector (256 bytes) using the Erase D-Flash Sector command (0x12), while the maximum number of words that can be written to is 4 using the Program D-Flash command (0x11).

 

This seems inefficient, given that if I need to simply write to a single word-length parameter in my data flash, I need to first erase 256 bytes of flash at a minimum while making sure all the data I've just erased is saved, and then RE-WRITE all the data I just erased just to update one word.

 

Is my understanding of how the data flash works correct, or is there a more efficient way to erase/write (erase a single word perhaps?).

 

Thanks in advance.

标签 (1)
0 项奖励
回复
1 回复

463 次查看
Lundin
Senior Contributor IV
Yes you understand it correctly - it is very inefficient. This is a major weakness with most new Freescale MCUs. They used to come with EEPROM (or emulated EEPROM) that only needed a few cells erased, but for reasons unknown Freescale stopped using it. The new "data flash" in the latest S12X seems to solve nothing of this, it is roughly the same crap still.

The solution is to use the old S12D family (without X), the new S08D family or to look at the competition.

0 项奖励
回复