Skip to content

sd package: sdcard package redesign - #639

Open
soypat wants to merge 27 commits into
devfrom
sdcard-refactor
Open

sd package: sdcard package redesign#639
soypat wants to merge 27 commits into
devfrom
sdcard-refactor

Conversation

@soypat

@soypat soypat commented Jan 14, 2024

Copy link
Copy Markdown
Contributor

New Features:

  • Idiomatic CSD V1,V2 support with V3 API compatibility
  • No heap allocations
  • Complete error handling
  • CRC support
  • Design for interface compatibility with other SDCard implementations i.e. Using raw SDIO with a Raspberry Pi Pico.
  • Added tests for what is testable
  • Renamed ReadData to more idiomatic ReadBlock, same with Write methods
  • More checks for OOB write/read requests
  • Allow multi block writing and multi block reading in a double method interface, making it easier to use.
  • Easily enable highest transfer rate available for SDCard using CSD

Is still a WIP. CRC7 still does not work and I'm getting errors on ever other ReadBlock call.

@soypat
soypat marked this pull request as ready for review January 15, 2024 04:34
@bgould

bgould commented Jan 15, 2024

Copy link
Copy Markdown
Member

Is it possible to make this implement BlockDevice so that it is natively compatible with tinyfs? Skimming definitions.go, it looks there are some similar methods in there

https://github.com/tinygo-org/tinyfs/blob/release/tinyfs.go#L43

@soypat

soypat commented Jan 15, 2024

Copy link
Copy Markdown
Contributor Author

@bgould Will do, but I'll do it through another type that uses the ReadBlocks/WriteBlocks interface set to implement the tinyfs.BlockDevice interface. Already had this in mind as the next addition to sd

@soypat

soypat commented Jan 15, 2024

Copy link
Copy Markdown
Contributor Author

@soypat
soypat marked this pull request as draft January 16, 2024 02:37
@soypat
soypat marked this pull request as ready for review January 16, 2024 03:47
@soypat

soypat commented Jan 16, 2024

Copy link
Copy Markdown
Contributor Author

@bgould OK, I've finished the sd.BlockDevice type, seems to be working OK. Check it out and let me know what you think :)

@deadprogram

deadprogram commented Jan 23, 2024

Copy link
Copy Markdown
Member

@soypat would you perhaps be able to add a README with some small explanation about how this works?

For example what is rustref.go do? 😸

@soypat

soypat commented Jan 23, 2024

Copy link
Copy Markdown
Contributor Author

OK, added a Readme and switched some filenames around to make navigation easier.

@deadprogram

Copy link
Copy Markdown
Member

@bgould have you had a chance to try this out yet?

@deadprogram
deadprogram requested a review from bgould April 1, 2024 06:44
@deadprogram

Copy link
Copy Markdown
Member

Paging Dr. @bgould 😸 any chance to try this out?

@soypat

soypat commented Sep 8, 2025

Copy link
Copy Markdown
Contributor Author

I need this for a class I'll be teaching in 1.5 weeks :)

@soypat

soypat commented Jul 9, 2026

Copy link
Copy Markdown
Contributor Author

Can we merge this?

@deadprogram

Copy link
Copy Markdown
Member

You should add something to smoketest.sh right? And maybe just a couple more docs, perhaps borrow some from the sdcard driver this is intended to "replace".

Thanks!

Comment thread sd/spicard.go
Comment thread sd/responses.go
Comment thread sd/definitions.go
Comment thread sd/definitions.go
Comment thread sd/blockdevice.go
Comment thread sd/blockdevice.go
@soypat

soypat commented Jul 28, 2026

Copy link
Copy Markdown
Contributor Author

Found a huge number of bugs after checking against Zephyr/Linux reference and also added EraseBlock and multiblock read/write optimization based on these. Ready for another review!

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.

3 participants