I repeat - use 1 bit SD 1 bit for SD card. MMC has slighly different init sequence, I remember it failing exactly due this.
Check the clock configuration, ensure SD peripheral clock is <100MHz.
Read: STM32H7-Peripheral-SDMMC_interface.
You might also attach the project.
Modify the init function so you can debug the return error:
if (HAL_SD_Init(&hsd1) != HAL_OK)
{
Error_Handler();
}
HAL_StatusTypeDef result;
result = HAL_SD_Init(&hsd1);
__NOP(); // Add a breakpoint here, check result value
if (result != HAL_OK)
{
Error_Handler();
}
Thanks David for your answer, i will try that. By the way my SD CLOCK is 160MHZ(in attached screenshot) , i can see in STM32H7-Peripheral-SDMMC_interface. that stm32h7 sdmmc can be up to 200mhz and STM32MXCUBE accepts that clock, can it be the problem?
i made a test by your guide
static void MX_SDMMC1_MMC_Init(void)
{
hmmc1.Instance = SDMMC1;
hmmc1.Init.ClockEdge = SDMMC_CLOCK_EDGE_RISING;
hmmc1.Init.ClockPowerSave = SDMMC_CLOCK_POWER_SAVE_DISABLE;
hmmc1.Init.BusWide = SDMMC_BUS_WIDE_1B;
hmmc1.Init.HardwareFlowControl = SDMMC_HARDWARE_FLOW_CONTROL_DISABLE;
hmmc1.Init.ClockDiv = 0;
result = HAL_MMC_Init(&hmmc1);
__NOP(); // Add a breakpoint here, check result value
if (result != HAL_OK)
{
Error_Handler();
}
}
result give me HAL_ERROR value
but i can see a registers changed now
and command with clock on oscio, whats strange its happned only after i added clock enabling for sdmmc1, shouldnt HAL do it by default???
[b]__HAL_RCC_SDMMC1_CLK_ENABLE[/b]();
MX_SDMMC1_MMC_Init();
few times i have catched result give me HAL_OK.
But mostly its error, i cant understand does it trying to initizalze my emmc board conencted to it or waht does it send? and which two cmds does it send on screenshots( As i know by protocol it should be SEND CMD from HoST -> Receive Repsonse from Slave)?
shoudnt it be first byte cmd number in hex format? i can see only zeroes in first byte.