2017-09-08 07:11 AM
Whether using SDIO or SDMMC, CubeMX does not provide necessary configuration parameters available for these units. It also does not configure Bus Width, only generates 1Bit Bus configuration. Also setting BusWide to 4Bit does not initialize sd card. It only works in 1Bit mode.
These are therequired parameters to be available at CubeMX
void MX_SDMMC1_SD_Init(void)
{
hsd1.Instance = SDMMC1;
hsd1.Init.ClockEdge = SDMMC_CLOCK_EDGE_RISING;
hsd1.Init.ClockBypass = SDMMC_CLOCK_BYPASS_DISABLE;
hsd1.Init.ClockPowerSave = SDMMC_CLOCK_POWER_SAVE_DISABLE;
hsd1.Init.BusWide = SDMMC_BUS_WIDE_1B;
hsd1.Init.HardwareFlowControl = SDMMC_HARDWARE_FLOW_CONTROL_DISABLE;
hsd1.Init.ClockDiv = 0;
}�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?
and this is a picture of available parameters at cubemx
#bug #cubemx #sdmmc #sdio2017-09-09 06:09 PM
if you can get it going, I would be interested.
I am yet to get to my SDcard code, I expected the 4-bit mode to work, so that's whats on my PCB.
Which processor are you using ?
Are you using you own PCB or a eval board ?
If you define your problem more explicitly, ST may chime in to help you. with specific examples they have working.
2017-09-09 11:13 PM
As I mentioned above, setting bus width to 4bits does not work and it only works in 1bit mode.
My board is STM32F746G-Disco.
2017-09-10 09:38 AM
In the file ''bsp_driver_sd.c''
#define BUS_4BITS 1
#include ''bsp_driver_sd.h''extern SD_HandleTypeDef hsd;uint8_t BSP_SD_Init(void)
{ uint8_t sd_state = MSD_OK; /* Check if the SD card is plugged in the slot */ if (BSP_SD_IsDetected() != SD_PRESENT) return MSD_ERROR; /* HAL SD initialization */ sd_state = HAL_SD_Init(&hsd);#ifdef BUS_4BITS /* Configure SD Bus width */ if (sd_state == MSD_OK) { /* Enable wide operation */ if (HAL_SD_ConfigWideBusOperation(&hsd, SDMMC_BUS_WIDE_4B) != HAL_OK) sd_state = MSD_ERROR; }#endif return sd_state;}2017-09-10 02:19 PM
True, it does the trick! but I was interested to know wh
at
hsd1.Init.BusWide = SDMMC_BUS_WIDE_1B;
is supposed to do?