CH573F的FLASH操作,每次寫入一個字節(jié),都會引起山區(qū)擦除么?

測試代碼如下:

const uint32_t test_buf=0x30000-0x1000;

uint32_t *p;
??? printf("Erase...\n");
??????? FLASH_ROM_ERASE(test_buf, 4096);
??????? p=(uint32_t*)test_buf;
??????????????? printf("%8X,",*p); p++;
??????????????? printf("%8X,",*p); p++;
??????????????? printf("%8X,",*p); p++;
??????????????? printf("%8X,",*p); p++;
??????????????? printf("%8X,",*p); p++;
??????????????? printf("%8X,",*p); p++;
??????????????? printf("%8X,",*p); p++;
??????????????? printf("%8X,",*p); p++;
??????????????? printf("\n");

??? p=(uint32_t*)test_buf;
??? printf("write:\n");
??? p=(uint32_t*)test_buf;
??? dat=1;FLASH_ROM_WRITE((uint32_t)p,&dat,4);p++;
??? dat=2;FLASH_ROM_WRITE((uint32_t)p,&dat,4);p++;
??? dat=4;FLASH_ROM_WRITE((uint32_t)p,&dat,4);p++;
??? dat=8;FLASH_ROM_WRITE((uint32_t)p,&dat,4);p++;
??? dat=0x10;FLASH_ROM_WRITE((uint32_t)p,&dat,4);p++;
??? p=(uint32_t*)test_buf;
??????? printf("%8X,",*p); p++;
??????? printf("%8X,",*p); p++;
??????? printf("%8X,",*p); p++;
??????? printf("%8X,",*p); p++;
??????? printf("%8X,",*p); p++;
??????? printf("%8X,",*p); p++;
??????? printf("%8X,",*p); p++;
??????? printf("%8X,",*p); p++;
??????? printf("\n");
??? printf("write2:\n");
??? p=(uint32_t*)test_buf;
??? dat=2;FLASH_ROM_WRITE((uint32_t)p,&dat,4);p++;
??? dat=4;FLASH_ROM_WRITE((uint32_t)p,&dat,4);p++;
??? dat=8;FLASH_ROM_WRITE((uint32_t)p,&dat,4);p++;
??? dat=0x10;FLASH_ROM_WRITE((uint32_t)p,&dat,4);p++;
??? dat=0x20;FLASH_ROM_WRITE((uint32_t)p,&dat,4);p++;
??? p=(uint32_t*)test_buf;
??????? printf("%8X,",*p); p++;
??????? printf("%8X,",*p); p++;
??????? printf("%8X,",*p); p++;
??????? printf("%8X,",*p); p++;
??????? printf("%8X,",*p); p++;
??????? printf("%8X,",*p); p++;
??????? printf("%8X,",*p); p++;
??????? printf("%8X,",*p); p++;
??????? printf("\n");

結(jié)果打印:

Erase...
F5F9BDA9,F5F9BDA9,F5F9BDA9,F5F9BDA9,F5F9BDA9,F5F9BDA9,F5F9BDA9,F5F9BDA9,
write:
?????? 1,?????? 2,?????? 4,?????? 8,????? 10,F5F9BDA9,F5F9BDA9,F5F9BDA9,
write2:
?????? 2,?????? 4,?????? 8,????? 10,????? 20,F5F9BDA9,F5F9BDA9,F5F9BDA9,


為什么flash擦除后讀取到的不是0xffffffff而是F5F9BDA9 ?燒錄EVT的示例代碼也是這個結(jié)果,反而EEPROM_READ操作可以讀到0xFFFFFFFF。

連續(xù)兩次寫入相同地址后,并沒有相與的效果,貌似做了擦除后重新寫入的,這樣每寫一個字節(jié)就扇區(qū)擦除一次是否會縮短壽命?



因為Flash是加擾的,只擦以后,flash實際是0xffffffff,但是經(jīng)過內(nèi)核加擾讀出來是0xF5F9BDA9,目的是為了防止flash內(nèi)容被簡單讀取。造成固件被盜取。flash可以校驗。
dataflash是不加擾的


只有登錄才能回復(fù),可以選擇微信賬號登錄

国产91精品新入口,国产成人综合网在线播放,九热这里只有精品,本道在线观看,美女视频a美女视频,韩国美女激情视频,日本美女pvp视频