Quantcast
Viewing all articles
Browse latest Browse all 4852

General • Re: MicroSD not working even after trying everything (pi pico)

There's an older thread where someone gets one of these Waveshare 3.3 V SD card adapters working: Use SDCard with MicroPython on Raspberry Pi Pico - Raspberry Pi Forums.

User danjperron's contribution in the same thread is particularly helpful: Use SDCard with MicroPython on Raspberry Pi Pico - Raspberry Pi Forums

I applied his approach (and his home-made µSD card adapter) in this post: how to mount SD card to pico filesystem - Raspberry Pi Forums

I repeated that again this evening: first I installed the sdcard library:

Code:

$ mpremote a1 mip install sdcardInstall sdcardInstalling sdcard (latest) from https://micropython.org/pi/v2 to /libInstalling: /lib/sdcard.mpyDone                         
I hooked up the SD card interface like this on physical pins 14–17 (SCK on GP10, TX on GP11, RX on GP12, CS on GP13).
Then I ran this code:

Code:

from machine import Pin, SPIfrom os import VfsFat, mountfrom sdcard import SDCardsd_spi = SPI(1, sck=Pin(10, Pin.OUT), mosi=Pin(11, Pin.OUT),             miso=Pin(12, Pin.OUT))sd = SDCard(sd_spi, Pin(13, Pin.OUT))sd.init_spi(10_000_000)  # speedup, from danjperronvfs = VfsFat(sd)mount(vfs, "/sd")
Now I can access the card from the MicroPython REPL:

Code:

>>> import os>>> os.listdir("")['sd', 'boot.py', 'es100', 'lib', 'pico', 'secrets.py']>>> os.listdir("/sd")['.Spotlight-V100', 'date.txt']
We're only using one of the data lines from your SD card as we're using SPI mode.

Statistics: Posted by scruss — Fri Oct 18, 2024 11:24 pm



Viewing all articles
Browse latest Browse all 4852

Trending Articles