2017-12-02 09:59 AM
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 #sdioSolved! Go to Solution.
2017-12-04 02:27 AM
Hi
Problem now solved, I needed to set Stm32Cube\Configuration\FATS Configuration\IPs instances\Use DMA template to 'disabled' - and then it worked!
David
2017-12-04 02:27 AM
Hi
Problem now solved, I needed to set Stm32Cube\Configuration\FATS Configuration\IPs instances\Use DMA template to 'disabled' - and then it worked!
David
2017-12-04 12:18 PM
Can you explain where/how you disabled this '
Use DMA template'?
2017-12-04 02:39 PM
You'll find it in STMCube, go to the configuration tab, and choose the configuration for the FATFS, and then it's in the second tab along (IP Instances)
2017-12-04 02:50 PM
Ok, that's what i thought you meant, but i don't have that on my cube!
Upgrade time.
Curious, when it was setup disabled, did you have DMA setup in the SDIO configuration?
2017-12-04 03:25 PM
I was trying to keep the project as simple as possible, so everything was at it's default values (i.e. I didn't do anything to enable DMA that didn't happen automatically)