uint8_t?buff[8]?=?{0}; uint8_t?bat_history[8]?=?{0xF1,?0x08,?0x10,?0x00,?0x00,?0x02,?0x10,?0x48}; FLASH_ROM_WRITE(current_location_addr,?(uint8_t?*)bat_history,?8);?//?寫入到Flash err?=?FLASH_ROM_VERIFY(current_location_addr,?(uint8_t?*)bat_history,?8);?//?驗(yàn)證FlashROM數(shù)據(jù)塊,最小塊為dword if?(err) { ????FLASH_ROM_READ(current_location_addr,?buff,?8); ????PRINT_HEX("寫入數(shù)據(jù)",?(uint8_t?*)bat_history,?8); ????PRINT_HEX("讀到的數(shù)據(jù)",?(uint8_t?*)buff,?8); }
上面是我的示例代碼,
我寫入的數(shù)據(jù)是{F1 08 10 00 00 02 10 48},通過
FLASH_ROM_VERIFY()
驗(yàn)證失敗
然后把Flash里的數(shù)據(jù)讀取出來,{51 08 10 00 00 02 10 48}
發(fā)現(xiàn)經(jīng)常會(huì)有一個(gè)字節(jié)錯(cuò)誤.
是什么原因造成的?Flash寫入太頻繁(我大概是2分鐘寫入一次,8/12字節(jié))