2012-02-29 01:19 PM
2012-03-02 03:42 PM
Hi
Check the errata for the STM32F4xx - there are two points to respect when working with the SDIO. The response to CMD41 doesn't include a CRC (this is normal) but the SDIO will flag a CRC error. This needs to be ignored in the code when the response is received. The second errata is that the HW flow control when reading/writing data has a glitch problem and the recommended workaround is to disable this and handle overruns/overruns at the application level. This however leads to high overhead and a bit of a mess and I found that I could leave it enabled when reading and disable it only when writing and ensuring that the write loop couldn't be interrupted, avoiding awkward handling of such underruns/overruns at a higher level. You can get SDIO code (and SPI based driver) together with FAT (with LFN support) in the uTasker project - it supports USB-MSD (allowing the SD card to be used as an external disk drive by a PC) [on F4 but not on F1 because the USB driver is quite different] as well as a DOS like command line interface via UART, TELNET and/or USB-CDC. The SD card can be used together with a web server (for big web sites) and maintained via FTP. It also supports SW updates when the SD card is inserted with a new software on it (serial loader - also supports SW upload via UART, web browser, FTP or USB-MSD). Finally its simulator allows SD card operation to be simulated, making learing SD card operation, FAT much easier, as well as developing full applications based on it and other resources. There are some videos of these in operation (not necessaryily on STM but they work there the same):http://www.youtube.com/watch?v=H4TYM9jY2-g
http://www.youtube.com/watch?v=2Rbz1SOoJVI
search on youtube for ''uTasker'' for various others. The utFAT (supports FAT16/FAT32 on SPI or SDIO of various processors, including STM32F1..4) is documented here: The project works with GCC, IAR, Keil, Atollic and Rowley Crossworks. Regards Mark uTasker project:2012-03-09 10:06 AM
Thank you for the information. uTasker looks interesting, but I need to get my could working.
I'm not checking the crc flag, and haven't transferred any data. I'm must trying to initialize.I casted the response to uint8_t and now it shows:CMD 0 Resp1 -0CMD 55 Resp1 -32CMD 41 Resp1 - 0 and getcommand returns 63CMD 2 Resp1 -0 and getcommand returns 63CMD 3 Resp1 -0 and getcommand returns 63thank you2012-03-10 08:05 AM
Hi
I don't know what the response codes mean (you will need to look up the values that can be returned from the calls). However, note that the SD card responds very slowly during the initialisation phase and so will be returning ''busy'' quite often. The busy case means that you need to retry again after a short pause until it can finally return the correct answer. Regards Mark2012-05-19 09:49 AM
Hello jeff,
Did you get any solution for your problem. I am facing exactly the same problem as you have mentioned. I will really appreciate if you can give me some pointers to solve it. regards sam2012-05-21 03:42 AM
I am working on understanding SDIO, so I thought I would use your problem to trouble shoot.
cmd 55 return 0x37 from stm32f4xx_sdio.h that is an ored response of SDIO_FLAG_CCRCFAIL SDIO_FLAG_DCRCFAIL SDIO_FLAG_CTIMEOUT SDIO_FLAG_TXUNDERR SDIO_FLAG_RXOVERR what that all means I have yet to learn. so finding out why this command had these errors is where I would start. might I suggest you change you print out of returns in Hex. it is easier to look up.2012-05-21 03:44 AM
I am working on understanding SDIO, so I thought I would use your problem to trouble shoot.
cmd 55 return 0x37 from stm32f4xx_sdio.h that is an ored response of SDIO_FLAG_CCRCFAIL SDIO_FLAG_DCRCFAIL SDIO_FLAG_CTIMEOUT SDIO_FLAG_TXUNDERR SDIO_FLAG_RXOVERR what that all means I have yet to learn. so finding out why this command had these errors is where I would start. might I suggest you change you print out of returns in Hex. it is easier to look up.2012-05-21 04:28 AM
though my modifications don't change the results of the code, I used
SDIO_StructInit(&SDIO_InitStructure);//set to default so that if upgrade to the library the structure is filled. then SDIO_InitStructure.SDIO_ClockDiv = 120;//SDIO_INIT_CLK_DIV; SDIO_Init(&SDIO_InitStructure); I followed the same for each command. SDIO_CmdStructInit(&SDIO_CmdInitStructure);//set default SDIO_SendCommand(&SDIO_CmdInitStructure); SDIO_CmdStructInit(&SDIO_CmdInitStructure);//set to default SDIO_CmdInitStructure.SDIO_CmdIndex = 55; SDIO_CmdInitStructure.SDIO_Response = SDIO_Response_Short; SDIO_SendCommand(&SDIO_CmdInitStructure); since one of the errors is a time out I am wondering about SDIO_CmdInitStructure.SDIO_Wait = SDIO_Wait_No; should be SDIO_Wait_IT Note: 1 After a data write, data cannot be written to this register for three SDIOCLK (48 MHz) clock periods plus two PCLK2 clock periods.2012-05-21 12:06 PM
SDIO_CmdInitStructure.SDIO_CmdIndex = 55;
seems to be decimal but the code expect hex. the register for Index is 6 bits so max index is 0x40 Index CMD55 Abbreviation is APP_CMD =0x37 if the Return has errors you should not do the next SDIO_SendCommand. To regress a bit, there should be code to check the status of the Card before this is started.2012-05-21 04:27 PM
not sure if the same person but they believe they found the problem
http://forum.sparkfun.com/viewtopic.php?f=11&t=31759 I also came across code that seems to be a full implementation. https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Attachments/19078/stm32_eval_sdio_sd.c