cancel
Showing results for 
Search instead for 
Did you mean: 

SD CARD FAT STM32F103RBT

tmall
Associate II
Posted on April 09, 2010 at 07:35

SD CARD FAT STM32F103RBT

8 REPLIES 8
mdeneen2
Associate II
Posted on May 17, 2011 at 13:46

Thomas,

I am using http://elm-chan.org/fsw/ff/00index_e.html to do MMC card access.  The portion of the code which does the SPI interface is tiny -- you can modify it to use the latest std peripheral library easily.

I pretty much threw away the diskio.c file -- I don't need the layer supporting USB and ATA devices.  There are also FatFs sample projects there, including a STM32 example.

It supports SD as well as SDHC.

Andrew Neil
Evangelist III
Posted on May 17, 2011 at 13:46

''I am using http://elm-chan.org/fsw/ff/00index_e.html to do MMC card access.  The portion of the code which does the SPI interface is tiny''

 

Although not on an STM32,  I have also used that and found it extremely easy just to modify the SPI ''driver'' as required.

tmall
Associate II
Posted on May 17, 2011 at 13:46

Greetings Mark and Andrew:

    Thanks for your responses!

    I wonder if you wrote your own set of low level routines or if you used the example pointed to in the references that was written by Martin Thomas?

    The generic download just provides prototypes for the low level I/O routines, which is appropriate considering the code is intended to be platform independent.

    Thanks again!

Tom Alldread

mdeneen2
Associate II
Posted on May 17, 2011 at 13:46

Tom,

I used something like this: http://www.siwawi.arubi.uni-kl.de/avr_projects/arm_projects/arm_memcards/stm32_chanfat_mthomas_20100114.zip, although this is newer than the one I used.  This sample now supports DMA transfers!

tmall
Associate II
Posted on May 17, 2011 at 13:46

Hi Mark:

   

    Thanks for the reference! I now have changed the pin assignments to match my board and have the header file includes updated so that my project will compile the FatFs routines now without LFN specified.

    I tried to compile for LongFileName(LFN) mode and found it called for UniCode case shift routines ff_convert() and ff_wtoupper(). I have never been down the UniCode path before.

    I have searched around a bit and have not been able to find boiler code for these Unicode routines. I wonder if you specified LFN compatibility for your project and if so what you used for the uc conversion routines?

    TIA!

Andrew Neil
Evangelist III
Posted on May 17, 2011 at 13:46

''I wonder if you wrote your own set of low level routines''

 

Yes - based on the ones available on that site.

There's a whole section on there about the SPI mode on SD Cards - well worth a read.

I'm sure it was just a matter of providing spi_read, spi_write type functions - and one to do the clocks without data...

Posted on May 17, 2011 at 13:46

The routines here looked pretty generic.

https://www.millennium.berkeley.edu/pipermail/tinyos-contrib-commits/2009-August.txt

If you don't want to deal with multiple Unicode code pages, just use the US one.

Also be aware that the FAT LFN is patented, and needs to be licensed from Microsoft if one is to avoid significant litigation costs.

-Clive
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
tmall
Associate II
Posted on May 17, 2011 at 13:46

Greetings Clive:

Thanks for the link and most of all for the licensing trap warning!

I think I could easily make those routines work for a single code page but for my application LFN is just a ''nice-to-have''. Since I want to keep my application free of proprietary code I will steer clear of LFN.

Thanks again!