cancel
Showing results for 
Search instead for 
Did you mean: 

SD card is always in 'TRANSFER' state.

ENo.1
Associate II

Hi

I'm using STM32F103VGT6 and now days i have a problem in working with SD cards.

I can't use FatFs library.

"HAL_SD_GetCardState" function, always return 'TRANSFER' state.

I try multiple SD cards, clock divider and any many configs.

please help.

thanks

6 REPLIES 6
TDK
Guru

The TRANSFER state is where the card is most of the time. Do you think it should be in a different state?

https://user-images.githubusercontent.com/77482/29501948-45c1c196-85e1-11e7-9bfc-d4817115d5bb.png

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

thanks @TDK​ 

This function (HAL_SD_GetCardState) has multiple output.

For example:

-HAL_SD_CARD_READY

Card state is ready

-HAL_SD_CARD_IDENTIFICATION

Card is in identification state

-HAL_SD_CARD_STANDBY

Card is in standby state

-HAL_SD_CARD_TRANSFER

Card is in transfer state

-HAL_SD_CARD_SENDING

Card is sending an operation

-HAL_SD_CARD_RECEIVING

Card is receiving operation information

'HAL_SD_CARD_READY' state, means SD card is ready for do an operation.

It seems that in most of the time, SD card must in READY state, not TRANSFER state.

in TRANSFER state, i can't read or write from/to SD card. it means SD card is doing an operation and its busy.

> in TRANSFER state, i can't read or write from/to SD card. it means SD card is doing an operation and its busy.

That's simply not true. Most commands, including read/write commands, are initiated when the card is in the transfer state. See the graph that I linked. If you have a copy of the SD standard, there are more details in there. I linked the figure for eMMC, but SD is similar.

If you feel a post has answered your question, please click "Accept as Solution".

My written program code is really simple and it has a 'while' loop which controls SD card's state and its compatible with manual's note :

while(HAL_SD_GetCardState(&hsd) == HAL_SD_CARD_TRANSFER);

...

in debug mode, program stopped on this line and never run next line!!!

it seems that this condition not changed and always in TRANSFER mode!

i saw in other's code, that always check this condition, but for me not answered!

I'm still sticking to my story that TRANSFER is the correct state for the card prior to and read/write data commands, as shown in the picture in the first response. It doesn't sound like you believe me, so not sure I can help here.

> i saw in other's code, that always check this condition, but for me not answered!

I can't comment on other people's code that you're even not linking to. There is a lot of crap out there.

If you feel a post has answered your question, please click "Accept as Solution".
kgai
Associate III

poor ENO. You know that the ST employee are very busy just like the SD Card always in transfer mode, So u are ignored. Change 2 another processor like TI or microchip may be a better choice.