Page 1 of 1
SD Card Integration || MicroSD Card Adaptor || STM32F4029disc-1
Posted: Wed Aug 03, 2022 12:17 pm
by k_vijay
Hello Team,
I want to integrate the micro sd card reader for my application to detect/read/write/erase of the SD card.
Which driver should i use to proceed ahead 1. SDCD1 or 2 MMCDriver ?
Details of hardware is using.
STM32 Board :: STM32F4029disc-1
MicroSD Card Adaptor :: CATALEX MicroSD Card Adaptor. This SD Card reader has 6 pins (CS,MISO,MOSI,SCK,VCC,GND).
What should be the connection between STM32 board and this SD Card adaptor ?
Re: SD Card Integration || MicroSD Card Adaptor || STM32F4029disc-1
Posted: Wed Aug 03, 2022 12:35 pm
by Giovanni
Hi,
That adapter requires an SPI port not SD/MMC ones. The driver you need is "MMC_SPI" which wraps the SPI port driver. An example is in RT-STM32F103-OLIMEX_STM32_P103-FATFS.
Giovanni
Re: SD Card Integration || MicroSD Card Adaptor || STM32F4029disc-1
Posted: Wed Aug 03, 2022 1:48 pm
by k_vijay
Hello Sir,
In the file "chibios203/os/various/fatfs_bindings/fatfs_syscall.c" there is include present "ff.h" and at the time of compilation it is saying "ff.h" no such file or directory.
Re: SD Card Integration || MicroSD Card Adaptor || STM32F4029disc-1
Posted: Wed Aug 03, 2022 4:41 pm
by Giovanni
Hi,
It is part of FatFS, you need to unzip it under /ext
GiovanniHi,
Re: SD Card Integration || MicroSD Card Adaptor || STM32F4029disc-1
Posted: Fri Aug 05, 2022 5:44 am
by k_vijay
Hello Sir,
This issue is solved.
I want to know about the mapping of pins between MMC driver and SPI ?
I mean MMC driver is using which SPI whether SPI1 or SPI2 or any other for STM32f429 disc board ?
Re: SD Card Integration || MicroSD Card Adaptor || STM32F4029disc-1
Posted: Fri Aug 05, 2022 7:59 am
by k_vijay
Hello Sir,
mmcIsCardInserted(&MMCD1) always return TRUE, whether SD is available or not doesn't matter.
What may be the root cause for this ?
Re: SD Card Integration || MicroSD Card Adaptor || STM32F4029disc-1
Posted: Fri Aug 05, 2022 9:48 am
by Giovanni
Look in board.c, there is a function to be implemented for card detection, the implementation depends on where you connect the card detection pin of your connector, usually a free GPIO pin, you may need a pull-up resistor too.
Giovanni
Re: SD Card Integration || MicroSD Card Adaptor || STM32F4029disc-1
Posted: Thu Aug 11, 2022 7:28 am
by k_vijay
Hello SIr,
Now I have understood why "mmcIsCardInserted" function returns always true.
Now I have added a gpio to detect the card insertion/remove event. But now the issue is coming in mmcConnect().
It is going in infinite while loop in wait function which is called from "send_hdr()".
Can you please suggest the steps in order to established the communication from MCU to SD Card via chibios.
Re: SD Card Integration || MicroSD Card Adaptor || STM32F4029disc-1
Posted: Thu Aug 11, 2022 8:27 am
by Giovanni
Apparently the card is not answering, the cause could be anything, I can't tell from here.
Consider that the driver could not support all kind of cards, it is quite old and modern high speed cards could not work at all in SPI mode.
Giovanni