Hi,
I’m struggling with the Daisy Patch SD-Card (with a SanDisk Extreme micro SDHC 32GB formatted in FAT32); I don’t find any documentation, only snippets of code.
The reason for the change was to support USB drives as well as SD cards, and simultaneous mounting of both SD and USB media.
In order to setup SD card usage now, you can follow the following steps:
Initialize the SD Card hardware using SdmmcHandler and SdmmcHandler::Config as shown in your first code block
Link the FatFS filesystem to the desired hardware using FatFSInterface
Use FatFS API directly as expected – (mount, read, write, etc.)
// . . . Global variables, or part of hardware class
SdmmcHandler sdcard;
FatFSInterface fsi;
// . . . in main() {
// Init the hardware
SdmmcHandler::Config sd_cfg;
sd_cfg.Defaults();
sdcard.Init(sd_cfg);
// Link hardware and FatFS
fsi.Init(FatFSInterface::Config::MEDIA_SD);
// Get a reference to the SD card file system
FATFS& fs = fsi.GetSDFileSystem();
// Mount using fatfs:
f_mount(&fs, "/", 1);
// you can now use FatFS as expected to read/write, etc.
I still have some doubts: before reading your answer, I was able to read a file using the old combo sdcard.Configure/Init + dsy_fatfs_init() + f_mount; then I tried the new version; but the FatFSInterface is not present in the libDaisy that I’m using.
Then I found that the libDaisy linked to the DaisyExamples + submodules repository doesn’t contain any FatFSInterface definition/implementation .
you should be able to git pull on DaisyExamples to get any updates, and if you’ve never manually changed your libDaisy files then it should update to the most recent.
Otherwise, you can either git submodule update and you should see libDaisy update to commit f99ff47, or you can manually do this by navigating to libDaisy and running git checkout f99ff47
Once you’ve done that you can rebuild the libraries, and you should be good to go with the above advice.
The seed/SDMMC should be able to be compiled and run. You can use that example as a reference as well.
@shensley is the STM firmware for daisy seed deployed when updating a program binary? For some daisy seeds that I have, HAL_SD_ERROR_INVALID_VOLTRANGE is returned by SD_PowerON in DaisyExamples/libdaisy/Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_sd.c when following your above instructions.
For other daisy seeds, which I think are older. SD_PowerOn completes without error.
Is there a way to check daisy seed firmware versions? Does anyone know if there was a regression or change that may be causing this behavior?
I did swap out the Daisy device, but I may look to find a different one to see if that makes a difference… and also just change the code to abort after trying just a few times to see what happens.
Does that imply that my SDCard is no longer working as expected? I ask because I used to be able to read the SDCard just fine and now I cannot. Note: the SDCard works fine in my PC and i’ve tired a few others just in case it might have been the SDCard.
I would propose that this be a much lower number as this was running for many seconds before I decided to hit the “stop and debug” button in VSCode. I’m wondering if a shorter check number or a shorter time limit would be good here.