cancel
Showing results for 
Search instead for 
Did you mean: 

SDIO + FAT16/FAT32

mikewilliamson9
Associate II
Posted on September 06, 2009 at 03:51

SDIO + FAT16/FAT32

#microsoft:-broken-for-sure
49 REPLIES 49
mikewilliamson9
Associate II
Posted on May 17, 2011 at 12:54

In a current project using STM32F103VC all the SPI is committed to real time tasks. I am therefore looking at using the SDIO to link to the SD Card. The SD Card needs to be FAT16/FAT32 so that it can be read on a PC.

There is plenty of info around about driving the SPI/SD Card/FAT combination but I can find nothing about substituting SDIO for the SPI as the communication interface.

Does anyone have any experience of using SDIO with one of the FAT libraries such as EFSL or ELM FatFS? What would the advantages and disadvantages be? For example are there any licensing issues? Can anyone point me to example code?

Mike

mikewilliamson9
Associate II
Posted on May 17, 2011 at 12:54

relaxe,

I have done some digging around and got some leads.

I am getting a feel for the STM32 using the Keil STM32F10xB board (which does not have SDIO). I cannot go much further without creating issue A hardware for the project or purchasing the STM32F10xE board.

The firmware library examples that came with my board include some for the STM32F10xE including a nice tidy set of SDIO drivers:

Keil\ARM\Examples\ST\STM32F10xFWLib\Examples\SDIO

''This example provides a basic example of how to use the SDIO firmware library and an associate driver to perform read/write operations on the SD Card memory mounted on the STM3210E-EVAL board.''

Not sure why it took me so long to discover these.

On the forums there is an example of a port of EFSL for STM32 (driven via spi):

http://www.st.com/mcu/forums-cat-6880-23.html

this post has a zip attached:

stm32_EFSL_demo.zip

The slight down side for me is that this is set up as an IAR project and I find converting between Keil and IAR projects to be a touch more painful than I would wish.

Summary: I think that changing this EFSL port from SPI to SDIO may be my route.

Mike

[ This message was edited by: mike.williamson on 05-12-2008 16:17 ]

relaxe
Associate II
Posted on May 17, 2011 at 12:54

Hi there!

I'm currently trying to port DosFS to the STM3210E board using SDIO (STM32F103ZE).

I have choosen DosFS due to it's barely minimal approach. EFSL would have been my first choice, but I'm a hardware designer with not much experience in advanced programming and EFSL is quite complex.

I have various ''errors'' wich I'm trying to resolve. Currently, my code identify and read a SD/SDHC card and list files in directory.

I would really like to cooperate with anybody to have a working exemple of any filesystem ported to a SDIO capable STM32. Just write me at relaxe att gmail dotttt com.

By the way, I think it would be a killer marketing thing if the ST did an official contribution to EFSL to support the STM32 both in SPI and SDIO :p It would have clearly inclined our choice of MCU for many many projects here.

-Relaxe

[ This message was edited by: relaxe on 10-12-2008 15:31 ]

jaroslaw2
Associate II
Posted on May 17, 2011 at 12:54

Hi,

Yesterday, I successfully compiled STM32_EFSL_demo.zip with RIDE7 and STM32F103ZET6 using SPI2. Now, I am testing it. I run efs_init(&efs,0) function and if result is different than zero I wait 1 sek. and run init function once again.

That is the result:

SD Start test!

SD Try -1

SD OK

SD Start test!

SD Try -2

SD OK

SD Start test!

SD OK

SD Start test!

hand no response

Can somebody explain this behaviour of SD card or EFSL?

jaroslaw2
Associate II
Posted on May 17, 2011 at 12:54

Hi once again,

I've found a problem, I compiled it with -o3 level and it causes a hang.

Now compilation -size gives more than 1000 times OK result with first try.

A append a log file.

relaxe
Associate II
Posted on May 17, 2011 at 12:54

Hi Jaroslaw!

What does that loop do? Write a file, then reading it, then deleting it?

Also, did you use the SDIO peripheral, or simply the SPI port (spi2)?

Pretty please! Attach your code so we can all have a look :p

Thanks,

-Relaxe

relaxe
Associate II
Posted on May 17, 2011 at 12:54

Ok, I have some code.

This here does not qualify as clean-usable code in anyway, This is just our exeriments up to date for you to have a look / enjoy / stir some contributions.

The code I have attached is a working SDIO+DosFS exemple of Fat12/16/32 over SDIO, compiled in IAR5.20 and tested on a STM3120E-EVAL MB672revD.

The code is just a merge of DosFS with the SDIO/SDCard exemple from ST.

For now, this actually reads any SD/SDHC card in the socket, list all files in the root dir, open a file named ''wvo.txt'' in the root directory, and read/prints the first 512 bytes of it.

Then, it tries to write a file called ''WRTEST.txt'', but it hardfaults everytime, trying to find out why. It happens in SDCARD.C at the end of the readblock function, when it sets SDIO interrupts and enable the DMA peripheral.

Again: this is very scratchy, buggy, not considered functionnal. But hey, if someone has an idea of how to debug it!

jj
Associate II
Posted on May 17, 2011 at 12:54

@relaxe-

Will your design work with ''Micro-SD'' and/or ''Micro-SDHC'' devices? (required for portable/space savings)

Thanks for your development & contributions...

relaxe
Associate II
Posted on May 17, 2011 at 12:54

Yes, this code has been tested (and only passed the read test, for now) on microSD, microSDHC, full-size SD and full-size SDHC.

Micro card on the STM3210E-EVAL, and full size on a custom board.