2013-01-09 05:14 AM
Hi all,
How can I use the SDIO to access to an uSD card with EFSL filesystem.
The example I have is using EFSL with SPI as communication interface.
I should have an interface.c file where I do a low level interface implementation, to initialize the hardware, read sectors from the disc, and write sectors to the disc.
The function that initializes the hardware using is stm32_eval_spi_sd:esint8 if_initInterface(hwInterface* file, eint8* opts)
{
euint32 sc;
SD_Init();
SD_GetCSDRegister(&SD_csd);
/* SDCard Capacity*/
sc = SD_csd.DeviceSize + 1;
sc *= (1 << (SD_csd.DeviceSizeMul + 2));
sc *= (1 << (SD_csd.RdBlockLen));
file->sectorCount = sc / 512;
if ( (sc % 512) != 0)
{
file->sectorCount--;
}
return(0);
}
How can I perform this function using the stm32_eval_sdio_sd instead of stm32_eval_spi_sd ?
2013-01-09 05:44 AM
Hi Clive2,
I have never used EFSL but yes I have tried with FatFs. FatFs is very handy and generic you can easily port its SPI or generic example to STM32. There is also some example based on STM32 and FatFs. :)2013-01-09 06:24 AM
Thanks HallMark,
I need really to use EFSL with SDIO as communication interface.All the examples that I find on the net use EFSL with SPI communication interface...2013-01-09 07:11 AM
Which STM32 part?
I guess you'd want to start by looking at the firmware and eval board examples for SDIO. FatFs uses the routines in diskio.c tp abstract sector level IO, suggest you look at that, and the interface routines for the SPI vs SDIO libraries/drivers.2013-01-10 09:41 AM
Thanks Clive1, it's okay..
I can use SDIO instead of SPI, to implement the EFSL filesystem for STM32F4.A question about EFSL, it provides some functions to access to the FAT volumes:file_fopen (): to search for a file and initialize th file object available in 3 Modes - READ - WRITE - APPENDIs file_fopen () able to create a file and open it, or just open available files under the µSD card?2013-01-10 12:03 PM
See pg 7
http://www.avrfreaks.net/modules/FreaksFiles/files/1371/manual.pdf
Pretty sure opening with 'w' gets you a new file.2013-01-11 01:44 AM
Thanks Clive :)
It's okay, I can create a file.txt and write some words on it.I have just 2 little issues:- once created the file.txt can not be overwritten.- the file name can not be long more than 8 and 3 for extension, is there any EFSL config to modify to be able to support LFN.With Regards,Clive22013-01-11 08:41 AM
Can't you just append, seek to zero, or delete it?
What is the appeal of EFSL over something like FatFs?2013-01-29 07:21 AM
Thanks Clive,
I've already implemented the EFSL filesystem using SDIO on STM32F2 eval board with µSD card. I can write a .txt file, but when I try to write a 225KB .bmp picture, i found a empty .bmp file in uSD. What would be probably the problem ?2013-02-02 01:24 PM
Are you two brothers?
=)