cancel
Showing results for 
Search instead for 
Did you mean: 

stm32l4 64 pin and SDMMC 4 bits wide bus

DVacc.1
Associate II

0693W000006FFWVQA4.png0693W000006FFWfQAO.pngHello, I'm using an stm32l496rgt (64 pins).

When I set SD 4 bits wide bus on SDMMC I noted that the code created set SDMMC_BUS_WIDE_1B instead of 4B.

In this configuration the sd card doesn't work, it works only with 1 bit bus.

4 bits data bus works properly in stm32l4r5zit6p (144 pins).

Is there a problem on 64 pin version?

Best Regards

1 ACCEPTED SOLUTION

Accepted Solutions
DVacc.1
Associate II

Thanks for your reply, you are right, the 4 bit wires where set in BSP_SD_Init.

But we have found problems using dma, solved with the help of this link:

https://community.st.com/s/feed/0D50X00009XkVtKSAV

Best Regards

Daniele

View solution in original post

3 REPLIES 3
Ons KOOLI
Senior III

Hi DVacc.1,

Thank you for your feedback. Probably, this is a bug on the IDE. I will look for it internally and respond you soon.

Best Regards,

Ons.

TDK
Guru

The chip always comes up in 1 bit mode and is switched to 4 bit mode through a later call.

In your linked code, it doesn't even call HAL_SD_Init, so the generated code is missing.

I generated a new project, selected 4 bit SD, and the generated code came out correct:

/**
  * @brief SDMMC1 Initialization Function
  * @param None
  * @retval None
  */
static void MX_SDMMC1_SD_Init(void)
{
 
  /* USER CODE BEGIN SDMMC1_Init 0 */
 
  /* USER CODE END SDMMC1_Init 0 */
 
  /* USER CODE BEGIN SDMMC1_Init 1 */
 
  /* USER CODE END SDMMC1_Init 1 */
  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;
  if (HAL_SD_Init(&hsd1) != HAL_OK)
  {
    Error_Handler();
  }
  if (HAL_SD_ConfigWideBusOperation(&hsd1, SDMMC_BUS_WIDE_4B) != HAL_OK)
  {
    Error_Handler();
  }
  /* USER CODE BEGIN SDMMC1_Init 2 */
 
  /* USER CODE END SDMMC1_Init 2 */
 
}

This has come up before, so there's likely a bug somewhere but I can't reproduce it.

If you feel a post has answered your question, please click "Accept as Solution".
DVacc.1
Associate II

Thanks for your reply, you are right, the 4 bit wires where set in BSP_SD_Init.

But we have found problems using dma, solved with the help of this link:

https://community.st.com/s/feed/0D50X00009XkVtKSAV

Best Regards

Daniele