2020-12-10 12:59 AM
Hello, 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
Solved! Go to Solution.
2020-12-14 07:22 AM
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
2020-12-10 03:01 AM
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.
2020-12-10 06:02 AM
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.
2020-12-14 07:22 AM
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