Emmcio module - #11257
Conversation
tannewt
left a comment
There was a problem hiding this comment.
Getting better! Do we really need to guard so heavily against the emmc not coming up? Since it's on the board I'd expect it to just work.
| #if CIRCUITPY_EMMC_USB | ||
|
|
||
| #ifndef CIRCUITPY_EMMC_MOUNT_PATH | ||
| #define CIRCUITPY_EMMC_MOUNT_PATH "/sd" |
There was a problem hiding this comment.
Are we sure we want this? Or should it be /emmc?
There was a problem hiding this comment.
I had it as /emmc at first and changed it to /sd to be consistent with Yoto devices after it was mentioned that I should try to model this on the work that done in them. Personally I have no strong opinion which it uses.
|
|
||
| void emmcio_reset(void) { | ||
| // The supervisor's mount outlives the VM, so its card stays up. | ||
| if (emmcio_is_automounted()) { |
There was a problem hiding this comment.
I wonder if it'd be better to test against the default pins being defined. That way you don't need to test at runtime.
There was a problem hiding this comment.
I think checking the pins at compile time might not be sufficient. This call finding out whether the emmc is mounted by the supervisor currently, not merely whether the pins exist that could be used to mount it. The user could have disabled automount in settings.toml which would make mmcio_is_automounted() return false, but a compile time check against pins couldn't know about that being disabled in settings.toml.
| return 1; // card never left busy | ||
| } | ||
| if (!self->cmd2_resp) { | ||
| return 2; // no CID |
There was a problem hiding this comment.
Please use a macro to make these readable. I suspect you have them elsewhere as macros already.
There was a problem hiding this comment.
Used a macro and improved this in the latest commit. I found some named constants instead of hard-coded numbers to use as well.
# Conflicts: # locale/circuitpython.pot # ports/nordic/supervisor/port.c
adds
emmciomodule with support for auto-mounting at/sd.Some changes based on feedback in the prior PR:
automount_status(), it had no analogy in sdcardio or sdioio.Currently compile tested only. Testing on hardware requires SP-1 board def which I'm working on next and then will make a local merged branch to validate the behavior of this branch. Will un-draft after it's tested
Question from previous PR review:
The module isn't speaking SPI. It's the 1-bit MMC bus: a clock, a bidirectional CMD line, and a bidirectional DAT0 line. SPIM3 is being used as a raw shift-and-clock engine on a single wire, not as a SPI primary/controller. MOSI and MISO are the same pin, rebound per transfer. The DMA transfer happens mid-frame, between bit-banged phases.