🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Cardputer SD-Card issues / how to format?

    Arduino
    4
    7
    4.1k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • B
      Brainzilla
      last edited by

      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"?

      1 Reply Last reply Reply Quote 0
      • ajb2k3A
        ajb2k3
        last edited by

        What code are you using?

        UIFlow, so easy an adult can learn it!
        If I don't know it, be patient!
        I've ether not learned it or am too drunk to remember it!
        Author of the WIP UIFlow Handbook!
        M5Black, Go, Stick, Core2, and so much more it cant be fit in here!

        B 1 Reply Last reply Reply Quote 0
        • B
          Brainzilla @ajb2k3
          last edited by

          @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

          1 Reply Last reply Reply Quote 0
          • felmueF
            felmue
            last edited by

            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

            GPIO translation table M5Stack / M5Core2
            Information about various M5Stack products.
            Code examples

            B 1 Reply Last reply Reply Quote 0
            • B
              Brainzilla @felmue
              last edited by Brainzilla

              @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

              B 1 Reply Last reply Reply Quote 0
              • B
                Brainzilla @Brainzilla
                last edited by Brainzilla

                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!

                1 Reply Last reply Reply Quote 0
                • J
                  jhoney12
                  last edited by

                  I'm glad to hear the issue is resolved! The SD card initialization step is indeed essential. For future troubleshooting, make sure the SD card is properly formatted and always include the initialization code in your sketch. If you run into similar issues, checking for hidden characters or formatting errors on the card can also be helpful. Thanks for updating us on the solution!

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post