cancel
Showing results for 
Search instead for 
Did you mean: 

Support for accessing SD card through SDIO/SPI interface through Keil platform or a firmware coding model?

Hariram.17
Associate II

The device we are using is STM32F446RE nucleo board.We would like to have well documented support for accessing SD card through either of these two modes:

i.SDIO mode(1-bit)

ii.SPI mode

We have tried tweaking the code provided for other variants in STM community to access SD card from our device,none of them helped.

We tried: The Adrafruit BSPdriver example,but it provides only Lower level support

A project based code will be extremely helpful as many others in the community are also facing similar problems with the board.Iam attaching the project ,configuration files and SD card module's snapshot..

5 REPLIES 5

Sorry is there a question here? You're providing a library, or you want someone to develop a working one for you?

Talking documentation, perhaps you can associate the pins on your diagram with some interface on the NUCLEO board, or ideally the STM32 pins each is connected too.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..

The question is that I have tried accessing SD card by running the set of procedures mentioned,but could not mount the card.In particular , f_mount instruction is not returning FR_OK and hence the sd_card is not mounted(I have attached the main() code part in the src zip).STM32cube _FW_repository provides support for such peripherals by giving example applications for many boards but unfortunately we don't have one for F446RE.So I was wondering if I have to tailor the coding to include something specific here.(a lot of users have the problem of f_mount function failing in F446RE nucleo)

Connections:

SD_card pin diagram in snapshot

STM32 - SD Card Interface

PB2(SDIO-CK) SCLK pin

PC8(SDIO_DO) MISO(DATA_OUT) pin

PD2(SDIO_CMD) MOSI(DATA_IN) pin

>>a lot of users have the problem of f_mount function failing in F446RE nucleo

A lot of forum participants have problems putting their own pants on, I think it distorts the reality of things.

The AdaFruit code combined with the Nucleo SPI BSP layer, and FatFs has been observed to be reasonably functional across multiple STM32 families.

You really can't debug this by peering at the top level and looking at errors there. FatFs relies on the code called by the DISKIO layer to actually do it's job,

Most people aren't spending time on SPI for these cards is because it is SLOW, with a modicum of effort one can get 4-bit SDIO working in the 10's of MBps

SDIO/SDMMC uses PC8, PC9, PC10, PC11, PC12 and PD2

SPI connectivity use PB5:CS, PA5:SCLK, PA6:MISO, PA7:MOSI basically SPI1 as exposed on the shield connector. The abstraction for this should be in the Drivers\BSP_STM32F4xx_Nucleo\stm32f4xx_nucleo.c or equivalent file.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
Bill Dempsey
Senior

I use *mostly* the F446RE for my projects. The example from this author over on MBED was an excellent start and it worked 1st time for me.

He wraps his SPI library around the FATFileSystem provided by ChaN

https://os.mbed.com/users/simon/code/SDFileSystem_HelloWorld/

https://os.mbed.com/users/simon/code/SDFileSystem_HelloWorld/file/27aaaa9f462b/main.cpp/

You should be able to start with this. I get excellent r/w performance with SPI but am looking to SD mode for next generation.

HTH

Thanks a lot!

Still expect some tips from Keil platform as we have a whole bulk of integration done in Keil but this input is really helpful and would be great if turns out to be portable to Keil.