Ethernet and SD Card Access

20 Nov 2009

Hi,

I'm new to using the mbed. In the examples I have seen on using ethernet, they seem to use the local USB files system. Does the mbed hardware support the use of the ehternet interface and SD card access, via SPI, at the same time. This would allow much large files to be used.

I look forward to hearing your comments.

Regards

Phil.

20 Nov 2009

Re: Hi,

Yes of course! If you have a supported SDCard. Have a look here

You can simply use it in the way:

 

#include "mbed.h"
#include "SDFileSystem.h"
#include "HTTPServer.h"

HTTPServer http;
LocalFileSystem local("local");
SDFileSystem sd(p5, p6, p7, p13, "sd");

int main(void) {
    http.addHandler(new HTTPRPC());
    http.addHandler(new HTTPFileSystemHandler("/", "/local/"));
    http.addHandler(new HTTPFileSystemHandler("/sdcard", "/sd/"));
    http.bind();

    while(1) {
        http.poll();
    }
}

SDServerDemo

 

 

Cheers

Rolf

 

22 Jul 2010

Does anyone have any additional examples of webservers displaying HTML files that are stored on an SD Card?

I cannot get the example above to work.  It will display files on the local (flash) files system, but will not display any files from the SD Card.

Since, http://{ip address}/index.htm pulls from the local file system, what is the exact URL I would type to pull a file from the SD card?  http://{ip address}/sdcard/index.htm does not work, I get a 404 error.  (I've tried many variations, all with the same outcome.)

The SD card I'm using is a 2G Kingston and works fine with the SD card libraries, so I dont think it's an SD card problem.

I appreciate any help anyone can provide, as I'm trying to design a webserver interface that I can port to a bare 1768.  Therefore, it will not have local flash.

Thanks,

Robert.