Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
May 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
Copy link
Contributor Author

@gsomlo gsomlo May 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@enjoy-digital : I've understood and agree with all the rest of the changes in commits 1a3d474 and 15bc2db, but not sure why self.ce and self.clk were switched to sync from the original comb. It is the reason sdcard breaks at lower (50MHz) system clock frequencies.

To be honest, though, I also don't get why this change breaks sdcard at low speeds :)


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

Expand Down
Loading