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

FIX: fix vcu118 sd card frequency #1685

Merged
merged 5 commits into from
Dec 21, 2023
Merged

FIX: fix vcu118 sd card frequency #1685

merged 5 commits into from
Dec 21, 2023

Conversation

T-K-233
Copy link
Member

@T-K-233 T-K-233 commented Dec 5, 2023

The Chisel code is using MHz as the frequency base unit, while the C code is using Hz, so we need to convert between these two units to get the correct SPI clock frequency to drive the SD card.

The SPI clock frequency is set to "High Speed" mode (25 MHz) [1] [2], which should be supported by all modern SD cards. If the clock is not working, user should try to decrease to normal mode (12.5 MHz) by changing the macro definition in sd.c:

before:

#deifine SPI_CLK      25000

after:

#deifine SPI_CLK      12500

The High Speed clock is tested on the SanDisk Ultra 32G HC I SD card.

Reference
[1] https://www.cactus-tech.com/wp-content/uploads/2019/03/An-Introduction-To-SD-Card-Interface.pdf
[2] https://en.wikipedia.org/wiki/SD_card#:~:text=Supports%20a%20clock%20frequency%20of,could%20transfer%20104%20MB%2Fs.

Related PRs / Issues:

Type of change:

  • Bug fix
  • New feature
  • Other enhancement

Impact:

  • RTL change
  • Software change (RISC-V software)
  • Build system change
  • Other

Contributor Checklist:

  • Did you set main as the base branch?
  • Is this PR's title suitable for inclusion in the changelog and have you added a changelog:<topic> label?
  • Did you state the type-of-change/impact?
  • Did you delete any extraneous prints/debugging code?
  • Did you mark the PR with a changelog: label?
  • (If applicable) Did you update the conda .conda-lock.yml file if you updated the conda requirements file?
  • (If applicable) Did you add documentation for the feature?
  • (If applicable) Did you add a test demonstrating the PR?
  • (If applicable) Did you mark the PR as Please Backport?

Copy link
Contributor

@jerryz123 jerryz123 left a comment

Choose a reason for hiding this comment

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

I don't understand the change/hack, but this is fine.

@T-K-233
Copy link
Member Author

T-K-233 commented Dec 5, 2023

I don't understand the change/hack, but this is fine.

will add more information after I fully test it

@T-K-233 T-K-233 self-assigned this Dec 21, 2023
@T-K-233 T-K-233 marked this pull request as ready for review December 21, 2023 06:40
@T-K-233 T-K-233 merged commit 830264d into main Dec 21, 2023
52 checks passed
@T-K-233 T-K-233 deleted the fix-vcu118 branch December 21, 2023 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants