Xinyuan-LilyGO / lilygo-micropython

Micropython for LILYGO boards
GNU General Public License v3.0
101 stars 30 forks source link

SD card not recognized #3

Closed scumola closed 2 years ago

scumola commented 2 years ago

I bought the SD card adapter and inserted a brand new FAT-formatted 32GB SD card, but when I try to access the card, I get:

>>> import machine
>>> sd = machine.SDCard()
  Traceback (most recent call last):
    File <stdin>, line 1, in <module>
  OSError: (-259, 'ESP_ERR_INVALID_STATE')
>>> 

I tried 3 different brand new SD cards.

scumola commented 2 years ago

This is the official lillygo adapter I'm using

image

lbuque commented 2 years ago

I don't have a 32GB SD card on hand, the following code works fine on a 16GB SD card:

import machine
import os

sd = machine.SDCard(slot = 2, width = 1, sck = 14, miso = 12, mosi = 13, cs = 15)

sd.info()
os.mount(sd, "/sd")
os.listdir('/sd')
scumola commented 2 years ago

I added SKIPSD to / so micropython doesn't try to boot off the SD card and it works!

He-Peter-Huang commented 11 months ago

I'm using the LilyGo T-RGB, I'm having trouble setting up the SDCard, the CS pin is connected to P07 on the XL9535. What should I put in for the SDCard cs parameter?