Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: use delayed write flash page in AvrIspProtocol #6

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pyedbglib/protocols/avrispprotocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down