2016-07-26 10:52 AM
Hi, I am trying use sd card on stm32l476 with HAL driver. I can initialize and read any block and it work fine. Write block not work and always got SD_DATA_CRC_FAIL error. I have same board with stm32l151 it work fine any read/write operation. How i can avoid this problem?
2016-07-27 07:35 AM
Hi,
It's know issue in STM32L4 during writing on SD card due towrong definition for SDMMC registers value:#define SDMMC_DCTRL_DBLOCKSIZE_2 (0x3U << SDMMC_DCTRL_DBLOCKSIZE_Pos) /*!< 0x00000040 */
#define SDMMC_DCTRL_DBLOCKSIZE_3 (0x4U << SDMMC_DCTRL_DBLOCKSIZE_Pos) /*!< 0x00000080 */
These lines should be defined as follow:
#define SDMMC_DCTRL_DBLOCKSIZE_2 (0x4U << SDMMC_DCTRL_DBLOCKSIZE_Pos) /*!< 0x00000040 */
#define SDMMC_DCTRL_DBLOCKSIZE_3 (0x8U << SDMMC_DCTRL_DBLOCKSIZE_Pos) /*!< 0x00000080 */
You can refer to this with same issue. Regards2016-07-27 08:25 AM
Thanks! Now it is worked