2014-05-19 06:36 AM
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-sdio2014-09-28 07:44 PM
Why would FatFs write to sector ZERO? On a formatted card this would be the MBR or BPB, and not a data sector.
2014-09-29 09:09 AM
Thanks Clive
I write first sector with low level fonction , not with fatfs files access. when i try to write and read another sector , i just read an empy buffer (they are only a litle .txt file in sd card)so i try to write first sector and after read this : if the MBR was not overwriting then low level don't work.The problem: this low level fonction work fine with unformat card.2014-09-29 10:40 AM
The problem: this low level function work fine with unformat card.
Well that's odd to a point that defies logic. What pin allocations do you have on your board for the SD card, card detect and USART? Perhaps I can port myhttp://www.st.com/web/en/resource/technical/document/user_manual/CD00246066.pdf
example2014-09-29 11:03 AM
I use standard stm3210e_eval pin for SDIO and Uart: PC.08, PC.09, PC.10, PC.11, PC.12 pin: D0, D1, D2, D3, CLK pin ,Tx (PA.09),Rx (PA.10)
Idon't use uart to display read buffer, i use watch capability on µvision with ulink debugger .2014-09-29 01:03 PM
Assuming the Card Detect isn't connected. Pull-Ups as diagrammed above. This should output via USART1 115200 8N1
________________ Attachments : SDIO-FAT-PORT103V.HEX : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HzQ0&d=%2Fa%2F0X0000000bLg%2Fsyt0Pi2vHy7PA9Z9vLev0T.AHftDDp2n8Rh78qIGlSE&asPdf=false2014-09-29 02:07 PM
card detect and pull up are wired .why use uart?
2014-09-29 06:57 PM
It's convenient for me, I already have the code, I could use SWV/SWO. If I start from known working software, we can decide if your issue is sw or hw related.
2014-09-29 09:58 PM
card detec pin is D3, and the just diffrence, i have 10k pullup resistor insted your 47k.
i attached sd shematique and my code. thanks for help. ________________ Attachments : Micro_SD_Storage_Board_SCH.pdf : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HzPv&d=%2Fa%2F0X0000000bLe%2FIJi.aQu5kblErNO8QwE.VHxJoQXwH4VYSJGX94HlVYw&asPdf=falseSTM32F10x_StdPeriph_sdio.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HzPq&d=%2Fa%2F0X0000000bLd%2FdW90kTR0ea4iCwzZDC5cCqkKswfHA.2qs2KfDdMwO7o&asPdf=false2014-09-30 07:42 AM
Please indicated results observed with previously attached .HEX
2014-09-30 08:26 AM
I just see attached .EXE
so result: FatFs Testing - PORT103V Port res = 1 f_open MESSAGE.TXT res = 1 f_open DIR.TXT Done CRC32 BCA93E87 Memory Image res = 1 f_open COUNTER.TXT res = 1 f_open COUNTER.TXT CRC32 FFFFFFFF COUNTER.TXT Sanity check fails res = 1 f_open COUNTER.TXT res = 1 f_open COUNTER.TXT Done