cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F479 and STm32L476 microcontrollers compliance with with SD memory card version 3.0

MGall.11
Associate III

Dear all,

I was trying to verify STM32F479 and STM32L476 microcontrollers compliance with SD memory card version 3.0. Both reference manuals state "Full compliance with SD Memory Card Specifications Version 2.0".

Using HAL functions provided by ST I have done some tests to initialize a micro SD version 3.0 and I have noticed that SDIO initialization function return an error status. However I have ignored this error and the subsequent read and write operations to micro SD memory card have worked correctly anyway. This is the list of calls to initialization functions that returned an error status:

  • BSP_SD_Init is called during initialization
  • then HAL_SD_ConfigWideBusOperation(&hsd, SDIO_BUS_WIDE_4B) is called...
  • which calls SD_WideBus_Enable(hsd)...
  • which calls SD_FindSCR(hsd, scr)
  • in SD_FindSCR(SD_HandleTypeDef *hsd, uint32_t *pSCR) SDIO_FLAG_DBCKEND is 1 so tempscr remains zero and the output parameter *pSCR is zero. In details, bit DBCKEND = 1 (Data block sent/received (CRC check passed)) in SDIO_STA register (SDIO status register, address offset: 0x34).
  • as a consequence SD_WideBus_Enable returns HAL_SD_ERROR_REQUEST_NOT_APPLICABLE and HAL_SD_ConfigWideBusOperation returns HAL_ERROR.

I would like to know if it's safe to ignore this error and why read/write operations work despite the initialization error.

Best regards,

Massimo Gallon

7 REPLIES 7
TDK
Guru

> I would like to know if it's safe to ignore this error

Generally it's a bad idea to ignore errors if you don't know the cause. HAL_ERROR isn't getting returned for no reason. Looks like you traced the source of the error nicely.

> why read/write operations work despite the initialization error.

If setting 4 bits fails, could be working if it's still configured in 1 bit mode.

The 2.0 vs 3.0 shouldn't be an issue. The commands you're using should all be in the 2.0 spec, which 3.0 is backwards compatible with. Almost certainly a HAL or code issue. Just a guess.

If you feel a post has answered your question, please click "Accept as Solution".
FHız.1
Associate II

Hello,

I have the same problem, but the error does not always occur.(sometimes occured). when I ignored error , read and write operations to micro SD is working . Did you solve the problem?

MGall.11
Associate III

Hi,

not really, I'm working with SD card version 2.0 and I have left aside version 3.0. I didn't find any answer to this issue. I have tried updating STM HAL library for STM32L4 and STMF4, but nothing has changed. Anyway, in the project I'm working on I had to freeze the STM32F4 HAL version to 1.24.0.

FHız.1
Associate II

How can i back to SD card version 2.0?

MGall.11
Associate III

I'm not sure I understand your question, I've simply decided to use SD card version 2.0 in my project. It depends on the SD card you want to use, whether it supports 2.0 or 3.0 specification. Keep in mind that 3.0 is backward compatible with 2.0, but STM32F4 and STM32L4 are not compliant with SD memory card 3.0.

FHız.1
Associate II

thanks for the reply, I mean how can ı check my sd card version? I 'm using sandisk edge 8gb micro sd(class 4).

MGall.11
Associate III

The link below should answer your question. I think your SD card is version 2.0. Anyway, if you want to be suere you can check the notes of the producer of the SD card.

https://www.sdcard.org/developers/sd-standard-overview/