Closed nbc12 closed 8 months ago
Nevermind, this fixed it. Just have to set the config like is done in the examples.
let mut config = Config::default();
{
use embassy_stm32::rcc::*;
config.rcc.hse = Some(Hse {
freq: Hertz(8_000_000),
mode: HseMode::Bypass,
});
config.rcc.pll_src = PllSource::HSE;
config.rcc.pll = Some(Pll {
prediv: PllPreDiv::DIV4,
mul: PllMul::MUL168,
divp: Some(PllPDiv::DIV2), // 8mhz / 4 * 168 / 2 = 168Mhz.
divq: Some(PllQDiv::DIV7), // 8mhz / 4 * 168 / 7 = 48Mhz.
divr: None,
});
config.rcc.ahb_pre = AHBPrescaler::DIV1;
config.rcc.apb1_pre = APBPrescaler::DIV4;
config.rcc.apb2_pre = APBPrescaler::DIV2;
config.rcc.sys = Sysclk::PLL1_P;
}
let p = embassy_stm32::init(config);
I'm trying to use a SDMMC card on my stm32f401rc, but when I run init_card, I get this over defmt:
I think Sdmmc::init_card unwraps a None. I think I've tracked it to the
kernel_clk
macro inembassy-stm32::sdmmc
, but IDK what else to do with it.My SDMMC IC is a MKDV2GCL-NE, the datasheet is here. The datasheet says D3 has to be driven high in order for it to go into SD mode. ~Does it have something to do with that?~ Edit: Nevermind, I did p.PC11.set_high() before creating the sdmmc object, and nothing chnaged.
Anyway, here's a minimal example.
Note that I don't even do anything with the Result, it unwraps in the call stack of init_card somewhere.
Here is the dependencies section of Cargo.toml
I'm on
nightly-x86_64-pc-windows-msvc
,rustc 1.78.0-nightly (3246e7951 2024-02-19)
Thanks for all the hard work, I'm really enjoying using embassy!