Hi Marc
I have understood that the DLA indicates that the data line(s) is/are active. It is set when a read or write is in operation and cleared when the operation has been completed.
By adding
while (SDHC_PRSSTAT & SDHC_PRSSTAT_DLA) {}
'before' starting the read it is verifying that any 'previous' operation has completely terminated. If the tail end of any previous activity happens to still not be completely termianted the start of the new read will be delayed until it is (the DLA returns back to '0').
Since adding this I haven't had a hang take place so it looks to be doing something positive but I never did any measurements with an analyser connected to the bus and some indication of where the code was; whether the wait took place and how long, etc. (which I would do in case of any further difficulties).
My feeling is that the difficulty occurs when a read quickly follows another operation, whereby the bus has not fully completed what it was doing before the new read is started. I also expect that by simply adding a short delay (say a couple fo us) at the start of the read function would also give the bus time to complete and so would stop the hanging situation arise, which is presumably because new commands are issued a bit too soon.
I could however be completely wrong, so if you can confirm something else it would also be useful :smileywink:
Regards
Mark