From f0efff23f38bd9e0045a94bdf6b80755fe1cafb4 Mon Sep 17 00:00:00 2001 From: Abdessamad Raqioui Date: Wed, 17 Apr 2024 16:01:20 +0200 Subject: [PATCH] Fix: use delayed write flash page in AvrIspProtocol --- pyedbglib/protocols/avrispprotocol.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pyedbglib/protocols/avrispprotocol.py b/pyedbglib/protocols/avrispprotocol.py index dfa2f2d..9e574c1 100644 --- a/pyedbglib/protocols/avrispprotocol.py +++ b/pyedbglib/protocols/avrispprotocol.py @@ -264,7 +264,7 @@ def write_lockbits(self, data): command.extend(data) self._spi_cmd_resp(command) - def write_flash_page(self, byte_address, data): + def write_flash_page(self, byte_address, data, delay_ms = 5): """ Writes a page of flash @@ -277,8 +277,8 @@ def write_flash_page(self, byte_address, data): self.load_address(byte_address >> 1) command = bytearray([AvrIspProtocol.SPI_CMD_PROGRAM_FLASH]) command.extend(binary.pack_be16(len(data))) - command.extend([0x81]) # Page mode - command.extend([0]) # Not used + command.extend([0x91]) # Write page with timed delay + command.extend([delay_ms]) command.extend([AvrIspProtocol.AVR_LOAD_PAGE_COMMAND]) command.extend([AvrIspProtocol.AVR_WRITE_PAGE_COMMAND]) command.extend([0]) # Not used