Nucleo F767 SDIO's Works in 1 bit but not 4 bit? (Cube IDE is Used)
- August 18, 2019
- 8 replies
- 2837 views
I am using CubeIDE 1.0.2 on Nucleo-F767ZI.
=> all settings are the default setting, but ETH and USB_OTG_FS are disabled,.
=> The SDIO is enabled (SD 1 bit /SD 4 bits Wide Bus) and has all the default settings, except for SDMMCCLK Clock Divider Factor = 4.
=> The FatFs is enabled for SD Card and has all the default settings, except for MAX_SS (Maximum Sector Size) = 4096 and Detect_SDIO = PC0 (First set it as GPIO input)
=> The clock for SDMMC1 (48MHz) is taken from PLL48CLK
Everything works fine in 1-bit SD mode but, in 4-bit wide the "f_mount" function from FatFs returns: "FR_NO_FILESYSTEM, /* (13) There is no valid FAT volume */".
I narrowed down the problem and it is happening in the "HAL_SD_ReadBlocks" function once it is called from
"find_volume"
"fmt = bsect ? check_fs(fs, bsect) : 3; /* Check the partition */"
"if (move_window(fs, sect) != FR_OK) return 4;"
"if (disk_read(fs->drv, fs->win, sector, 1) != RES_OK) {"
"res = disk.drv[pdrv]->disk_read(disk.lun[pdrv], buff, sector, count);"
" if(BSP_SD_ReadBlocks((uint32_t*)buff, (uint32_t) (sector), count, SD_TIMEOUT) == MSD_OK)"
"if (HAL_SD_ReadBlocks(&hsd1, (uint8_t *)pData, ReadAddr, NumOfBlocks, Timeout) != HAL_OK)"
(I learned this by comparing the path taken by 1-bit version vs 4-bit version)
The SD card reader is:
https://www.robotshop.com/en/micro-sd-storage-module.html
And my friend has gotten the same SD card and card reader working with Nucleo-H743ZI in 4-bit mode. So I highly doubt if it is a hardware problem.
I have attached both project.
