Skip to main content
Visitor II
August 16, 2021
Solved

STM32L562 SD card HAL_SD_ERROR_DATA_CRC_FAIL

  • August 16, 2021
  • 3 replies
  • 1565 views

I'm trying to run FAT over SD MMC. But it does not work in SD initial stage... I'm using CubeMX.

The simplest one code:

	 status = HAL_SD_Init(&hsd1);
	 if(status != HAL_OK)
	 {
		 debug_print_message("---SD card initialize failed!\n");
		 HAL_Delay(100);
	 }
	 else
	 {
		 debug_print_message("++++SD card initialized!\n");
		 HAL_Delay(100);
	 }

HAL_SD_Init() from stm32l5xx_hal_sd.c - it was generated by CubeMX.

Debug mode shows SD CRC error - HAL_SD_ERROR_DATA_CRC_FAIL

Logic Analyzer shows some communication - card answer:

0693W00000D2cwEQAR.pngInitial clock 400 kHz, some request and replay.

    This topic has been closed for replies.
    Best answer by SLesh.1

    Oscilloscope says - you should soldering better... Problem was in soldering.

    Some bytes a going to grey level. After repairing - SD card inited successfully.

    0693W00000Dn5ceQAB.png

    3 replies

    Graduate II
    August 16, 2021

    What's the circuit look like? Pull-ups? Series resistors? 1-bit or 4-bit?

    Some specific cards, or all?

    SLesh.1Author
    Visitor II
    August 18, 2021

    Circuit looks like - pull up to logic 3.3V 110k, RC filter 33pF (to GND) 22R (serial). Bus - 1-bit.

    When card is removed - no data on D0. When installed - the pic below. Timings looks nice - 1 bit strict 2.5 us.

    0693W00000DpeFjQAJ.pngSD card - some one from nearest store - Mirex micro sd hc 8 GB. iMAC see it.

    SLesh.1AuthorAnswer
    Visitor II
    September 14, 2021

    Oscilloscope says - you should soldering better... Problem was in soldering.

    Some bytes a going to grey level. After repairing - SD card inited successfully.

    0693W00000Dn5ceQAB.png