Fix iinitialization for older cards
This commit is contained in:
parent
7417ee943c
commit
356c5e417c
5 changed files with 18 additions and 7 deletions
|
|
@ -1,5 +1,5 @@
|
|||
name=SdFat
|
||||
version=1.0.11
|
||||
version=1.0.12
|
||||
author=Bill Greiman <fat16lib@sbcglobal.net>
|
||||
maintainer=Bill Greiman <fat16lib@sbcglobal.net>
|
||||
sentence=FAT16/FAT32 file system for SD cards.
|
||||
|
|
|
|||
|
|
@ -120,6 +120,11 @@ const uint8_t SD_CARD_TYPE_SDHC = 3;
|
|||
#define SPI_SIXTEENTH_SPEED SD_SCK_HZ(F_CPU/32)
|
||||
//------------------------------------------------------------------------------
|
||||
// SD operation timeouts
|
||||
/** CMD0 loop delay ms */
|
||||
const uint16_t SD_CMD0_DELAY = 100;
|
||||
/** init timeout ms */
|
||||
/** command timeout ms */
|
||||
const uint16_t SD_CMD_TIMEOUT = 300;
|
||||
/** init timeout ms */
|
||||
const uint16_t SD_INIT_TIMEOUT = 2000;
|
||||
/** erase timeout ms */
|
||||
|
|
|
|||
|
|
@ -143,6 +143,7 @@ bool SdSpiCard::begin(SdSpiDriver* spi, uint8_t csPin, SPISettings settings) {
|
|||
error(SD_CARD_ERROR_CMD0);
|
||||
goto fail;
|
||||
}
|
||||
delayMS(SD_CMD0_DELAY);
|
||||
}
|
||||
#if USE_SD_CRC
|
||||
if (cardCommand(CMD59, 1) != R1_IDLE_STATE) {
|
||||
|
|
@ -208,7 +209,7 @@ uint8_t SdSpiCard::cardCommand(uint8_t cmd, uint32_t arg) {
|
|||
spiStart();
|
||||
}
|
||||
// wait if busy
|
||||
waitNotBusy(SD_WRITE_TIMEOUT);
|
||||
waitNotBusy(SD_CMD_TIMEOUT);
|
||||
|
||||
#if USE_SD_CRC
|
||||
// form message
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@
|
|||
#endif // INCLUDE_SDIOS
|
||||
//------------------------------------------------------------------------------
|
||||
/** SdFat version */
|
||||
#define SD_FAT_VERSION "1.0.11"
|
||||
#define SD_FAT_VERSION "1.0.12"
|
||||
//==============================================================================
|
||||
/**
|
||||
* \class SdBaseFile
|
||||
|
|
|
|||
|
|
@ -36,22 +36,27 @@
|
|||
#else // defined(ARDUINO)
|
||||
#error "Unknown system"
|
||||
#endif // defined(ARDUINO)
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
#ifdef ESP8266
|
||||
// undefine F macro if ESP8266.
|
||||
#undef F
|
||||
#endif // ESP8266
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
#ifndef F
|
||||
/** Define macro for strings stored in flash. */
|
||||
#define F(str) (str)
|
||||
#endif // F
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
/** \return the time in milliseconds. */
|
||||
inline uint16_t curTimeMS() {
|
||||
return millis();
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
/** Delay milliseconds */
|
||||
inline void delayMS(uint16_t ms) {
|
||||
delay(ms);
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
* \class SysCall
|
||||
* \brief SysCall - Class to wrap system calls.
|
||||
|
|
|
|||
Loading…
Reference in a new issue