[update] fix error for reading spi(7000bytes)

This commit is contained in:
Roy
2022-03-15 15:18:52 +08:00
parent 1a3a833680
commit 184c7536a6
+27
View File
@@ -167,6 +167,29 @@ class MultiExtMemSpiInterface(LowLevelHardwareInterface):
print("read red data times", self._read_red_times)
return data
def _print_ram_all_data(self):
addr = 0
red_length = int(7000 / 2)
tx_temp = [0] * red_length
while True:
tx_temp[0] = MEM_INS_READ
tx_temp[1] = ((addr >> 8) & 0xFF)
tx_temp[2] = (addr & 0xFF)
ram_data = []
ram_data = self._spi.send_byte(tx_temp)
ram_data[0:3] = [255, 255, 255]
print(list(ram_data), len(ram_data), addr)
addr += len(ram_data) - 3
if (7000 < addr + len(ram_data)):
del ram_data
break
print()
return
def recv_memory(self, device: int) -> Optional[bytes]:
self.pin_busy.output(False)
@@ -261,6 +284,9 @@ class MultiExtMemSpiInterface(LowLevelHardwareInterface):
print("length < 12")
print("green data print:", data, device, datetime.now())
if length == 0:
self._print_ram_all_data()
return None
if green_data_section[2] != 0xA5 or green_data_section[3] != 0x5A:
@@ -276,6 +302,7 @@ class MultiExtMemSpiInterface(LowLevelHardwareInterface):
if (header != 255):
flag_print = True
print("green data: header is not 255: ", header)
self._print_ram_all_data()
if (elite_data_len != self._elite_data_len):
flag_print = True