8 years, 8 months ago.

SPI speed - does it "update" on each API?, USB compability?

Hi Neil,

I too echo the appreciation for your work. I pulled your SDFileSystem hello world, configured for my IO, set the card-detect API for my custom hardware, and it worked first time!

I have two questions, and I don't yet have the full architectural layers in my head so I have not dug into the code to try to answer (the first one)...

1) Will the APIs for the SDFileSystem update the SPI bitrate when the APIs are called?

I have another device (a display) on the same SPI port. I haven't put a scope on the pins to see who wins, but it would be great if each API could update the SPI port to optimize that API. [And I recognize there is a bit of overhead involved]

Without an OS, reading a chunk of a bitmap from the file system and then writing that chunk to the display is one scenario where I'd like each to be as fast as the hardware design permits them. [In one case I'm working with, the display tops out much slower than the SD card]

2) Do you know of (or have) a combination where both the SDFileSystem and a USB MSC File System can coexist?

I have a combination from eons ago - a very old mbed lib, and version 1 of the FatFileSystem, and some "hacked" combination of USBHostLite, MSCFileSystem, and SDFileSystem. It could read and write each interface successfully. They share the underlying FatFS. I tried to find something "new", and spent my first couple hours trying to repeat that success, but to no avail. As I recall, that was a lengthy adventure back then, which I'd like to avoid repeating...

thanks, David Smart

Question relating to:

A re-written SDFileSystem library with improved compatibility, CRC support, and card removal/replacement support. fatfilesystem, MMC, SD, SD Card, SDHC, SDXC

1 Answer

8 years, 8 months ago.

Hi David. Each SPI object keeps track of its own format and frequency settings, and will restore them automatically it was wasn't the last object that was used. Therefore, your SD card socket and display should be able to co-exist on the same bus without any problems. You might not be happy with the performance though, since both will use the bus pretty heavily.

As for your other question, take a look at Erik Olieman's USBFileSystem project:

Import libraryUSBFileSystem

Class that combined FATFileSystem with a USBMSD device, similar to LocalFileSystem

It uses the same virtual disk_ methods as FATFileSystem, so you should be able to modify my library to use it fairly easily.

Accepted Answer

Just a quick follow-up on part 2 of my question. I was able to put together a combination that worked - to mount/access both an SD card and a USB memory stick.

Extra eyeballs would be appreciated, since I derived this from the latest work of others. The key "changes" to make it work were in the FatFileSystem.cpp/.h files, which is derived from the mbed official release.

FileSys-MultiFileSystem

posted by David Smart 13 Mar 2016