Accessing microSD card on Sparkfun Thing Plus #12305
Unanswered
lehenbauer
asked this question in
RP2040 / Pico
Replies: 2 comments
-
Have you considered using the sdcard library in micropython-lib? It is written in python so you won't need to make a custom build. |
Beta Was this translation helpful? Give feedback.
0 replies
-
An old discussion, but some extra information for Thing Plus - RP2040 users. This isn't going to give you the fastest SD card access, but it's better than nothing. Tested (briefly) on v1.24.0. Install the sdcard library. This is a very small # micropython - ThingPlus RP2040
# very basic boot.py to mount the SD card - scruss, 2024-11
import os, machine
from sdcard import SDCard # need to `mip install sdcard`
spi = machine.SPI(1) # on gpio 12, 14 and 15, with /CS on 9
sd = SDCard(spi, machine.Pin(9))
vfs = os.VfsFat(sd)
os.mount(vfs, "/sd") |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I'm playing with the Sparkfun Thing Plus - RP2040. It's a pretty neat little board. It's got 16 MB of flash, for instance, plus Qwiiic connectors, a lipo battery interface and charger, and a microSD card slot.
I'd like to use it with microSD card but the mpconfigboard.h in ports/rp2/boards/SPARKFUN_THINGPLUS doesn't define a MICROPY_USDHC1 like some of the other board port files so there's no machine.SDCard if you import machine from inside upython.
It's easy enough to define and add pins to the pins.csv file, not that I know what I'm doing, and come up with some candidate contents for mpconfigboard.h. But then there's also no sdcard.c, sdcard.h, etc, in the ports/rp2 directory. There are some that are copyable from other ports.
I tried copying over machine_sdcard.c, sdcard.c, sdcard.h from stm32, added them to CMakeLists.txt and added a "hardware sdcard" to it.
Then of course it blows up compiling sdcard.c.
Am I even in the vicinity of on the right track and what's it gonna take to get this working? Also is this thing capable of QSPI? It looks like it but I'm not sure.
pin.csv additions:
GPIO_SD_USDHC1_DATA3,GPIO9
GPIO_SD_USDHC1_DATA2,GPIO10
GPIO_SD_USDHC1_DATA1,GPIO11
GPIO_SD_USDHC1_DATA0,GPIO12
GPIO_SD_USDHC1_CLK,GPIO14
GPIO_SD_USDHC1_CMD,GPIO15
mpconfigboard.h additions:
#define MICROPY_USDHC1
{
.cmd = { GPIO_SD_USDHC1_CMD },
.clk = { GPIO_SD_USDHC1_CLK },
.cd_b = { USDHC_DUMMY_PIN },
.data0 = { GPIO_SD_USDHC1_DATA0 },
.data1 = { GPIO_SD_USDHC1_DATA1 },
.data2 = { GPIO_SD_USDHC1_DATA2 },
.data3 = { GPIO_SD_USDHC1_DATA3 },
}
Beta Was this translation helpful? Give feedback.
All reactions