cancel
Showing results for 
Search instead for 
Did you mean: 

SDIO on STM32F3-Discovery

huberbua
Associate
Posted on January 20, 2013 at 09:59

 Just wondering if anyone has a working implementation on the STM32-F3Discovey of SPI access to a SD card? I'm using stm32303c_eval_spi_sd.c and stm32303c_eval_spi_sd.h from

STM32F30x_DSP_StdPeriph_Lib_V1.0.0/Utilities/STM32_EVAL/STM32303C_EVAL/,

the low-level routines SD_LowLevel_DeInit() and SD_LowLevel_Init() from 

STM32F30x_DSP_StdPeriph_Lib_V1.0.0/Utilities/STM32_EVAL/STM32303C_EVAL/stm32303c_eval.c

and the SD SPI Interface pin assignment below, 

but get a timeout when it activates the card initialization process.

Any pointers to code and/or help is much appreciated.

&sharpdefine SD_SPI                           SPI2

&sharpdefine SD_SPI_CLK                       RCC_APB1Periph_SPI2

&sharpdefine SD_CS_PIN                        GPIO_Pin_12                 /* PB.12 */

&sharpdefine SD_CS_GPIO_PORT                  GPIOB                       /* GPIOB */

&sharpdefine SD_CS_GPIO_CLK                   RCC_AHBPeriph_GPIOB

&sharpdefine SD_SPI_SCK_PIN                   GPIO_Pin_13                 /* PB.13 */

&sharpdefine SD_SPI_SCK_GPIO_PORT             GPIOB                       /* GPIOB */

&sharpdefine SD_SPI_SCK_GPIO_CLK              RCC_AHBPeriph_GPIOB

&sharpdefine SD_SPI_SCK_SOURCE                GPIO_PinSource13

&sharpdefine SD_SPI_SCK_AF                    GPIO_AF_5

&sharpdefine SD_SPI_MISO_PIN                  GPIO_Pin_14                  /* PB.14 */

&sharpdefine SD_SPI_MISO_GPIO_PORT            GPIOB                       /* GPIOB */

&sharpdefine SD_SPI_MISO_GPIO_CLK             RCC_AHBPeriph_GPIOB

&sharpdefine SD_SPI_MISO_SOURCE               GPIO_PinSource14

&sharpdefine SD_SPI_MISO_AF                   GPIO_AF_5

&sharpdefine SD_SPI_MOSI_PIN                  GPIO_Pin_15                  /* PB.15 */

&sharpdefine SD_SPI_MOSI_GPIO_PORT            GPIOB                       /* GPIOB */

&sharpdefine SD_SPI_MOSI_GPIO_CLK             RCC_AHBPeriph_GPIOB

&sharpdefine SD_SPI_MOSI_SOURCE               GPIO_PinSource15

&sharpdefine SD_SPI_MOSI_AF                   GPIO_AF_5

&sharpdefine SD_DETECT_PIN                    GPIO_Pin_6                 /* PC.06 */

&sharpdefine SD_DETECT_EXTI_LINE              EXTI_Line6

&sharpdefine SD_DETECT_EXTI_PIN_SOURCE        EXTI_PinSource6

&sharpdefine SD_DETECT_GPIO_PORT              GPIOC                       /* GPIOC */

&sharpdefine SD_DETECT_GPIO_CLK               RCC_AHBPeriph_GPIOC

&sharpdefine SD_DETECT_EXTI_PORT_SOURCE       EXTI_PortSourceGPIOC

&sharpdefine SD_DETECT_EXTI_IRQn              EXTI9_5_IRQn

#stm32f3discovery #spi-sd-card-stm32-discovery #stm32
5 REPLIES 5
Posted on January 20, 2013 at 14:45

The chip select needs a pull-up (10K).

Not clear if the software supports SD or SDHC cards, but doesn't look to support cards >=4GB properly, so I'd guess is SD only with cards of 2GB or less.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on January 20, 2013 at 14:49

The chip select needs a pull-up (10K).

Not clear if the software supports SD or SDHC cards, but doesn't look to support cards >=4GB properly, so I'd guess is SD only with cards of 2GB or less.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
ctroupe
Associate
Posted on March 29, 2015 at 01:02

Has anyone modified the SPI SD library to support a 4GB card?

Posted on March 29, 2015 at 15:14

Perhaps not the exact scenario, but Yes

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
ctroupe
Associate
Posted on March 29, 2015 at 22:55

Is the updated library to handle 4GB and larger SD cards available to download? I have downloaded the  stm32303c_eval_sp_sd.c & .h and it assumes that you have a 2GB or smaller card.