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); // 验证FlashROM数据块,最小块为dword if (err) { FLASH_ROM_READ(current_location_addr, buff, 8); PRINT_HEX("写入数据", (uint8_t *)bat_history, 8); PRINT_HEX("读到的数据", (uint8_t *)buff, 8); }
上面是我的示例代码,
我写入的数据是{F1 08 10 00 00 02 10 48},通过
FLASH_ROM_VERIFY()
验证失败
然后把Flash里的数据读取出来,{51 08 10 00 00 02 10 48}
发现经常会有一个字节错误.
是什么原因造成的?Flash写入太频繁(我大概是2分钟写入一次,8/12字节)