enjoy-digital / litesdcard

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

RFC: phy: restore operation at lower (50MHz) sys-clk-freq #33

Closed gsomlo closed 3 months ago

gsomlo commented 4 months ago

Following commit 15bc2db, LiteSDCard no longer works properly at the low end of system clock speeds (e.g., 50MHz). Reverting the way self.ce and self.clk are generated to comb instead of sync, allows LiteSDCard to operate at the full previous range of system clock speeds.

Fixes: 15bc2db

tested on nexys_video with vexriscv at 50 and 100 MHz, and with rocket at 50MHz on the nexys_video and ecpix5.

gsomlo commented 4 months ago

@enjoy-digital : ping?

enjoy-digital commented 4 months ago

Hi @gsomlo,

sorry for the delay and thanks for investigating. The reason for the change was to improve the timings (https://github.com/enjoy-digital/litex/issues/1814). I'll have a closer look at this.

enjoy-digital commented 3 months ago

Thanks @gsomlo, that's merged. I'll take the time to understand. Just for info @Dolu1990, this will probably degrade the timings for your SoC -> I'll also redo some test and will try to find a proper fix.

gsomlo commented 3 months ago

I'll also redo some test and will try to find a proper fix.

The weird thing is that if one switches s/comb/sync/ only one of https://github.com/enjoy-digital/litesdcard/blob/master/litesdcard/phy.py#L65 or https://github.com/enjoy-digital/litesdcard/blob/master/litesdcard/phy.py#L65 sdcard still works at 50MHz sysclock. It only stops working if both of those lines are switched to sync !!!