cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F7508-DK: SD Card Interface Working in 1-Bit Mode, Fails in 4-Bit Mode

ajith1
Associate II

 

Hi STM32 Team,

I am working with the STM32F7508-DK development board and interfacing it with an SD card using the SDMMC peripheral. The 1-bit data transfer mode works flawlessly, but when switching to 4-bit mode, the interface fails to operate as expected. 

Please guide me to resolve this issue. 

 

Thanks and Regards,

A. Ajith Kumar

1 ACCEPTED SOLUTION

Accepted Solutions
SofLit
ST Employee

Hello @ajith1 ,

Look at this thread:

https://community.st.com/t5/stm32cubemx-mcus/sdio-interface-not-working-in-4bits-with-stm32f4-firmware/td-p/591776

  1. Step 1 - hsd.Init.BusWide set to SDIO_BUS_WIDE_1B just for initialization.
  2. Step 2 - Call HAL_SD_Init(&hsd)
  3. Step 3 - Call HAL_SD_ConfigWideBusOperation(&hsd, SDIO_BUS_WIDE_4B)
static void MX_SDIO_SD_Init(void)
{

  /* USER CODE BEGIN SDIO_Init 0 */

  /* USER CODE END SDIO_Init 0 */

  /* USER CODE BEGIN SDIO_Init 1 */

  /* USER CODE END SDIO_Init 1 */
  hsd.Instance = SDIO;
  hsd.Init.ClockEdge = SDIO_CLOCK_EDGE_RISING;
  hsd.Init.ClockBypass = SDIO_CLOCK_BYPASS_DISABLE;
  hsd.Init.ClockPowerSave = SDIO_CLOCK_POWER_SAVE_DISABLE;
  hsd.Init.BusWide = SDIO_BUS_WIDE_1B;
  hsd.Init.HardwareFlowControl = SDIO_HARDWARE_FLOW_CONTROL_DISABLE;
  hsd.Init.ClockDiv = 0;
  if (HAL_SD_Init(&hsd) != HAL_OK)
  {
    Error_Handler();
  }
  if (HAL_SD_ConfigWideBusOperation(&hsd, SDIO_BUS_WIDE_4B) != HAL_OK)
  {
    Error_Handler();
  }
  /* USER CODE BEGIN SDIO_Init 2 */

  /* USER CODE END SDIO_Init 2 */

}

 Hope it helps.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

View solution in original post

1 REPLY 1
SofLit
ST Employee

Hello @ajith1 ,

Look at this thread:

https://community.st.com/t5/stm32cubemx-mcus/sdio-interface-not-working-in-4bits-with-stm32f4-firmware/td-p/591776

  1. Step 1 - hsd.Init.BusWide set to SDIO_BUS_WIDE_1B just for initialization.
  2. Step 2 - Call HAL_SD_Init(&hsd)
  3. Step 3 - Call HAL_SD_ConfigWideBusOperation(&hsd, SDIO_BUS_WIDE_4B)
static void MX_SDIO_SD_Init(void)
{

  /* USER CODE BEGIN SDIO_Init 0 */

  /* USER CODE END SDIO_Init 0 */

  /* USER CODE BEGIN SDIO_Init 1 */

  /* USER CODE END SDIO_Init 1 */
  hsd.Instance = SDIO;
  hsd.Init.ClockEdge = SDIO_CLOCK_EDGE_RISING;
  hsd.Init.ClockBypass = SDIO_CLOCK_BYPASS_DISABLE;
  hsd.Init.ClockPowerSave = SDIO_CLOCK_POWER_SAVE_DISABLE;
  hsd.Init.BusWide = SDIO_BUS_WIDE_1B;
  hsd.Init.HardwareFlowControl = SDIO_HARDWARE_FLOW_CONTROL_DISABLE;
  hsd.Init.ClockDiv = 0;
  if (HAL_SD_Init(&hsd) != HAL_OK)
  {
    Error_Handler();
  }
  if (HAL_SD_ConfigWideBusOperation(&hsd, SDIO_BUS_WIDE_4B) != HAL_OK)
  {
    Error_Handler();
  }
  /* USER CODE BEGIN SDIO_Init 2 */

  /* USER CODE END SDIO_Init 2 */

}

 Hope it helps.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.