-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Configure sdcardio automount within settings.toml #10342
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I don't really want to do this because it is up to code.py to set things up for things off the board. Setting up the sdcard there should still make it available to the host via USB though. |
@tannewt I think that is my end goal here, to allow the second drive to be presented by the device to directly access the SD card. In my testing with 10.0.0-alpha.4, this hasn't been the case. Does the sd card configuration need to be defined within |
You must use native sdcardio for it to work I believe. What is your |
Looks like I have a check to ensure it isn't heap allocated. Try removing the circuitpython/supervisor/shared/usb/usb_msc_flash.c Lines 143 to 144 in bbefbd6
|
Here's a stripped down example from my program which is just a basic sd card mounting procedure with card detect: import board, digitalio, os, storage, time
from busio import SPI
from sdcardio import SDCard
led = digitalio.DigitalInOut(board.LED)
led.direction = digitalio.Direction.OUTPUT
sd_detect = digitalio.DigitalInOut(board.GP15)
sd_detect.direction = digitalio.Direction.INPUT
sd_detect.pull = digitalio.Pull.UP
spi = SPI(
clock=board.GP18,
MOSI=board.GP19,
MISO=board.GP16,
)
state = True
while True:
if sd_detect.value == state:
continue
state = sd_detect.value
if not state:
try:
sdcard = SDCard(
spi,
cs=board.GP17,
)
vfs = storage.VfsFat(sdcard)
storage.mount(vfs, "/sd")
led.value = True
print(os.listdir("/sd"))
except OSError as e:
print(e)
else:
storage.umount(vfs)
del vfs
sdcard.deinit()
del sdcard
led.val
8000
ue = False Same deal here but without the card detect: import board, storage
from busio import SPI
from sdcardio import SDCard
spi = SPI(
clock=board.GP18,
MOSI=board.GP19,
MISO=board.GP16,
)
sdcard = SDCard(
spi,
cs=board.GP17,
)
vfs = storage.VfsFat(sdcard)
storage.mount(vfs, "/sd") Neither example results in the second drive being available. It's listed within the Gnome Disks application but without any size, contents, etc. |
@tannewt Huzzah! Removing the Disregard my initial settings.toml request. This is exactly what I was hoping for. I'll make a quick PR for it and tie this issue to it to close as soon as it is merged. Thanks! |
Fixed by #10351 |
The new automount feature of
sdcardio
added in #10129 is great for devices which host an SD card connector directly on board. This feature is currently unavailable on devices which have an SD card added on via a breakout or some other daughter board. In my case, I am using a Raspberry Pi Pico 2W with a Camera PiCowbell.I suggest that new constants be added to
settings.toml
to define the pins, SPI device, and other properties used by this feature to allow it to work on devices which don't support it by default.If it isn't possible to support this feature due to compile-time constraints and flash size, an alternative would be to add additional boards for well-supported addon boards such as the PiCowbell line. This change would definitely open the gates for many more combinations of boards and addon boards, so it wouldn't be ideal.
The text was updated successfully, but these errors were encountered: