cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F103 + SDIO + FatFS

daniele2
Associate II
Posted on May 19, 2014 at 15:36

Hi all,

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

I've connected the SD card to the SDIO interface and 4 wires mode with 47Kohm pull-up on cmd and data pins.

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

When I debug the f_open(), inside the check_fs() function can't retrieve 0xAA55 on boot sector, and the function returns NO_FILE_SYSTEM.

I've tried different SD card but the result was always the same. The clock of the board is 72MHz. I've read other discussions on this forum without luck.

Can someone help me?

Thanks.

Update1: The check_fs() method call the low level SD_ReadBlock() and here, where the code try to set the block size for the card, it returns SD_CMD_RSP_TIMEOUT.

#stm32f103-fat-sdio
23 REPLIES 23
Posted on September 30, 2014 at 18:01

Card detect in this context is not D3, it's the switch providing the -CD signal.

So the output is indicative that your hardware is not connected up correctly, or you have some pin contention on your board.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
guillaumefaye
Associate III
Posted on September 30, 2014 at 18:35

Sorry, cd is wirred to PD3 (misteak with Data3).

 For download your .EXE i must change my ulink for stlink, to use  st-link utility

(i can't find download direct a.hex with µvision4).

And now Low level SD_WriteBlock   ,SD_ReadBlock, disk_write and

disk_read(from diskio.c) work. But f_mount, f_open don't work again.

Posted on September 30, 2014 at 19:48

Returning res=1, or something else?

If you suspect the card has been corrupted by your prior interactions, you could perhaps use the SD Formatter on a PC
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
guillaumefaye
Associate III
Posted on October 01, 2014 at 10:54

Ok now fatfs work fine. I had just use a bad path define in f_mount.

For previously hardware mistake, i used ulink2 in jtag mode , so when i use stlink , i switched to SWD mode, and to look pin used in stm32cubemx software, JTDI(not present in SWDmode) is close to SDIO D2 pin , maybe my board have poor decoupling pin.

Many thanks for your help.