Re: SDIO port to STM32F4x
Posted: Wed Apr 25, 2012 8:42 pm
Hi All,
I spent some time debugging the 1.1 detection bug I reported previously. Not sure exactly what is happening, but do have some information that someone more knowledgeable with the SD protocol may be able to make some sense of.
First, I tried a 2.0 card, it worked fine.
So, I went back to the 1.1 card and added some debug. Code referenced below is in the sdcConnect() function in os/hal/src/sdc.c, rev4032, branches/sdc_dev2. The card IS being detected as a 1.1 card (if on 230, SDC_CM8_PATTERN, returns failure and sdcp->cardmode is set to SDC_MODE_CARDTYPE_SDV11 on line 248). The problem occurs at the next sdc_lld_send_cmd_short_crc(), line 271, when SDC_CMD_APP_CMD is sent. sdc_lld_send_cmd_short_crc() succeeds, but the resp code is flagged as an error by the SDC_R1_ERROR(resp[0]) part of the if condition. resp[0] contains 0x00400120. resp[0], when masked with SDC_R1_ERROR_MASK, becomes 0x00400000. This causes SDC_R1_ERROR(resp[0]) to return true resulting in the 'goto failed' on line 273.
I dug through the SD card documentation (not very thoroughly though) and couldn't find what that bit might represent. The documentation I was looking at stated SDC_CMD_APP_CMD response should only be 8 bits long. Anyone have any idea what the bit represents? Where did SDC_R1_ERROR_MASK come from and what do its bits represent?
So, I decided to ignore the error. I commented out the 'goto failed' on line 273 after the failing command. Reran the haltest and it PASSED successfully several times.
Could this possibly be a false error?
Eric
I spent some time debugging the 1.1 detection bug I reported previously. Not sure exactly what is happening, but do have some information that someone more knowledgeable with the SD protocol may be able to make some sense of.
First, I tried a 2.0 card, it worked fine.
So, I went back to the 1.1 card and added some debug. Code referenced below is in the sdcConnect() function in os/hal/src/sdc.c, rev4032, branches/sdc_dev2. The card IS being detected as a 1.1 card (if on 230, SDC_CM8_PATTERN, returns failure and sdcp->cardmode is set to SDC_MODE_CARDTYPE_SDV11 on line 248). The problem occurs at the next sdc_lld_send_cmd_short_crc(), line 271, when SDC_CMD_APP_CMD is sent. sdc_lld_send_cmd_short_crc() succeeds, but the resp code is flagged as an error by the SDC_R1_ERROR(resp[0]) part of the if condition. resp[0] contains 0x00400120. resp[0], when masked with SDC_R1_ERROR_MASK, becomes 0x00400000. This causes SDC_R1_ERROR(resp[0]) to return true resulting in the 'goto failed' on line 273.
I dug through the SD card documentation (not very thoroughly though) and couldn't find what that bit might represent. The documentation I was looking at stated SDC_CMD_APP_CMD response should only be 8 bits long. Anyone have any idea what the bit represents? Where did SDC_R1_ERROR_MASK come from and what do its bits represent?
So, I decided to ignore the error. I commented out the 'goto failed' on line 273 after the failing command. Reran the haltest and it PASSED successfully several times.
Could this possibly be a false error?
Eric