SD Card using 1 bit SDIO on Nucleo 401Re
Posted on December 02, 2017 at 18:59
HI
I've been trying to get an SD card working in 1bit mode using the SDIO peripheral. I am failing, and would appreciate some help. I'm on a Nucel401RE using STM32Cube_FW_F4V1.180.0
The pin configuration is below. I have not enabled anything else


My clock configuration is below. I've not configured anything else - including any interrupts. (sorry for the small font HCLK is 84 Mhz)

SDIO_CMD, SDIO_CK, and SDIO_D0 are connected as you might imagine. The breakout board includes some pull ups.

When i generate the project I've noticed that HAL_SD_Init is missing from sd_diskio.o, so my code in main.c looks like this
MX_GPIO_Init();
MX_SDIO_SD_Init();
/* USER CODE BEGIN 2 */
if (HAL_SD_Init(&hsd) != HAL_OK)
{
_Error_Handler(__FILE__, __LINE__);
}
MX_FATFS_Init();
fResult = f_mount(&SDFatFs, (TCHAR const*)SDPath, 1);
When I run the code, fResult eventually times out and reports error code 1 - FR_DISK_ERR
It get's stuck in SD_read in file sd_diskio.c, and I never see ReadStatus go true.
I can see on my scope that something is happening. The D0 and clock, triggered on a D0 rising edge, are below. The D0 signal is coming from the SD card.

I've tried various SDIOCLK clock divide (0,50,100,255) all to no avail.
After spending a few days on this I'm completely stuck , so I'd be really grateful for some help!
Thanks
David
#401re #sd #nucleo #sdio
