SD Card Integration || MicroSD Card Adaptor || STM32F4029disc-1

Discussions and support about ChibiOS/RT, the free embedded RTOS.
k_vijay
Posts: 20
Joined: Mon Apr 04, 2022 7:06 am

SD Card Integration || MicroSD Card Adaptor || STM32F4029disc-1

Postby k_vijay » Wed Aug 03, 2022 12:17 pm

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 ?

User avatar
Giovanni
Site Admin
Posts: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: SD Card Integration || MicroSD Card Adaptor || STM32F4029disc-1

Postby Giovanni » Wed Aug 03, 2022 12:35 pm

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

k_vijay
Posts: 20
Joined: Mon Apr 04, 2022 7:06 am

Re: SD Card Integration || MicroSD Card Adaptor || STM32F4029disc-1

Postby k_vijay » Wed Aug 03, 2022 1:48 pm

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.

User avatar
Giovanni
Site Admin
Posts: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: SD Card Integration || MicroSD Card Adaptor || STM32F4029disc-1

Postby Giovanni » Wed Aug 03, 2022 4:41 pm

Hi,

It is part of FatFS, you need to unzip it under /ext

GiovanniHi,

k_vijay
Posts: 20
Joined: Mon Apr 04, 2022 7:06 am

Re: SD Card Integration || MicroSD Card Adaptor || STM32F4029disc-1

Postby k_vijay » Fri Aug 05, 2022 5:44 am

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 ?

k_vijay
Posts: 20
Joined: Mon Apr 04, 2022 7:06 am

Re: SD Card Integration || MicroSD Card Adaptor || STM32F4029disc-1

Postby k_vijay » Fri Aug 05, 2022 7:59 am

Hello Sir,

mmcIsCardInserted(&MMCD1) always return TRUE, whether SD is available or not doesn't matter.

What may be the root cause for this ?

User avatar
Giovanni
Site Admin
Posts: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: SD Card Integration || MicroSD Card Adaptor || STM32F4029disc-1

Postby Giovanni » Fri Aug 05, 2022 9:48 am

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

k_vijay
Posts: 20
Joined: Mon Apr 04, 2022 7:06 am

Re: SD Card Integration || MicroSD Card Adaptor || STM32F4029disc-1

Postby k_vijay » Thu Aug 11, 2022 7:28 am

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.

User avatar
Giovanni
Site Admin
Posts: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: SD Card Integration || MicroSD Card Adaptor || STM32F4029disc-1

Postby Giovanni » Thu Aug 11, 2022 8:27 am

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


Return to “ChibiOS/RT”

Who is online

Users browsing this forum: No registered users and 15 guests