Hi,
I got a basic Arduino Ethernet Shield with micro SD slot on a MEGA. It all worked fine for a couple of weeks (Ethernet and SD-Card), but now not even the "Card Info" example works.
What's surprising me is that I allways get a high (measured with voltmeter) on the "chipSelect-Pin (Pin 4)" when the card init starts. Shouldn't that be a low if I want to use the SD-Card?
Thanks for any help and a nice christmas to everybody
Slightly modified example code:
// include the SD library:
#include <SD.h>
// set up variables using the SD utility library functions:
Sd2Card card;
SdVolume volume;
SdFile root;
// change this to match your SD shield or module;
// Arduino Ethernet shield: pin 4
// Adafruit SD shields and modules: pin 10
// Sparkfun SD shield: pin 8
const int chipSelect = 4;
void setup()
{
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
Serial.print("\nInitializing SD card...");
pinMode(53, OUTPUT); // change this to 53 on a mega
digitalWrite(53, HIGH);
pinMode(10, OUTPUT); // change this to 53 on a mega
digitalWrite(10, HIGH);
digitalWrite(chipSelect, LOW);
delay(3000);
// we'll use the initialization code from the utility libraries
// since we're just testing if the card is working!
if (!card.init(SPI_HALF_SPEED, chipSelect)) {
Serial.println("initialization failed. Things to check:");
Serial.println("* is a card is inserted?");
Serial.println("* Is your wiring correct?");
Serial.println("* did you change the chipSelect pin to match your shield or module?");
return;
} else {
Serial.println("Wiring is correct and a card is present.");
}
}
void loop(void) {
}