瀏覽代碼

RP2040 SDIO: Increase stopTransmission timeout.

Some cards were taking longer to respond after a large amount of writes.

While reviewing SDIO spec, it appears that this should
actually be using "Stop Tran token" instead of "Stop Transmission command".
It appears to work well so far though so only made the minimal timeout change.
Petteri Aimonen 2 年之前
父節點
當前提交
d56aa0e378
共有 1 個文件被更改,包括 3 次插入1 次删除
  1. 3 1
      lib/BlueSCSI_platform_RP2040/sd_card_sdio.cpp

+ 3 - 1
lib/BlueSCSI_platform_RP2040/sd_card_sdio.cpp

@@ -242,7 +242,7 @@ bool SdioCard::stopTransmission(bool blocking)
     }
     else
     {
-        uint32_t end = millis() + 100;
+        uint32_t end = millis() + 5000;
         while (millis() < end && isBusy())
         {
             if (m_stream_callback)
@@ -400,6 +400,8 @@ bool SdioCard::writeSectors(uint32_t sector, const uint8_t* src, size_t n)
     }
     else
     {
+        // TODO: Instead of CMD12 stopTransmission command, according to SD spec we should send stopTran token.
+        // stopTransmission seems to work in practice.
         return stopTransmission(true);
     }
 }