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-05-19 07:31 AM
Which specific STM32F103 part are you using?
What board are you using? Can you draw a schematic of the socket connectivity? What cards are you using MMC, SD, SDHC, MicroSD, etc? What capacity? What low level software are you using to access the cards? Some ST Library? Yes, you should verify the low level SD access functions before integrating FatFs on top. Check the pin configurations, and SD_Init() code. Check if the 1-bit access mode at 400 KHz is actually working and pulling device geometry from the card.2014-05-19 11:29 PM
Hi Clive and thanks for the reply.
I'm using an STM32F103VE in a custom board (attached there is the schematic for the SD connection). I'm using 2 different cards with the same specification: SDHC 4GB class 4. The low level software used for access the card is sdcard.c fromMCD Application Team of STMcivroelectronics. This is the GPIO configuration: GPIO_InitTypeDef GPIO_InitStructure; /* GPIOC and GPIOD Periph clock enable */ RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC | RCC_APB2Periph_GPIOD, ENABLE); /* Configure PC.08, PC.09, PC.10, PC.11, PC.12 pin: D0, D1, D2, D3, CLK pin */ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8 | GPIO_Pin_9 | GPIO_Pin_10 | GPIO_Pin_11 | GPIO_Pin_12; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; //(GPIOMode_TypeDef)(GPIO_Mode_AF_PP | GPIO_Mode_IPU | GPIO_Mode_Out_PP); GPIO_Init(GPIOC, &GPIO_InitStructure); /* Configure PD.02 CMD line */ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2; GPIO_Init(GPIOD, &GPIO_InitStructure); In fact, inside theSD_Init(), the functionSD_PowerON() method returns ''SD_CMD_RSP_TIMEOUT'' when it sendsCMD8 to verify SD card interface operating condition.The SD_CLK clock is about 370KHz. How can I test the sd low level software before integrate it in the FatFS code? Thank you very much. ________________ Attachments : SD_schematic.png : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HzD2&d=%2Fa%2F0X0000000bLc%2FhjNc8nN0Ij8jGccEZjX2hE3R_yQ.56Q0YrVsG6xWipk&asPdf=false2014-05-20 05:34 AM
2014-05-20 09:49 AM
And the supply is enabled?
STM32F10x_StdPeriph_Lib_V3.5.0\Utilities\STM32_EVAL\Common\stm32_eval_sdio_sd.c* @file stm32_eval_sdio_sd.c
* @author MCD Application Team
* @version V4.5.0
* @date 07-March-2011
* @brief This file provides a set of functions needed to manage the SDIO SD
* Card memory mounted on STM32xx-EVAL board (refer to stm32_eval.h
* to know about the boards supporting this memory).
One would typically test the code by looking at the ReadBlock and ReadMultiBlocks. The code needs the NVIC enabled, the IRQ Handler, and a Card Detect GPIO signal. The aforementioned code will have issues with cards >=4GB as it handles byte addresses as 32-bit rather than using block addressing. A 2GB SD Card might be a better starting point.
2014-05-20 09:50 AM
Watch that the writes in the example code are destructive.
STM32F10x_StdPeriph_Lib_V3.5.0\Project\STM32F10x_StdPeriph_Examples\SDIO\uSDCard2014-05-20 10:28 AM
My STM3210E-EVAL has a MicroSD card wired as follows.
2014-05-21 12:41 PM
Did a quick test with a 16GB Ultra MicroSD card, got 9.1 MBps Write, 10.4 MBps Read.
2014-05-23 03:33 AM
Hi Clive
thanks for the answers.At the end the problem was only the SD card connector (form Molex) whose pins were not good contact when the card was inserted.Thanks for advice.2014-09-28 11:31 AM