2020-11-12 02:28 AM
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
2020-11-12 06:32 AM
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
2020-11-12 07:04 AM
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.
2020-11-12 10:43 AM
> 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.
2020-11-12 11:54 PM
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!
2020-11-13 06:20 AM
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.
2020-12-09 04:53 PM
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.