SPI2 On STM32F44RE not working with SD Card
Hi,
Have this working on STM32F302R8 but cannot seem to get my SD Card working on an STM32F446RE. Using hal 0.23.0 with stm32F446 and embedded-sdmm 0.9.0);
let sd_mosi = gpiob.pb15.into_alternate::<5>();
let sd_miso = gpiob.pb14.into_alternate::<5>();
let sd_sck = gpiob.pb13.into_alternate::<5>();
let mut sd_spi = Spi::new(
dp.SPI2,
(Some(sd_sck), Some(sd_miso), Some(sd_mosi)),
Mode {
polarity: Polarity::IdleLow,
phase: Phase::CaptureOnFirstTransition,
},
400.kHz(),
&mut rcc,
);
let sd_spi_dev = ExclusiveDevice::new_no_delay(sd_spi, sd_cs).unwrap();
rprintln!("Reading file...");
let num_bytes = sdcard.num_bytes().unwrap();
rprintln!("SD Card Size: {} bytes", num_bytes);Which gives
[2026-03-01T05:30:04.085Z, +020837ms] panicked at both_test/src/main.rs:184:40:
[2026-03-01T05:30:04.085Z, +020837ms] called `Result::unwrap()` on an `Err` value: CardNotFoundVery new to all this but certain of wiring. The SD Adaptor has an Ams117 chip but I have tried in 3.3V 5V, tried lower speeds, set CS high, etc with no joy. Added 4.7k pullup to CS.
I can move it back to F302R8 and it works straight away.
Thanks all
