cancel
Showing results for 
Search instead for 
Did you mean: 

HAL SDIO CRC Fail STM32L476

sttn
Associate
Posted on July 26, 2016 at 19:52

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?

2 REPLIES 2
slimen
Senior
Posted on July 27, 2016 at 16:35

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

https://my.st.com/public/STe2ecommunities/mcu/Lists/STM32Java/Flat.aspx?RootFolder=https://my.st.com/public/STe2ecommunities/mcu/Lists/STM32Java/Migration%20to%20FW%20v1.5.1%20for%20STM32L4&FolderCTID=0x01200200770978C69A1141439FE559EB459D758000F9A0E3A95BA69146A17C2E80209ADC21&currentviews=59

with same issue.

Regards

sttn
Associate
Posted on July 27, 2016 at 17:25

Thanks! Now it is worked