SD card support on Cerbuino Bee

From what I can tell, the SD card slot isn’t currently supported on the Cerbuino Bee. Is there a timeline for when it may be supported?

If it’s not in the next month or two, I would like to take a stab at it myself. What do I need to get started? I know C# inside and out, but this hardware stuff and c++ is a whole new world for me. Am I getting in over my head?

Depending on your skills, you might be able to do it. The Fatfs project contains a stm32 example, so you could borrow some inspiration from there:)

Maybe you can first start with trying to compile and use the current firmware before you modify anything.

Last I read it was a low priority for GHI. So if you want to take a stab at it I know I’d appreciate SD support on the Cerb family.

Actually we have progressed very far with 4.2 so SD is on top of the list I think.

3 Likes

Sweet

That’s fantastic news! If you had to guess, would you say we’re looking at weeks or months?

With respect to using the MicroSD card slot on the CerbuinoBee… Looking at the schematics, it does not appear to be connected to SPI2. Is that correct?

Can the pins for an SPI port be manually specified in managed code?

The reason I ask is that I am considering creating a managed C#-based driver for the MicroSD card slot. I could easily do it with the Cerb40, but I am not clear on whether this can be done with the integrated slot on the CerbuinoBee. I would have expected PC2 and PC3 to be connected to SPI2’s MOSI and MISO. Would the pins need to be reassigned in the firmware?

Thanks,
-Valkyrie-MT

These chips have nice 4bit SD interface. It would be sad to use SPI bus.

Any update as to when we can except the firmware to handle SD interface?

Initial (read: broken) support was committed in the last day or two to the repository. I wouldn’t expect there to be a release, because it’s not highly functional yet.

@ Gus - Sorry if this is redundant…does this post mean that the beta firmware does not currently support the onboard uSD and the Gadgeteer one, or just the onboard?

@ DarrylN - It doesn’t support either yet.

Correct but we have good news. SD read is working fine and we are not working on write so we may have a new SDK this week to cover it all.

2 Likes

Yay!

1 Like

Yay +1

2 Likes

Did you mean we are NOW working on write?

Yes now

I just downloaded the July 23 Beta and loaded it on my CerbuinoBee…

OK, so which socket do I need to specify to use the MicroSD slot on the CerbuinoBee or Cerb40? The constructor of the SDCard class requires a socket number…


var sd = new SDCard(7);
Debug.Print("Card inserted: " + sd.IsCardInserted);

I tried 7 (the only “F” type socket on the Cerberus, but I got the following error message…

I also tried 0 and 2, but those did not work.

“Additional information: Module SDCard cannot be used with invalid socket number 7”
“Additional information: Module SDCard cannot be used with invalid socket number 0”
“Additional information: Module SDCard cannot be used with invalid socket number 2”

Update: Ah, ok, I just figured out if I say my CerbuinoBee is really a Cerberus, and I use socket 7, directory/file listing works, but I cannot read any files…

-Valkyrie-MT

P.S. Might I make a suggestion? Create a default constructor (no parameter) that really just specifies Socket 7 behind the scenes. Socket does not really make sense in the context of the CerbuinoBee and Cerb40. And, it will be the right choice for the Cerberus.

Enjoy the new features :slight_smile:

OK, trying to make the SDCard work. I can see folders and files, but am not able to actually read any files… Anyone else have any success with it? Here is the code I used to initialize, then tried a few commands in the Immediate window… (I have tried FAT16 and FAT32, both behave the same). Also, I am using a 1GB capacity MicroSD card and have tried 3 different cards, all with the same results.

Initialize:

            
            Debug.Print("Program Started");

            var sd = new SDCard(7);

            Debug.Print(sd.IsCardInserted.ToString());

            sd.MountSDCard();

            var storage = sd.GetStorageDevice();

            var dirs = storage.ListRootDirectorySubdirectories();

            foreach (var aDir in dirs)
                Debug.Print(aDir);

Immediate WIndow:

? storage.ListRootDirectoryFiles()
{string[1]}
    [0]: "TEST.TXT"
? storage.RootDirectory
"\\SD"
? storage.ReadFile("\\SD\\TEST.TXT").Length
A first chance exception of type 'System.IO.IOException' occurred in System.IO.dll
A first chance exception of type 'System.IO.IOException' occurred in System.IO.dll
? storage.OpenRead("\\SD\\TEST.TXT").CanRead
A first chance exception of type 'System.IO.IOException' occurred in System.IO.dll
A first chance exception of type 'System.IO.IOException' occurred in System.IO.dll
? storage.OpenRead("\\SD\\TEST.TXT").ReadByte();
A first chance exception of type 'System.IO.IOException' occurred in System.IO.dll
A first chance exception of type 'System.IO.IOException' occurred in System.IO.dll

P.S. I am also seeing that “sd.IsCardInserted” returns false when there is a card inserted, but have not tried an empty slot yet…
Also, I tried NTFS, and the error I get when mounting is this: “SDCard ERROR : Unable to mount SD card. Is card formatted as FAT32?”