micropython / micropython-lib

Core Python libraries ported to MicroPython
Other
2.3k stars 980 forks source link

OSError: no SD card #871

Closed ZeynX92 closed 3 weeks ago

ZeynX92 commented 3 weeks ago

Hello, I Have problem

import machine
import sdcard
import uos

cs = machine.Pin(1, machine.Pin.OUT)

spi = machine.SPI(0,
          baudrate=1000000,
          polarity=0,
          phase=0,
          bits=8,
          firstbit=machine.SPI.MSB,
          sck=machine.Pin(2),
          mosi=machine.Pin(3),
          miso=machine.Pin(4))

sd = sdcard.SDCard(spi, cs)

vfs=uos.VfsFat(sd)
uos.mount(sd,'/sd')

Error

Traceback (most recent call last):
  File "<stdin>", line 24, in <module>
  File "sdcard.py", line 54, in __init__
  File "sdcard.py", line 82, in init_card
OSError: no SD card

I really don't know what to do. because i check all contacts, power, use and format 3 different SD cards, change _CMD_TIMEOUT...

ZeynX92 commented 3 weeks ago

Found solution: Never buy a Troyka SD reader module it works only with arduino (idk how it possible, but it is true). About connection I had checked by breadboard and wires with multimeter in dialing mode and it was proper. When I change module to another random China SD reader it works. So if you had same problem after checking connection, pinout, format SD, check power, test SD reader on Arduino you can just change your SD reader module to another. P.S. I know that Troyka modules is not available for most countries in the world, but need to mention the solution of the problem.