sdmmc: add example for initializing sdcard #16
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi all,
Over the past few weeks, I've developed a demo program to interface with SDHC peripherals. The current version successfully initializes the peripherals and SD cards, reads the CID register, and outputs the results. The program has been tested and runs on the development board(nezha-d1), with the output shown below:
Key Challenges and Solutions:
Configuring SDHC peripherals involved selecting the appropriate clock source and calculating parameters accurately. The oreboot project helped as a reference. I also encountered a register operation bug that took some time to find, and it is now fixed.
SDIO Protocol Operation:
Implementing SD card data read and write functionality using the SDIO protocol presented complexity, particularly with version compatibility and edge cases. Since no Rust crate currently supports this, I have implemented basic initialization and CID register reading for now. Future improvements could include expanding functionality or developing a general SDIO protocol library for broader use.
Flashing and Running the Program:
After compiling, the program requires a correct image header and burning using the xfel tool. I referred to the steps in [board] Rust serial output example and light up led on 100ask-d1-h YuzukiHD/SyterKit#129 to complete.
Reference
oreboot/oreboot#636
oreboot/oreboot#701
YuzukiHD/SyterKit#143
YuzukiHD/SyterKit#129
I believe that this demo will support future boot program development and help adapt frameworks like Rust SyterKit :)