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

    ATOM TF-CARD Kit SPI pins are not default SPI pins?

    Atom
    3
    5
    6.8k
    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.
    • M
      mviewlab
      last edited by

      Hi,

      I just wanted to ask if the pins used for SD card interface on ATOM TF-CARD Kit are just GPIO pins and they not default SPI pins of ESP32 Pico?
      Because I tried to use it with esp-idf and it does not work. Because SD card driver of esp-idf uses default SPI pins.

      Can you please suggest any way to use ATOM TF-CARD Kit with esp-idf?

      Thanks

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

        Hello @mviewlab

        yes, they are just GPIO pins. Please checkout the pinmap here.

        Thanks
        Felix

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

        1 Reply Last reply Reply Quote 0
        • P
          pieter
          last edited by

          How to use the ATOM TF-Card in Python?

          I tried to mount the TF-CARD as below with my ATOM Matrix but it when I load my code I get a red cross on the display. (I use cs=21 because it is not used in the ATOM)

          import uos
          uos.sdconfig(uos.SDMODE_SPI,clk=23,mosi=19,miso=33,cs =21)
          uos.mountsd()

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

            Hello @pieter

            this works for me:

            from machine import SDCard
            from machine import Pin
            import os
            
            try:
                sd = SDCard(slot=3, miso=Pin(33), mosi=Pin(19), sck=Pin(23), cs=Pin(4))
                sd.info()
                os.mount(sd, '/sd')
                print("SD card mounted at \"/sd\"")
            except (KeyboardInterrupt, Exception) as e:
                print('SD mount caught exception {} {}'.format(type(e).__name__, e))
                pass
            
            print(os.listdir('/sd'))
            

            Note: mostly taken from boot.py from an M5Core2 with modified pin config. CS pin is not really required as the SD card always selected anyways.

            Thanks
            Felix

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

            P 1 Reply Last reply Reply Quote 0
            • P
              pieter @felmue
              last edited by

              @felmue said in ATOM TF-CARD Kit SPI pins are not default SPI pins?:

              sd.info()

              Hi Felix,
              Thanks a lot.
              Your solution also works for me.

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