From 52163b081ad92c24b0fdbfad8db76378565759b7 Mon Sep 17 00:00:00 2001 From: RetiredWizard Date: Fri, 18 Nov 2022 17:35:11 -0500 Subject: [PATCH] Fix for occasional write hangs I believe the write hangs were happening because the SD card wasn't ready for the end block write command. This adds a _wait_for_ready call before the command is sent. --- adafruit_sdcard.py | 1 + 1 file changed, 1 insertion(+) diff --git a/adafruit_sdcard.py b/adafruit_sdcard.py index 72afd8e..4affd7c 100644 --- a/adafruit_sdcard.py +++ b/adafruit_sdcard.py @@ -500,6 +500,7 @@ def writeblocks(self, start_block: int, buf: ReadableBuffer) -> int: ) offset += 512 nblocks -= 1 + self._wait_for_ready(card) self._cmd_nodata(card, _TOKEN_STOP_TRAN, 0x0) return 0