stm32/sdmmc: add init_card retry.

This commit is contained in:
Dario Nieuwenhuis 2023-04-17 21:48:47 +02:00
parent 0dfa192992
commit 82dd7a5f8c

View File

@ -39,7 +39,18 @@ async fn main(_spawner: Spawner) {
// Should print 400kHz for initialization
info!("Configured clock: {}", sdmmc.clock().0);
unwrap!(sdmmc.init_card(mhz(48)).await);
let mut err = None;
loop {
match sdmmc.init_card(mhz(24)).await {
Ok(_) => break,
Err(e) => {
if err != Some(e) {
info!("waiting for card error, retrying: {:?}", e);
err = Some(e);
}
}
}
}
let card = unwrap!(sdmmc.card());