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

targets/nexys4ddr: fix sdcard clocker initialization #408

Merged
merged 1 commit into from
Mar 5, 2020
Merged

targets/nexys4ddr: fix sdcard clocker initialization #408

merged 1 commit into from
Mar 5, 2020

Conversation

gsomlo
Copy link
Collaborator

@gsomlo gsomlo commented Mar 4, 2020

Following the new clocker from enjoy-digital/litesdcard@2d4230c this is my attempt to get the nexys4ddr to successfully build using --with-sdcard once again. Based on my experiments, one would now have to go with at least

sdclk 20
sdinit
sdtest 8

from the LiteX bios command line. Anything below 20 and initialization fails for me (rocket cpu at sys_clk_freq=67e6 -- the maximum that will pass timing for rocket when --with-ethernet is also selected).

@enjoy-digital PTAL at the new add_period_constraint() statements in particular, as I'm not sure period_ns(self.sys_clk_freq)) is the right value for the constraints (in fact I'm not sure I understand how that part works at all, so if you can explain or point me to where I can figure it out more easily, I'd appreciate that too :) )

@enjoy-digital
Copy link
Owner

Thanks. The PR is fine and we can use the add_period_constraint() you added. Initially, the SD Card clock is initialized to 10MHz, but we change it dynamically to increase it after initialization has been done so we need to the constraints to the maximum frequency we are going to use. Here using sys_clk_freq seems fine.

It's possible to the S7MMCM is configuring the MMCM multipliers/dividers differently than what we were doing previously in SDClockerS7. So the current update we are doing on the dividers is probably not correct, which would explain why it only works with sdclk 20 We should probably reuse similar code than what is used by Antmicro for the Linux driver in the BIOS. (I will look at that).

@enjoy-digital enjoy-digital merged commit 361b6a0 into enjoy-digital:master Mar 5, 2020
@gsomlo gsomlo deleted the gls-fix-nexys-sdcard branch March 5, 2020 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants