clear flash on factory reset
unlock and lock eeprom before erase and write
clear pending flags\!