cancel
Showing results for 
Search instead for 
Did you mean: 

SPI SDcard code

guyvo67
Associate II
Posted on August 11, 2009 at 16:58

SPI SDcard code

4 REPLIES 4
guyvo67
Associate II
Posted on May 17, 2011 at 13:20

Hi all,

As I saw on the evaluation kit STM3210C which is based on the 107 connectivity line the SD card is connected no longer using SDIO but SPI. I know there's some example already written like fs.c in the circle OS code based on that SDIO implementation in sdcard.c.

My question is : does the adaption of SPI low level for SD card interface already exist ? (didn't find it in the pheriperal package)

In case of NO will it be on the agenda for the near future?

In case of YES is the fs.c from circle portable towards the high level sdcard.c layer ?

Thanks

Guy

swhite
Associate III
Posted on May 17, 2011 at 13:20

Try

http://efsl.be/

.

I've tried it and it works but for our product we opted for a commercial package (one that supports SD and SDHC cards). I wrote my own driver for that package for SPI1 using ST's Standard Peripheral Library (we're using an STM32F103xB which doesn't have SDIO).

domen2
Associate III
Posted on May 17, 2011 at 13:20

efsl is funny with its non error checking code :p

I wrote following code for usage with fatfs+stm32. Should be easy to adapt to anything else.

http://cba.si/stuff/fatfs_diskio_sdcard_spi.c

guyvo67
Associate II
Posted on May 17, 2011 at 13:20

Thanks guys for the replies.

Some nice pieces of snippets.

It would of course be great if the use of eg. FS_ReadFile etc (from fs.c using dosfs.c in the circle code) could be called transparently using the SPI or SDIO driver. Perhaps a split in fs.c is even better because now there's also a dependency to the menu structure of the circle OS. The intention of course is to use that code with the circle OS but providing a fully stand alone SD file system could be considered as a great benefit to the developers of al kind of applications.

But that implies a rewrite for almost every init routine in the sdcard.c because of the strong bindings with SDIO lowlevel and structures and using a global define to select for which driver to take. Dividing them into sd_sdio.c and sd_spi.c is in that case a better option I think.

My intention is using the SD card as my file drive to feed my webpages when I implement the server based on the uIP TCP/IP stack of Adam Dunkels provided in the eth package.

The webserver example is implemented using the pages as byte arrays in flash which is not so good I think. If you want to change the view you must also do jtag on the target. Therefore I'm looking around for some better solution to feed the pages and I think i'm not alone 😉

Cheers

Guy