← index #775PR #1079
Likely Duplicate · high · value 0.201
QUERY · ISSUE

OSError: timeout waiting for v2 card

openby zhuzhutouopened 2023-12-05updated 2026-03-02

Title: SD Card Initialization Timeout Issue: Lenovo thinkplus platinum Pro 64GB V30 A3 U3

Description:

I'm experiencing an initialization timeout issue with a Lenovo thinkplus platinum Pro 64GB V30 A3 U3 SD card on MicroPython version 1.21.0 on my device. When I attempt to initialize the SD card, I encounter the following error message:

SD card initialization timeout error: Error: Timeout occurred during SD card initialization.

Steps to reproduce:

  1. Insert the Lenovo thinkplus platinum Pro 64GB V30 A3 U3 SD card into the device's SD card slot.
  2. Execute the SD card initialization code in the MicroPython environment.
import os, sdcard, machine


def sdtest():
    spi = machine.SPI(1, baudrate=1000000, sck=machine.Pin(10), mosi=machine.Pin(11), miso=machine.Pin(12))
    spi.init()  # Ensure right baudrate
    sd = sdcard.SDCard(spi, machine.Pin(13, machine.Pin.OUT))  # Compatible with PCB
    vfs = os.VfsFat(sd)
    os.mount(vfs, "/fc")
    print("Filesystem check")
    print(os.listdir("/fc"))

    line = "abcdefghijklmnopqrstuvwxyz\n"
    lines = line * 200  # 5400 chars
    short = "1234567890\n"

    fn = "/fc/rats.txt"
    print()
    print("Multiple block read/write")
    with open(fn, "w") as f:
        n = f.write(lines)
        print(n, "bytes written")
        n = f.write(short)
        print(n, "bytes written")
        n = f.write(lines)
        print(n, "bytes written")

    with open(fn, "r") as f:
        result1 = f.read()
        print(len(result1), "bytes read")

    fn = "/fc/rats1.txt"
    print()
    print("Single block read/write")
    with open(fn, "w") as f:
        n = f.write(short)  # one block
        print(n, "bytes written")

    with open(fn, "r") as f:
        result2 = f.read()
        print(len(result2), "bytes read")

    os.umount("/fc")

    print()
    print("Verifying data read back")
    success = True
    if result1 == "".join((lines, short, lines)):
        print("Large file Pass")
    else:
        print("Large file Fail")
        success = False
    if result2 == short:
        print("Small file Pass")
    else:
        print("Small file Fail")
        success = False
    print()
    print("Tests", "passed" if success else "failed")


sdtest()
The SD card initialization timeout error occurs after executing the above code.
Expected behavior:

I expect the SD card to initialize successfully, allowing me to access files on the SD card.

Attempts made:

I’ve checked the physical connection and confirmed that the SD card is inserted correctly.
I attempted to upgrade MicroPython to the latest version, but the issue still persists.
The memory card is formatted with the FAT32 file system.
I have searched through MicroPython documentation and forums but have not found a similar issue.
Environment:

Device model: Lenovo thinkplus platinum Pro
SD card model: 64GB V30 A3 U3
MicroPython version: 1.21.0
Operating system: (if relevant)
Expected resolution time:

If possible, please address this issue as soon as possible as the SD card is crucial for my project.

Thank you for your kind assistance!
2 comments
mendenm · 2023-12-06

@zhuzhutou Please try the updated SDCard library in my pull request:
https://github.com/micropython/micropython-lib/pull/765
and let me know if it works with this.

kwagyeman · 2026-03-02

This is resolved with the latest sdcard code.

CANDIDATE · PULL REQUEST

sdcard: Set stop bit in SPI command frame.

mergedby c0ffee2codeopened 2026-02-14updated 2026-03-02

Hello,
first and foremost thank you for maintaining and evolving Micropython, it made my pet project possible !

I'm using 32gb class 10 sd card from Philips for my pet project and stumbled upon an compatibility issues: without stop bit card does not work with the driver :-(
If that matters, product information is here.

With stop bit set - card works like a charm with the driver, i tested it locally.
Before it failed with: OSError: timeout waiting for v2 card.

2 comments
benwynn · 2026-02-21

this is a good change, one that i've already done to my own version of sdcard.py

...you'll need to amend your commit and repush with an email address that doesn't have 'noreply' in the email for the checker to pass your PR though.

Gadgetoid · 2026-02-25

We've sourced a couple of SD cards that only work with this fix. Kingston CANVAS Select Plus 64GB and TEAMGROUP 16GB.

While I'd love to see https://github.com/micropython/micropython-lib/pull/765 merged, these smaller steps toward a more compatible driver would be useful in the meantime!

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied