arduino-libraries / SD

SD Library for Arduino
http://arduino.cc/
GNU General Public License v3.0
179 stars 155 forks source link

Arduino Ethernet Shield R3, SD Card crashes arduino when library included. #13

Open agdl opened 8 years ago

agdl commented 8 years ago

From @kylemaes on December 9, 2012 23:56

Any time I use the Ethernet shield and include the SD library my Ethernet doesn't function and the Arduino reboots randomly and does weird things. The SD card can be written to and I have not yet tested reading with the Ethernet on, but the Ethernet once again refuses to function properly (when #include is in the code)...

Copied from original issue: arduino/Arduino#1159

agdl commented 8 years ago

From @lestofante on December 10, 2012 0:3

Ethernet and sd share the spi connection. You have to use the enable pin to activate only one shield at time. Also pay attention to interrupt, the solution can be a little hard.

agdl commented 8 years ago

From @rnearhoof on January 22, 2013 20:49

I'm not sure if you have this problem solved, but I had the exact same issue on an Uno R3 that ended up being a memory limit.
I was allocating a 1K buffer in the code preamble and the SD card + ethernet libraries use enough memory that it went over the edge. Interestingly, the size of the binary after compiling was only 17,972 bytes (of a 32,256 byte maximum), so I never looked in that direction, but changing my 1K buffer to 512 bytes solved all of the issues. I found the problem when I ran the same code on an mega2560 and it worked like a charm.