@@ -196,18 +196,15 @@ where
196196 while attempts > 0 {
197197 trace ! ( "Enter SPI mode, attempt: {}.." , 32i32 - attempts) ;
198198
199- // Select whether or not to skip waiting for the card not to be busy
200- // when issuing the first CMD0. See https://github.com/rust-embedded-community/embedded-sdmmc-rs/issues/33#issue-803000031 and
201- // https://github.com/rust-embedded-community/embedded-sdmmc-rs/pull/32#issue-802999340.
202- let cmd0_func = match options. skip_wait_not_busy {
203- true => Self :: card_command_skip_wait,
204- false => Self :: card_command,
205- } ;
206-
207- match cmd0_func ( s, CMD0 , 0 ) {
199+ match s. card_command ( CMD0 , 0 ) {
208200 Err ( Error :: TimeoutCommand ( 0 ) ) => {
209201 // Try again?
210202 warn ! ( "Timed out, trying again.." ) ;
203+ // Try flushing the card as done here: https://github.com/greiman/SdFat/blob/master/src/SdCard/SdSpiCard.cpp#L170,
204+ // https://github.com/rust-embedded-community/embedded-sdmmc-rs/pull/65#issuecomment-1270709448
205+ for _ in 0 ..0xFF {
206+ s. send ( 0xFF ) ?;
207+ }
211208 attempts -= 1 ;
212209 }
213210 Err ( e) => {
@@ -315,13 +312,7 @@ where
315312 /// Perform a command.
316313 fn card_command ( & self , command : u8 , arg : u32 ) -> Result < u8 , Error > {
317314 self . wait_not_busy ( ) ?;
318- self . card_command_skip_wait ( command, arg)
319- }
320315
321- /// Perform a command without waiting for the card not to be busy. This method should almost never be used directly, except in
322- /// very specific circumstances. See [https://github.com/rust-embedded-community/embedded-sdmmc-rs/issues/33]
323- /// and [https://github.com/rust-embedded-community/embedded-sdmmc-rs/pull/32] for more info.
324- fn card_command_skip_wait ( & self , command : u8 , arg : u32 ) -> Result < u8 , Error > {
325316 let mut buf = [
326317 0x40 | command,
327318 ( arg >> 24 ) as u8 ,
0 commit comments