cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F2XX + SDIO + FatFs problem

damien2399
Associate II
Posted on January 09, 2012 at 10:38

Hi,

I've a problem with my STM32. I need to use fat filesystem on SD card to read/write/create files.

I tried to use Chan FatFs module but it didn't working at all ...

I use SD card in SDIO and 4 wires mode.

When I debug, check_fs() function can't retrieve 0x55 0xAA on boot sector, but, when I read sector n�0 in the main(), I can correctly read all datas on boot sector.

If someone can help me with this problem ...

Thanks.

#sdio-fatfs #sdio-chan-fatfs
31 REPLIES 31
rosarium
Associate II
Posted on January 09, 2012 at 11:05

check if the attached file will be helpful.

________________

Attachments :

stm32_eval_sdio_sd.c : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I0pk&d=%2Fa%2F0X0000000beA%2FdE4fzbGU3PXI8Oh9Cs2nP2JVq7LMsw.rSrvVVsIY4gk&asPdf=false
damien2399
Associate II
Posted on January 09, 2012 at 11:25

Thank you for your fast answer.

I tried with this file but the problem is the same ...

In check_fs() function, after if (disk_read(fs->drv, fs->win, sect, 1) != RES_OK)   /* Load boot record */ , I check values into fs->win, and they didn't match with correct values ...

But, if I call disk_read() with same parameters in the main(), I have correts datas into buffer ...

I hope it can help you to find what's wrong .
rosarium
Associate II
Posted on January 09, 2012 at 11:57

Can you try with some other micro SD card. Just to confirm the problem.

damien2399
Associate II
Posted on January 09, 2012 at 12:08

I already tried with 1GB micro SD card (

provided

with developpement board) and with a 2GB and I have the same results ...
damien2399
Associate II
Posted on January 09, 2012 at 14:40

I tried low level functions such as SD_ReadBlock() and higher level functions like disk_read() (which call SD_ReadBlock() ) and all of them are OK.

But, when check_fs() use disk_read(), the buffer is complete correctly in disk_read(), and when I go back into check_fs(), buffer had change by himself ...
elharrar
Associate II
Posted on January 09, 2012 at 21:29

I have the same problem ( with FAT FS) and I can provide you more information.

When I use the ST example (with multi and single block) all is OK, but if I want to use only the write part, (writeMultiBlock), the write operation doesnt work (it block on wait DMA). Maybe the mkfs didn't work ( when writing the first partition table ... )

If someone has a solution ...

damien2399
Associate II
Posted on January 10, 2012 at 09:24

Hi mikael,

If you have some informations about this problem with FatFs, I will happy to get them if you can post here of if you want to mail me.

Thanks

damien2399
Associate II
Posted on January 10, 2012 at 11:26

Hi AMSN,

I tried with your files and I've got the same problem ...

I don't know why, but when I read boot sector in main(), I've no problem and I can read datas like 0x55AA at offset 510, but, when I want read sector boot in check_fs() function, buffer which should contains boot sector contains values with no sense ...