Electronic – How to (best) use a SPI SD card with STM32F1 or STM32F4

sdspistm32stm32f1stm32f4

Below, is the SD card reader I would like to use. It's using SPI.

On an Arduino I got it to work (using SPI).

However, I want to test it on a STM32F103C8T6, and later use it in STM32F407VET6. However, I see both the F1 and F4 can use the FATFS file system, which I need, but only the F4 has the SDIO peripheral (the F1 has not).

But since it is an SPI SD reader, I don't think I will need SDIO anyway.
However, still I wonder how to control it. Should I find out myself what SPI commands I should sent or are there better ways? Or should I get an SD card reader without SPI?

For my project, the requirements regarding SD are pretty low. I want to read one file from it, from max. 128 KB, and I don't care much about the speed (within one second is good enough). Maybe later I want to write to it too (also no fast time restrictions).

What would be the easiest way to read from this type of SD card reader?

I would rather use CubeMX and System Workbench (Eclipse).

SD card reader

Best Answer

The easiest way if of course SPI. I am not sure if SPI protocol is the only one publicly available.

Software side - use FATFS, there is an STM32F100 demo code already.