cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F411re SPI SDCARD

baptor
Associate III
Posted on March 20, 2018 at 22:57

Hi everybody, I am back here because two weeks ago, I started to try to add a SD card on my nucleo F411re. I used SPI connexion. I tested the wiring with a mbed software called Nucleo_L476RG_SDCard_WorkingSample. I just changed the pin to match my SPI1 on nucleo F411re :

// MOSI, MISO, SCLK, CS, name

SDFileSystem sd(PB_5, PB_4, PB_3, PA_10, 'sd');

I tried a lot of things using cubeMX to get this working using SW4STM32. I added FatFS, but since I not using SDIO, CubeMX do not allow to tick SDcard in FatFS. I ticked 'user defined', but after generating the project, I am not able to move forward. I tested every library/tutorial available on the first two pages of a famous web browser. Now I still stucked, with nothing new to try.

Does somebody here could share a project that I could start with ( open it and compile at less using sw4stm32? generated with cubemx ? using Hal? and finaly using a stm32F411?).

Thanks in advance

Baptiste

#stm32f411 #fatfs #sdcard #spi #cubemx #sw4stm32
4 REPLIES 4
Posted on March 20, 2018 at 23:31

Should be an SPI adafruit example that builds with the nucleo. And fatfs application example under the HAL example trees. On phone will find an example later.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on March 21, 2018 at 02:09

STM32Cube_FW_F4_V1.21.0\Projects\STM32F411RE-Nucleo\Demonstrations\SW4STM32\STM32F4xx_Nucleo\.project

Uses SPI SD Card, and FatFs

STM32Cube_FW_F4_V1.21.0\Drivers\BSP\Adafruit_Shield\stm32_adafruit_sd.c

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on March 21, 2018 at 15:40

Hello, thank you for that, that's a good start for me since I can compile for my nucleo. I imported the project into SW4STM32, compiled it, OK . Since I dont use the lcd shield I commented all the lcd related fonctions. I still use spi for my sdcard and I dont find in the project something about spi1, or somewhere to specify witch spi pin I will use...

Could you drive me to the good place to set that?

Thanks a lot

Baptiste

Posted on March 21, 2018 at 16:53

The board specific stuff is defined here

STM32Cube_FW_F4_V1.0\Drivers\BSP\STM32F4xx-Nucleo\stm32f4xx_nucleo.h

STM32Cube_FW_F4_V1.0\Drivers\BSP\STM32F4xx-Nucleo\stm32f4xx_nucleo.c

I'm not using a shield either, I have a spidered up micro sd socket

https://community.st.com/0D50X00009XkYXdSAN

I've used the code as the basis for adding SPI SDCARDs to Nucleo-64 and Nucleo-144 boards.

I personally don't like the SPI implementation because it is very slow, I prefer SDIO or SDMMC as it is significantly more rapid and usable in real-world applications.

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