2024-11-02 11:47 AM
Hello everyone,
I’m looking for some assistance with making an SD card work as a Mass Storage Class device on the STM32H753I-EVAL2 board. I’ve come across various solutions on the forum that have helped others, but none have resolved all the issues, and I’m still facing some challenges.
I have 2 specific questions:
The MSC_standalone example doesn’t seem to function correctly on the EVB. It recognizes the SD card and initiates communication, but it reaches a fault error. I’ve tried several SD cards with different speeds and capacities.
In our CUSTOM BOARD design for our product, we’ve only had succes (open the flash drive) with low-volume SD cards. I suspect this might be related to clock rates.
One notable difference between the evaluation board and our custom board is the absence of a transceiver for the SD card.
Any insights or suggestions would be greatly appreciated!
Thank you!
Itzik
2024-11-02 12:31 PM
STM32Cube_FW_H7_V1.11.2\Projects\STM32H743I-EVAL\Applications\USB_Device\MSC_Standalone\readme.txt
Set to ZERO #define USE_SD_TRANSCEIVER 1U
STM32Cube_FW_H7_V1.11.2\Projects\STM32H743I-EVAL\Applications\USB_Device\MSC_Standalone\Inc\stm32h7xx_hal_conf.h
Should be able to support SDHC / SDXC (most ultra) without transceiver
2024-11-07 07:46 AM
@Tesla DeLorean Thanks for your help!
you were 100% right about this:
Should be able to support SDHC / SDXC (most ultra) without transceiver
I managed to get it working with this configuration (on 4 out of 5 different SD cards I have, which is fine for now):
static void MX_SDMMC1_SD_Init(void)
{
hsd1.Instance = SDMMC1;
hsd1.Init.ClockEdge = SDMMC_CLOCK_EDGE_RISING;
hsd1.Init.ClockPowerSave = SDMMC_CLOCK_POWER_SAVE_DISABLE;
hsd1.Init.BusWide = SDMMC_BUS_WIDE_4B;
hsd1.Init.HardwareFlowControl = SDMMC_HARDWARE_FLOW_CONTROL_EBABLE;
hsd1.Init.ClockDiv = 8;
if (HAL_SD_Init(&hsd1) != HAL_OK)
{
Error_Handler();
}
}
and clock for SDMMC1,2 mux 200MHz.
What’s really strange now is that it works only in debug mode.
It also works fine after flashing the device in release mode - just right after the flashing process,
but when I disconnect and reconnect the power supply,
the program crashes at:
if (HAL_SD_Init(&hsd1) != HAL_OK)
{
Error_Handler();
}
}
I’d really appreciate any help with getting this to work in release mode.
Thank you!
Itzik
2024-11-08 12:45 AM
I would like to mention that on our custom board, the SD card detect is always on (high voltage). Could this be a contributing factor to the issue I mentioned above, especially during the reset, when the SD initialization doesn't complete correctly?
I also suspect it might be related to clock synchronization, timing, due that debug mode is slower, as I spent a lot of time to get it to work in debug mode as well.