2011-11-07 01:59 PM
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. #sdio2011-11-16 08:10 AM
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: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?2011-11-16 11:40 AM
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¤tviews=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¤tviews=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¤tviews=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¤tviews=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¤tviews=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¤tviews=4022011-11-17 06:02 AM
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...2011-11-18 05:47 AM
Hi,
i found the answer for ACMD41. if you look into spec (page 73 by 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...2011-11-18 07:15 AM
...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):CMD0if(response!=OK) return UNUSABLE_CARDCMD8 (check_pattern=0xAA, supply_voltage=0x01) //2.7-3.6VIf (response==TIME_OUT) Card is not 2.0else Card is 2.0ACMD41 (arg=0) //1xdo {ACMD41 (HCS=1, XPC=1, BUSY=1,OCR=3V2-3V4)while (response.busy==1) ||(trycount)if !(trycount) return UNUSABLE_CARDCMD2 (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