cancel
Showing results for 
Search instead for 
Did you mean: 

CubeMX does not provide SD configuration parameters

Mohammad A
Senior
Posted on September 08, 2017 at 16:11

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

0690X00000608BGQAY.png #bug #cubemx #sdmmc #sdio
4 REPLIES 4
T J
Lead
Posted on September 10, 2017 at 03:09

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.

Posted on September 10, 2017 at 06:13

As I mentioned above, setting bus width to 4bits does not work and it only works in 1bit mode.

My board is STM32F746G-Disco.

Rosiney Silva
Associate II
Posted on September 10, 2017 at 18:38

0690X00000608BLQAY.png

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;

}
Posted on September 10, 2017 at 21:19

True, it does the trick! but I was interested to know wh

at
hsd1.Init.BusWide = SDMMC_BUS_WIDE_1B;

is supposed to do?