Comments (1)
Here's my current workaound
EDIT: I won't mind if someone just pick this and make a pr. But I doubt that having 2 types of time limits in a single function is appropriate.
diff --git a/shared-module/sdcardio/SDCard.c b/shared-module/sdcardio/SDCard.c
index 20c5afef0e..fc886964de 100644
--- a/shared-module/sdcardio/SDCard.c
+++ b/shared-module/sdcardio/SDCard.c
@@ -210,18 +210,26 @@ STATIC mp_rom_error_text_t init_card_v1(sdcardio_sdcard_obj_t *self) {
return MP_ERROR_TEXT("timeout waiting for v1 card");
}
+#define INIT_CARD_V2_ERROR_RETRY 5
STATIC mp_rom_error_text_t init_card_v2(sdcardio_sdcard_obj_t *self) {
+ int early_error = 0;
for (int i = 0; i < CMD_TIMEOUT; i++) {
uint8_t ocr[4];
common_hal_time_delay_ms(50);
- cmd(self, 58, 0, ocr, sizeof(ocr), false, true);
- cmd(self, 55, 0, NULL, 0, true, true);
- if (cmd(self, 41, 0x40000000, NULL, 0, true, true) == 0) {
+ if (cmd(self, 58, 0, ocr, sizeof(ocr), false, true) >= 0
+ && cmd(self, 55, 0, NULL, 0, true, true) != -ETIMEDOUT
+ && cmd(self, 41, 0x40000000, NULL, 0, true, true) == 0) {
+
cmd(self, 58, 0, ocr, sizeof(ocr), false, true);
if ((ocr[0] & 0x40) != 0) {
self->cdv = 1;
}
return NULL;
+ } else {
+ early_error++;
+ if (early_error >= INIT_CARD_V2_ERROR_RETRY) {
+ break;
+ }
}
}
return MP_ERROR_TEXT("timeout waiting for v2 card");
from circuitpython.
Related Issues (20)
- floating point errors HOT 2
- lines drawn with bitmaptools.draw_polygon to a bitmap can partially fail to update a screen HOT 1
- Memento WiFi breaks if espcamera (or PyCamera) object is created. HOT 2
- EPaperdisplay.time_to_refresh never reaches zero
- Reading I2C bus in code.py interferes with auto-reload leaving attached displays inactive
- Some animated GIFS either delay or stop running HOT 2
- Adafruit_MIDI incompatible .mpy file HOT 2
- CircuitPython TLS version in m5stack HOT 16
- Hard Fault - Waveshare esp32s3 pico with espcamera
- Espressif ESP32-S3 DevKit-1 C boards moved NeoPixel pin on board revision HOT 2
- ESPNow fails to initialize on ESP32 C6 DevKit C1 N8 board HOT 1
- What is board_display_obj good for? HOT 3
- Add RGB666 color format for ILI9488 HOT 8
- ESP32-S3 ADC use causes crashes when WiFi in use HOT 15
- Can't run custom board build until large Build Boards CI job has run (giving cached submodules) HOT 4
- EINPROGRESS when trying to connect to wifi the first time each day HOT 2
- ESP32-S3 crashes when a client subscribes to the Notify characteristic of the AccelerationService
- Settable microcontroller.cpu.frequency on espressif builds HOT 3
- Raw HID [get_last_received_report()] broken on 9.1.0-beta.3 (Pi Pico rp2040) HOT 1
- SSLSocket: support stream protocol & select
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from circuitpython.