Connecting an SD card to the daisy seed

Hi!

I’ve asked a few questions on Discord already, but despite all great advise, I have not gotten the SDMMC example to work yet. I already bought a new SD breakout board and a STLINK-V3MINIE to troubleshoot, and got some more info now. While trying to get this work, I’m documenting the steps i’m taking so that this could maybe be included in the Daisy wiki. I think many people will benefit from a ‘how to’ guide on connecting a SD card.

I’m currently testing using a SanDisk Extreme 128GB V30 U3 A2 microSD. Not sure if there are any requirements on a specific card type or max. storage. If anyone knows this, please let me know.

I’m using the SDMMC example from the DaisyExamples repository as a starting point. I’ve added a line to the example to slow down the SD card, as I’m using breadboard wires. This line is as follows;

sd_cfg.speed = daisy::SdmmcHandler::Speed::SLOW;

I’ve also added a breakpoint at the line that is as follows;

if(f_open(&SDFile, TEST_FILE_NAME, (FA_CREATE_ALWAYS) | (FA_WRITE)) == FR_OK)

When the executer is at this line, I step into and step over until I reach the line that is as follows;

if (res == FR_OK)

When I hover over “res”, I get the following statusses;

FR_DISK_ERR: probably “SD card was not found” (I get this as soon as I eject the SD card from the breakout board, so I think this is a good sign that the SD card is at least detected)

FR_NO_FILESYSTEM: according to some internet docs I believe this means “SD card was found, but appears not to be formatted correctly”. I had this with both FAT and ExFAT, formatted using Mac.

I’m formatting the SD card using a mac, and i’ve tried both ‘FAT’ and ‘ExFAT’. Both result in the “FR_NO_FILESYSTEM” errormessage.

Any guidance would be amazing, and I will continue to document my steps until I hopefully get it working :slight_smile:

Update; now I’m unsure if the ‘slow’ configuration of sdcard is necessary. In both configurations I seem to get the “FR_NO_FILESYSTEM” error.

1 Like

Hi Laurens!

This was posted as a response to your post on Discord:

“So ive done this a while back. And you can check my code out at: GitHub - nopjne/DaisyDrive64
I have at some point also updated the ffs-lib in lib daisy as the old version had issues understanding non mbr fat partitions.
That all aside I see you are running a single wire sdio, I think you need the correct setup selection for that. I see your pullups, which will just introduce ringing. You may want to use internal pullups but will need to change lib daisy. Slow mode should be good, as an initial step. You are also missing a key tool in all this: a logic analyzer. It was invaluable when I did this.”

Let me know if you’re still running into issue, and I would be happy to have a closer look :slight_smile:

Hi Takumi,

First of all, thanks for your response in August! I noticed I didn’t reply back then.
It’s half a year later, and I finally have time and peace of mind to continue my troubleshooting on this issue.

Really nice that I received that comment on Discord of someone managed to get it working, but unfortunately most of the terminology and steps advised are over my head. I’m really a novice on electronics.

Just to clarify, when a SD card breakout board is hooked up like in my picture to the daisy seed, should I be able to run the SDMMC example properly, hypothetically speaking? I believe my use-case for SD card integration with the daisy seed is fairly simple, but it still does not work for me. I verified the SD card formatting (currently in FAT32, MBR), but the SDMMC example still reports “FR_NO_FILESYSTEM”.

I verified that the SDMMC example is finding the SD card itself, as ejecting the SD card gives the “FR_DISK_ERR” instead.

Before starting to work properly on my own use-case, I believe it is a good approach to get the SDMMC example working first. I think combined with learnings from the WavPlayer, I should be able to take it from there and get a sample loop running.

I haven’t monitored the Discord server lately. I did some searches, but didn’t find anything that really matches what I encounter. No other reports of the “FR_NO_FILESYSTEM” error.
Do you have any more ideas what could be the issue in my setup / heard something recently that might help me?

Thanks as always for your help.

One more note;
When I remove any pull-up resistor (except for the ones at PIN 4 or 5), I get the error “FR_NOT_READY” instead. Regardless if the SD Card is inserted or not. So I guess the pull-ups are needed here.

Without seeing a pinout diagram for the SD adaptor, your wiring can’t be verified.

Hi tele_player,
Thanks for your reply.

This is the SD adaptor I’m using at the moment;

D0M129629_breakout-board-microsd-card-labeled-top-view_1700x950

More info about the specific adaptor can be found here;

And some more info;

I made sure to get the latest version of DaisyExamples - including libDaisy - and building all. This did not resolve the issue. I also tried downloading the latest fatfs and putting it into the Middleware folder instead of the current one, but it did not seem to be immediately compatible.

Here is a description of how I have everything connected on the breadboard (like in the picture above);

+-------------------+--------------------------------------+------------------+
| Daisy seed PIN    | SD breakout port                     | with pull-up res |
+-------------------+--------------------------------------+------------------+
| 2 (D1 - SD Data3) | IRQ / DAT1                           | YES              |
| 3 (D2 - SD Data2) | DAT2                                 | YES              |
| 4 (D3 - SD Data1) | CS                                   | YES              |
| 5 (D4 - SD Data0) | DO                                   | YES              |
| 6 (D5 - SD CMD)   | DI                                   | YES              |
| 7 (D6 - SD CLK)   | SCLK                                 | NO               |
| 20 (AGND)         | (VSS) GND and GND (VSS) (both sides) | NO               |
| 21 (3v3 Analog)   | VDD and VDD (both sides)             | NO               |
+-------------------+--------------------------------------+------------------+

That leaves one PIN on the SD breakout unused. The Card Detect PIN.

Pull-up resistors are all 47k.

Hi
You should use digital gnd!

Hi Christof,

Thanks for thinking along.
I do have the analog ground and the digital ground of the Daisy both wired to the negative rail of the breadboards, so I don’t think that is the issue here. Or shouldn’t they be connected?

Hm, at your photo there are no connections between the rails visible??? Have you measured the supply voltage at the SD breakout?
I don’t know if you aware, that those rails at the breadboards have no connections?

I will try to connect an SD card myself in a few days. So I am interested in your findings.
It might perhaps be helpful to post your complete test code here.

The rails are connected at the other side of the breadboard, just outside of my previous picture.
I will measure the supply voltage soon, and let you know.

Ok, Laurens, I apologize for the question about those connections of rails.
(((I am sometimes active in the Musikding forum, trying to help people build kits with sound effects. I often think, that a forum is a very low bandwidth way of communication. The reader does purely know, what the writer shows or writes.)))
In this case it might perhaps be helpful, if you post your complete source code? Zips are possible now.

SD cards and their behaviour was much discussed in the Parallax forum and I have had my own problems with them. Even sandisk cards of the same size and type but with different manufacturing date behaved differently. There seem differences in the timing. So in such case I would try different <=32GB cards formatted with FAT32. As far as I think, exFat support needs licenses and must be switched on explicitly. libDaisy: src/sys/ffconf.h File Reference (electro-smith.github.io)

I think, I will go for 1 data lines instead of 4. (Keep it simple…) libDaisy: daisy::SdmmcHandler Class Reference (electro-smith.github.io)
Good Luck, Christof

Thanks a lot for your comment Christof! I believe you got me the missing piece.
Not completely sure what the data lines are about (will look into that), but adding this line to the SDMMC example got me a blinking LED (success indicator);

sd_cfg.width = daisy::SdmmcHandler::BusWidth::BITS_1;

I didn’t even have to set the speed to SLOW.

No worries at all about your questions. All kinds of help are really welcome!
Musikding… that’s where I started my pedalbuilding adventure :slight_smile:

I’ve got some code for my own project already, which is a combination of the SDMMC and WavPlayer examples, but I first wanted to verify the SD card connection in the most basic scenario possible. Now I can continue seeing if it also works in playing audio from the SD card.

Thanks again for your help!

All the best,
Laurens

Update;

I’ve now got multiple audio-loops running simultaneously, over two (still mono) outputs!
Starting to get somewhere pretty quickly from here. Very exciting to make my project into a physical form.

I still experience the same ‘clicking’ artifacts people on Discord are referring about, and some occasional short freezing of the audio. But I can live with that for this stage of the project.
(Discord)