|
I have a fairly repeatable, unpredictable, occurs-on-multiple-boards problem. I have finally seen it enough times that I have been able to pinpoint it, but now I can't tell if it is some kind of strange hardware problem, or a bug in sdmmc_mci.
The hangup occurs in MoveToTransferState(). I have not yet been able to tell whether pSd->state is RCV when the routine is called (which would cause a Cmd12 -- stop transmission) or whether pSd->state is coming in out of sync with the device. However, when the code enters the do loop waiting for a READY_FOR_DATA status, it never gets out of the loop, and the status indicates that the SD card is still in STATUS_RCV. Because it is not ready for data, and because it is not STATUS_TRAN (which only exits the loop because it's illegal!) it keeps sending Cmd13 to read the status, and hangs. For what it's worth, if I make an explicit jump back to the Cmd12 call using the debugger, the status gets cleared and the code continues as expected.
I'd like to know if anyone else has run into this. I can think of 3 possible explanations, but I'm not sure where to go next:
1. There's a subtle hardware problem where an occasional transmission is missed, and the device gets out of sync. I'm not sure how to isolate this because I can't readily reproduce the access pattern on the eval board. 2. There needs to be some other exit condition from the do loop that addresses this state. 3. There is some path through the other code in sdmmc_mci which leaves the status variable in a different condition than the actual card.
I'm personally suspecting #3 because there are so many places where it seems that an *assumption* is made that the requested state transition worked, rather than actually checking the card state.
Anyone have any insights? Thanks, Greg
|