WestfW/OptiLoader

Lock fuse bit programming

Opened this issue · 0 comments

Setting a higher security in lock fuse bits doesn't allow to set a lower security value without a complete memory wipe (which resets them automatically), so setting programming fuses before programming isn't necessary (the if (!target_progfuses()) on line 148), unless other fuses change apart from the lock fuse.

But the actual problem is the writing of the lock bits: you're sending 0xAC, 0xE0, 0x00 and then the lock fuse, but the datasheet says that when writing the lock bits the 2 most significant bits of the sent data should be 1, this is quite dangerous as it doesn't write the right lock bits.

The fix is on line 519:
Replace: Serial.print(spi_transaction(0xAC, 0xE0, 0x00, f), HEX);
With: Serial.print(spi_transaction(0xAC, 0xE0, 0x00, 0xFF & f), HEX);