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



  • 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



  • Hello @mviewlab

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

    Thanks
    Felix



  • 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()



  • 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



  • @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.