SD-card-controller icon indicating copy to clipboard operation
SD-card-controller copied to clipboard

sdModel.v keeps busy

Open t123yh opened this issue 4 years ago • 2 comments

Hi,

I am trying to simulate using the exampe software and sdcard model. In sdModel.v#L377, OCR[31] gets the reversed value of Busy. In L104, it says that Busy should be 0 when busy, so OCR[31] is 1 when Busy.

By the definition of OCR register (refer to this spec Page 17), OCR[31] is “0” = Busy “1” = Ready, the reversion is wrong.

I think L377 should be OCR[31]<=Busy;, removing the reversion.

t123yh avatar Apr 04 '21 15:04 t123yh

The sdMode.v file is a heritage from the original project that I based my work on (http://opencores.org/project,sdcard_mass_storage_controller). I took all the tests of the original project as they were and reimplemented the core so I'm not very familiar with this part of the code. I think that You may get more help from the author of the original project. But, it seems that You are right about the Busy signal although the proposed change make simulation hang for the test.sd_controller_top_tb. I will try to look into it.

mczerski avatar Apr 04 '21 21:04 mczerski

It seems that the testbench you mentioned checks if the card is busy on startup, and waits for it to be idle (code). I believe it's done in a reversed polarity just as the sdModel.v. Although not tested, I believe that If you correct the check, it will continue to run.

The problem is discovered while I am trying to do simulation using mmc.c. The same check is done in mmc.c#L185, in the correct polarity. So if the busy polarity is wrong in sdModel.v, mmc.c will hang forever.

t123yh avatar Apr 05 '21 00:04 t123yh