Skip to content

Commit

Permalink
read_flash is unreliable
Browse files Browse the repository at this point in the history
When I tried to make a function that verified flash, it worked only 50% to have a correct page readout. Because the code only checks if the response is from the correct add, but not the correct part, it confuses the packets and add garbage in between.

change sponsored by stagebees.com
  • Loading branch information
dolfje authored Mar 30, 2024
1 parent a77b402 commit 6d410bb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cflib/bootloader/cloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ def read_flash(self, addr=0xFF, page=0x00):
pk = None
retry_counter = 5
while ((not pk or pk.header != 0xFF or
struct.unpack('<BB', pk.data[0:2]) != (addr, 0x1C)) and
struct.unpack('<BBHH', pk.data[0:6]) != (addr, 0x1C, page, (i * 25))) and
retry_counter >= 0):
pk = CRTPPacket()
pk.set_header(0xFF, 0xFF)
Expand Down

0 comments on commit 6d410bb

Please sign in to comment.