Cardputer SD-Card issues / how to format?



  • Hello,

    it's a really fun device, but I somehow struggle to get the SD-card working…
    Tried Uniflow2.0 and it all works - except the SD.
    No matter what I try, I always get:
    Traceback (most recent call last):
    File "<stdin>", line 74, in <module>
    File "<stdin>", line 47, in loop
    OSError: [Errno 19] ENODEV

    Using the CLI:
    >>> os.listdir("/")
    ['system', 'flash']

    So the SD isn't seen.

    I tried formating on OSX, OSX (Terminal), in Win10, Fat16 / FAT 32.
    Both with a 8GB Card and two small 128MB cards.

    Is there a known good sample sketch to handle the SD in Cardputer to format / get Infos?

    I am using PIO, but I guess that can broadly be be considered "Arduino IDE"?



  • What code are you using?



  • @ajb2k3 said in Cardputer SD-Card issues / how to format?:

    What code are you using?

    Basically just UIFlow2 > SDCard > listdir

    Or the CLI in UIFlow for the os.listdir()

    0_1708551064186_Bildschirmfoto 2024-02-21 um 22.28.18.png



  • Hello @Brainzilla

    try adding the Init SDCard with block before accessing the SD card. See below.

    0_1708578172291_UI2_M5Cardputer_SDCard_20240222.png

    Thanks
    Felix



  • @felmue

    it seems that there is something happening.

    #1 Started with card
    File "<stdin>", line 18, in <module>
    File "<stdin>", line 11, in setup
    OSError: [Errno 22] EINVAL

    #2 Removing the card
    File "<stdin>", line 18, in <module>
    File "<stdin>", line 9, in setup
    File "hardware/sdcard.py", line 19, in SDCard
    OSError: [Errno 116] ETIMEDOUT: ESP_ERR_TIMEOUT

    #3 Running it again
    File "<stdin>", line 18, in <module>
    File "<stdin>", line 9, in setup
    File "hardware/sdcard.py", line 16, in SDCard
    OSError: (-259, 'ESP_ERR_INVALID_STATE')

    Inserting the card back at runtime changes the error back to #1

    Pretty sure the solution lies somewhere in correctly formatting the card.
    That's why I would like to format it with the ESP itself.

    0_1708604623889_Bildschirmfoto 2024-02-22 um 13.23.31.png



  • OK, it works now.
    Seems there was a <space> in the "empty" listdir path facepalm

    And it does require the SD card init block as you suggested.
    I thought that would be included in the "init built-in hardware" step, but the code shows otherwise.

    Even hot-swapping multiple works – neat.

    Thank you so much!