From: Will Sowerbutts Date: Sun, 15 Feb 2015 22:20:57 +0000 (+0000) Subject: devsd: Fix for picky cards X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=ee61ebbb568a8e552c6da17994551783c9947bcc;p=FUZIX.git devsd: Fix for picky cards --- diff --git a/Kernel/dev/devsd.c b/Kernel/dev/devsd.c index e39a9efb..667447f1 100644 --- a/Kernel/dev/devsd.c +++ b/Kernel/dev/devsd.c @@ -104,7 +104,7 @@ int sd_send_command(uint8_t drive, unsigned char cmd, uint32_t arg) } /* Select the card and wait for ready */ - sd_spi_raise_cs(drive); + sd_spi_release(drive); /* raise CS, then sends 8 clocks (some cards require this) */ sd_spi_lower_cs(drive); if(sd_spi_wait(drive, true) != 0xFF) return 0xFF; @@ -133,7 +133,7 @@ int sd_send_command(uint8_t drive, unsigned char cmd, uint32_t arg) /* Receive command response */ if (cmd == CMD12) sd_spi_receive_byte(drive); /* Skip a stuff byte when stop reading */ - n = 10; /* Wait for a valid response in timeout of 10 attempts */ + n = 20; /* Wait for a valid response */ do{ res = sd_spi_receive_byte(drive); }while ((res & 0x80) && --n);