Skip to content

Commit

Permalink
phy: restore operation at lower (50MHz) sys-clk-freq
Browse files Browse the repository at this point in the history
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
Signed-off-by: Gabriel Somlo <gsomlo@gmail.com>
  • Loading branch information
gsomlo committed May 18, 2024
1 parent 1a3d474 commit c050ce9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions litesdcard/phy.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@ def __init__(self):
# SDCard CE Generation.
clk_d = Signal()
self.sync += clk_d.eq(clk)
self.sync += self.ce.eq(clk & ~clk_d)
self.comb += self.ce.eq(clk & ~clk_d)

# Ensure we don't get short pulses on the SDCard Clk.
ce_delayed = Signal()
ce_latched = Signal()
self.sync += If(clk_d, ce_delayed.eq(self.clk_en))
self.comb += If(clk_d, ce_latched.eq(self.clk_en)).Else(ce_latched.eq(ce_delayed))
self.sync += self.clk.eq(~clk & ce_latched)
self.comb += self.clk.eq(~clk & ce_latched)

# SDCard PHY Read ----------------------------------------------------------------------------------

Expand Down

0 comments on commit c050ce9

Please sign in to comment.