feat(espefuse): Added check for correctness of written data

This commit is contained in:
Konstantin Kondrashov
2024-01-26 20:32:09 +02:00
committed by Radim Karniš
parent 3d55c74efd
commit d2bfaadfe4

View File

@@ -228,13 +228,14 @@ class EfuseBlockBase(EfuseProtectBase):
return [self.parent.read_reg(offs) for offs in get_offsets(self)]
def read(self):
def read(self, print_info=True):
words = self.get_words()
data = BitArray()
for word in reversed(words):
data.append("uint:32=%d" % word)
self.bitarray.overwrite(data, pos=0)
self.print_block(self.bitarray, "read_regs")
if print_info:
self.print_block(self.bitarray, "read_regs")
def print_block(self, bit_string, comment, debug=False):
if self.parent.debug or debug:
@@ -386,6 +387,18 @@ class EfuseBlockBase(EfuseProtectBase):
)
break
if not self.fail and self.num_errors == 0:
self.read(print_info=False)
if self.wr_bitarray & self.bitarray != self.wr_bitarray:
# if the required bits are not set then we need to re-burn it again.
if burns < 2:
print(
f"\nRepeat burning BLOCK{self.id} (#{burns + 2}) because not all bits were set"
)
continue
else:
print(
f"\nAfter {burns + 1} attempts, the required data was not set to BLOCK{self.id}"
)
break
def burn(self):