Module stm32h7xx_hal::sdmmc [−][src]
SD MultiMediaCard interface (SDMMC)
For HDHC / SDXC / SDUC cards. SDSC cards are not supported.
The H7 has two SDMMC peripherals, SDMMC1
and SDMMC2
.
IO Setup
For high speed signalling (bus clock > 16MHz), the IO speed needs to be increased from the default.
use stm32h7xx_hal::gpio::Speed; let d0 = d0.set_speed(Speed::VeryHigh);
Usage
By default the SDMMC bus clock is derived from the pll1_q_ck
. This can be
set when initialising the RCC.
let ccdr = rcc .pll1_q_ck(100.mhz()) .freeze(pwrcfg, &dp.SYSCFG);
There is an extension trait implemented for the
SDMMC1
and SDMMC2
periperhals for easy initialisation.
// Create SDMMC let mut sdmmc = dp.SDMMC1.sdmmc( (clk, cmd, d0, d1, d2, d3), ccdr.peripheral.SDMMC1, &ccdr.clocks, );
The next step is to initialise a card. The bus speed is also set.
if let Err(err) = sdmmc.init_card(10.mhz()) { info!("Init err: {:?}", err); }
The card()
method returns useful information about
the card.
let card = sdmmc.card(); if let Some(card) = sdmmc.card() { info!("SD Card Connected: {:?}", card); }
Structs
Card | SD Card |
Sdmmc | Sdmmc device |
Enums
Error | Errors |
Signalling | The signalling scheme used on the SDMMC bus |
Traits
PinClk | |
PinCmd | |
PinD0 | |
PinD1 | |
PinD2 | |
PinD3 | |
PinD4 | |
PinD5 | |
PinD6 | |
PinD7 | |
Pins | |
SdmmcExt | Extension trait for SDMMC peripherals |