Atmel website | ARM Community | AVR freaks | Technical Support
Banner
 FAQ •  Search •  Register •  Login 

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: AT91SAM9R64 - SD hangs in sdmmc_mci, MoveToTransferState
PostPosted: Thu Feb 03, 2011 5:52 am 
Offline

Joined: Thu Oct 01, 2009 5:59 pm
Posts: 4
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


Top
 Profile  
 
 Post subject: Re: AT91SAM9R64 - SD hangs in sdmmc_mci, MoveToTransferState
PostPosted: Tue Apr 05, 2011 11:54 pm 
Offline

Joined: Thu Oct 01, 2009 5:59 pm
Posts: 4
Did a lot of work on this and eventually got a reliable implementation. There is a bad interaction between AT91SAM9R64 errata and the sample code for sdmmc_mci. One needs to do a lot of checking of the actual card status and retrying things if it didn't come out as expected. I haven't finished cleaning up the code to post it, but I thought a followup was worthwhile anyway.

Greg


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: