@@ -102,7 +102,9 @@ void setup() { | |||
Serial.print("yieldCalls "); | |||
Serial.println(yieldCalls); | |||
Serial.print("yieldMaxUsec "); | |||
Serial.println(yieldMaxUsec); | |||
Serial.println(yieldMaxUsec); | |||
Serial.print("kHzSdClk "); | |||
Serial.println(sd.card()->kHzSdClk()); | |||
Serial.println("Done"); | |||
} | |||
@@ -62,6 +62,8 @@ class SdioCard : public BaseBlockDriver { | |||
uint32_t errorData(); | |||
/** \return error line for last error. Tmp function for debug. */ | |||
uint32_t errorLine(); | |||
/** \return the SD clock frequency in kHz. */ | |||
uint32_t kHzSdClk(); | |||
/** | |||
* Read a 512 byte block from an SD card. | |||
* |
@@ -274,7 +274,7 @@ static void setSdclk(uint32_t kHzMax) { | |||
while ((F_CPU/(sdclkfs*dvs) > maxSdclk) && (dvs < DVS_LIMIT)) { | |||
dvs++; | |||
} | |||
m_sdClkKhz = F_CPU/(sdclkfs*dvs); | |||
m_sdClkKhz = F_CPU/(1000*sdclkfs*dvs); | |||
sdclkfs >>= 1; | |||
dvs--; | |||
@@ -471,6 +471,10 @@ uint32_t SdioCard::errorLine() { | |||
return m_errorLine; | |||
} | |||
//----------------------------------------------------------------------------- | |||
uint32_t SdioCard::kHzSdClk() { | |||
return m_sdClkKhz; | |||
} | |||
//----------------------------------------------------------------------------- | |||
bool SdioCard::readBlock(uint32_t lba, uint8_t* buf) { | |||
uint8_t aligned[512]; | |||