ZipCPU / sdspi

SD-Card controller, using either SPI, SDIO, or eMMC interfaces
202 stars 34 forks source link

Stuck in startup_hold in llsdspi.v #2

Closed dave18 closed 4 years ago

dave18 commented 4 years ago

There seems to be an issue caused by line 185 in in llsdspi.v where the logic means that it will never escape the existing condition.

The code below is always true during startup_hold if (startup_hold || byte_accepted) begin r_clk_counter <= i_speed; r_z_counter <= (i_speed == 0); end

which means the next block else if (!r_z_counter) begin r_clk_counter <= (r_clk_counter - 1); r_z_counter <= (r_clk_counter == 1); end never gets executed and therefore no clocks are issued to clear the startup_counter

I had to replace the code at line 185 with if ((startup_hold || byte_accepted) && r_z_counter) begin r_clk_counter <= i_speed; r_z_counter <= (i_speed == 0); end to stop this block being executed after r_z_counter was set to zero.

It might be a problem with my implementation of the interface but it seems compliant and I'm not sure that the interface signals could influence this particular code block

ZipCPU commented 4 years ago

Just pushed a series of changes to master. Can you please try again and see if these have fixed your issue?

Dan

dave18 commented 4 years ago

Thanks, yes the amendment fixes the issue I was having. I did have to separate the AW and DW localparams onto their own lines though as when comma separated Vivado was showing the data width as 232 rather than 31!

Also, I always have to add `default_nettype none to the end of all the modules as my design assumes this default.

Thanks again for making the amendments.

Dave

ZipCPU commented 4 years ago

Glad it's working for you now! I'll adjust the localparams to split them into two separate statements.

I'm also going to keep default_nettype none at the top, otherwise it gets ignored.

Dan