cancel
Showing results for 
Search instead for 
Did you mean: 

SDIO command CRC error on ACMD41

jpeacock2399
Associate II
Posted on November 07, 2011 at 22:59

When single stepping through the initialization commands for the SDIO card socket (STM3210E) I notice that ACMD41 always returns a command CRC error flag.  The ST example code specifically ignores the CCRC FAIL flag when it processes the status register.  The ST example code doesn't ignore CRCs (or lack of CMDREND bit set due to CRC error) on other commands.  Is there a reason for this, something undocumented in the SDIO interface?  I do get a valid OCR register in the response.

In my own code I issue CMD2 to get the CID right after the ACMD41 to set the OCR.  I get a CTIMEOUT instead of CMDREND consistently.  Does this mean the OCR command  fled and put the card in an inactive state?  Is there something that has to occur bettwen setting OCR and reading CID?

Memory card is SDHC, 4GB PNY card.  I dont see the CCS bit set (for SDHC cards) in the OCR either.  I do see flags set for voltage range and BUSY is cleared.

#sdio
5 REPLIES 5
tomas239955_stm1_st
Associate II
Posted on November 16, 2011 at 17:10

Hi,

i have exactlty the same problem with SDIO on stm32f217IGH6 on demoboard. ACMD41 returns CRC FAIL and the response R3 is just fine.

I am try to create the protocol by SDIO spec:

https://www.sdcard.org/downloads/pls/simplified_specs/Part_E1_SDIO_Simplified_Specifcation_Ver3.00_20110225.pdf

Can somebody please tell what couse this issue?

And one another thing, SDIO pheripheral after any CMD operation calls IRQ handler with SDIO->STA == 0. So no flags are sets but the handler is called, and i cant figure out why.

Have somebody something similiar?

infoinfo989
Associate III
Posted on November 16, 2011 at 20:40

There are multiple known problems with the ST example SDIO code. Have you read these threads:

[DEAD LINK /public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Bug for large SD cards in SDIO library code&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=464]https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=%2fpublic%2fSTe2ecommunities%2fmcu%2fLists%2fcortex_mx_stm32%2fBug%20for%20large%20SD%20cards%20in%20SDIO%20library%20code&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=464

[DEAD LINK /public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/SDIO Issue setting power register. ( F207 )&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=101]https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=%2fpublic%2fSTe2ecommunities%2fmcu%2fLists%2fcortex_mx_stm32%2fSDIO%20Issue%20setting%20power%20register.%20%28%20F207%20%29&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=101

[DEAD LINK /public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/STM322xg Eval board w Chan FFS&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=402]https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=%2fpublic%2fSTe2ecommunities%2fmcu%2fLists%2fcortex_mx_stm32%2fSTM322xg%20Eval%20board%20w%20Chan%20FFS&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&currentviews=402

tomas239955_stm1_st
Associate II
Posted on November 17, 2011 at 15:02

Hi,

i have read it but there nothing about our issue. I am not using the ST utility directory part, becouse of the problems you showed us. The pheripheral library is good writen and i am using it.

So again i am asking, why ACMD41 (CMD55 + CMD41) sets CRC error flag. CMD55 returns evrything (means flags and answer) just fine but after that when you send CMD41 it just fails. I need to solve this (maybe masking off CRC), because as you can see the ACMD41 is 3rd main command used when you initiating the sd card.

ST utility directory is just a very good starting point and driving line when you creating your own drivers, but is far away from product FW version.

Thanks for any ideas...

tomas239955_stm1_st
Associate II
Posted on November 18, 2011 at 14:47

Hi,

i found the answer for ACMD41. if you look into spec (page 73 by pdf):

https://www.sdcard.org/downloads/pls/simplified_specs/Part_1_Physical_Layer_Simplified_Specification_Ver_3.01_Final_100518.pdf

The ACMD41 response is R3 and in the specification, the place for CRC is just reserved '1111111', that means that response R3 has no CRC check!!! Thats the reason why SDIO peripheral sets the CRC error flag.

Keep working...

tomas239955_stm1_st
Associate II
Posted on November 18, 2011 at 16:15

...And if you get CTIMEOUT from CMD2, it means that you didnt wait for ACMD41 reply to be not busy, check the bit[31] in OCR R3 response, this must be set to High if card is ready for next command, if it is low, you have to resend ACMD41 till busy flag is not set.

Best way to achive this is as follows (pseudo code):

CMD0

if(response!=OK) return UNUSABLE_CARD

CMD8 (check_pattern=0xAA, supply_voltage=0x01) //2.7-3.6V

If (response==TIME_OUT) Card is not 2.0

else Card is 2.0

ACMD41 (arg=0) //1x

do {

ACMD41 (HCS=1, XPC=1, BUSY=1,OCR=3V2-3V4)

while (response.busy==1) ||(trycount)

if !(trycount) return UNUSABLE_CARD

CMD2 (arg=0)

if(response!=OK) return response;

CMD3 (arg=0)

if(response!=OK) return response;

new_RCA=response.RCA;

//Now the card is ready for memory operations