I’m trying to determine what might be the trouble. Formatting issue? Ideas? We’re stuck!
The printout follows:
Code: Select all
uint8_t SdReader::init(uint8_t slow) {
uint8_t ocr[4];
uint8_t r;
Serial.println(71);
pinMode(SS, OUTPUT);
digitalWrite(SS, HIGH);
pinMode(MOSI, OUTPUT);
pinMode(MISO_PIN, INPUT);
pinMode(SCK, OUTPUT);
Serial.println(72);
#if SPI_INIT_SLOW
// Enable SPI, Master, clock rate f_osc/128
SPCR = (1 << SPE) | (1 << MSTR) | (1 << SPR1) | (1 << SPR0);
#else // SPI_INIT_SLOW
// Enable SPI, Master, clock rate f_osc/64
SPCR = (1 << SPE) | (1 << MSTR) | (1 << SPR1);
#endif // SPI_INIT_SLOW
// must supply min of 74 clock cycles with CS high.
for (uint8_t i = 0; i < 10; i++) spiSend(0XFF);
Serial.println(73);
// next two lines prevent re-init hang by cards that were in partial read
spiSSLow();
for (uint16_t i = 0; i <= 512; i++) spiRec();
Serial.println(74);
// command to go idle in SPI mode
for (uint8_t retry = 0; ; retry++) {
Serial.println(741);
if ((r = cardCommand(CMD0, 0)) == R1_IDLE_STATE) break;
if (retry == 10) {
error(SD_CARD_ERROR_CMD0, r);
return false;
}
}
Serial.println(75);
690
1
71
72
73
74
741
741
690
51
71
72
73
74
741
741
741
741
741
741
741
741
741
741
741
10