enjoy-digital / litesdcard

Small footprint and configurable SDCard core
Other
107 stars 35 forks source link

Handle data starting to come back before response is finished #26

Open paulusmack opened 3 years ago

paulusmack commented 3 years ago

I have noticed on logic analyzer traces that at slow clock speeds (e.g. 400kHz), the microSDXC card I am using sometimes starts clocking the data out on the data lines before it has finished clocking the response out on the CMD line. The litesdcard interface only starts looking for the data after the response is complete, so it doesn't see the data, and eventually times out.

As far as I can see in the SD spec, it is legal for the card to start clocking the data out any time after the response has started. I think we need to start the state machine for receiving data at the same time when the state machine for receiving the response is started, not when the response state machine finishes.

enjoy-digital commented 3 years ago

Thanks @paulusmack, interesting. We should indeed then decouple the Cmd-Path/Data-Path reception in the core.