Expand description
microSD card on the shared SPI bus (SPI2: SCK 40, MOSI 14, MISO 39,
CS 12), with FAT through embedded-sdmmc (re-exported as [fs]).
SpiBusResources::sd takes the whole bus
for the card and holds the EXT header’s chip-select (GPIO5) high, so a
module on the header (e.g. the LoRa cap) can never answer on the bus.
Sd implements [fs::BlockDevice], so the guard lives exactly as long
as the filesystem.
The card is read-only until you say otherwise. embedded-sdmmc
updates FAT bookkeeping (the FSInfo sector) even when a program only
lists a directory, which is an unwelcome surprise on a card full of
personal files. Every write returns Error::ReadOnly until
Sd::set_writable(true).
embedded-sdmmc is blocking: card I/O holds the CPU for its duration
(~25 µs per 512-byte block at 20 MHz, plus card latency). An async
block layer is future work.
Re-exports§
pub use embedded_sdmmc as fs;
Structs§
- Fixed
Time - A [
TimeSource] for boards without a real-time clock: every timestamp is 2026-01-01 00:00:00. Swap in a real clock (e.g. after network time sync) for meaningful file dates. - Sd
- An initialised microSD card.
Enums§
- Error
- SD errors.
Constants§
- FREQUENCY
- Clock after initialisation. Cards allow 25 MHz in SPI mode; 20 MHz leaves margin for the GPIO-matrix routing of these pins.
- INIT_
FREQUENCY - Clock while the card initialises (the SD spec caps it at 400 kHz).