cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L562 SD card HAL_SD_ERROR_DATA_CRC_FAIL

SLesh.1
Associate III

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.

1 ACCEPTED SOLUTION

Accepted Solutions
SLesh.1
Associate III

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

View solution in original post

3 REPLIES 3

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

Some specific cards, or all?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
SLesh.1
Associate III

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.1
Associate III

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