Loading...
Pages: 1 [2]   Go Down
Author Topic: MicroSD not able to initialize often  (Read 2972 times)
0 Members and 1 Guest are viewing this topic.
Miramar Beach, Florida
Offline Offline
Faraday Member
**
Karma: 50
Posts: 3448
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I agree with some, but not all. If you leave the SD SPI floating while starting the w5100, you will eventually have trouble. Maybe not all the time, but enough to be annoying, normally noticeable on a reboot.
Code:
void setup()
{
  Serial.begin(9600);

  // disable SD SPI while starting w5100
  // or you will have trouble
  pinMode(4, OUTPUT);
  digitalWrite(4,HIGH);   

  Ethernet.begin(mac, ip);
  server.begin();
 
  Serial.print("server is at ");
  Serial.println(Ethernet.localIP());
 
  // this corrects a bug in the Ethernet.begin() function
  // even tho the call to Ethernet.localIP() does the same thing
  digitalWrite(10,HIGH);
 
  if (!SD.begin(4))
     Serial.println("SD initialization failed.");
  // SD.begin() returns with the SPI disabled, so you need not disable it here
   
  Serial.print("server is (still?) at ");
  Serial.println(Ethernet.localIP());   
     
}
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 15
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Cool!  That works, and is so simple even I can understand it.

Thanks SurferTim. smiley
Logged

Pages: 1 [2]   Go Up
Print
 
Jump to: