# working ethernet sketch, but stops after SD card info code added in

**URL:** <https://forum.arduino.cc/t/working-ethernet-sketch-but-stops-after-sd-card-info-code-added-in/352062>\
**Category:** Sensors\
**Created:** [December 11, 2015, 6:28pm UTC](https://forum.arduino.cc/t/working-ethernet-sketch-but-stops-after-sd-card-info-code-added-in/352062 "2015-12-11T18:28:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![twilkers](https://avatars.discourse-cdn.com/v4/letter/t/8491ac/32.png) [@twilkers](https://forum.arduino.cc/u/twilkers)\
**Post date:** [December 11, 2015, 6:28pm UTC](https://forum.arduino.cc/t/working-ethernet-sketch-but-stops-after-sd-card-info-code-added-in/352062/1 "2015-12-11T18:28:16Z")

</div>

Hi,

I have a working sketch measuring temperature and pushing it to a web page using Uno and ethernet shield with POE. I haven't yet used the POE.

when I add in the SD card info code, the ethernet stops working. same symptom if SD card is in or out.

I know they both use the same SPI bus. In another comment it was stated this potential contention should be handled automatically. unfortunately, it doesn't seem to be at least for me.

using 1.6.5 GUI and just pulled from the examples. Code below.

my plan was send the temperature data to the SD card since the ram inside uno is so tiny.

thanks in advance,

[temp\_\_sensing\_sketch\_nov28a\_w\_SD.ino](https://forum.arduino.cc/uploads/short-url/86wnNnVAWDx3euNsALFr73Izpe3.ino) (12.7 KB)

---

<div class="post-metadata">

**Author:** ![Koepel](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/koepel/32/637546_2.png) [@Koepel](https://forum.arduino.cc/u/Koepel)\
**Post date:** [December 12, 2015, 1:05am UTC](https://forum.arduino.cc/t/working-ethernet-sketch-but-stops-after-sd-card-info-code-added-in/352062/2 "2015-12-12T01:05:11Z")

</div>

Most of use move forward to an Arduino Mega 2560 when using the Ethernet Shield.

Download the newest Arduino IDE 1.6.6  
I get a warning : Global variables use 2052 bytes, and there is only 2048.

You can't even use the full 2048, because some ram is needed for the stack and temporary variables.

Use the 'F()' macro with every Serial.println and Serial.print.  
You might do that as well for the client.print and client.println. I think that has a disadvantage, every byte will be transmitted as a seperate packet over the internet.

If the card info part is causing trouble, remove it.  
Just use the normal SD functions as in the examples that use both Ethernet and SD.

Perhaps you should make the SPI bus idle before using it. Set pin 4 and 10 to output and high. Those are the chip select for the SPI devices.

---

<div class="post-metadata">

**Author:** ![twilkers](https://avatars.discourse-cdn.com/v4/letter/t/8491ac/32.png) [@twilkers](https://forum.arduino.cc/u/twilkers)\
**Post date:** [December 12, 2015, 2:17am UTC](https://forum.arduino.cc/t/working-ethernet-sketch-but-stops-after-sd-card-info-code-added-in/352062/3 "2015-12-12T02:17:00Z")

</div>

1.6.5 said I had 4 or 6 bytes left, not a lot, but something. I'll order the mega. 2k is brutally constraining.

I'll also upgrade to the 1.6.6

Thanks,  
Tim

---

<div class="post-metadata">

**Author:** ![Koepel](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/koepel/32/637546_2.png) [@Koepel](https://forum.arduino.cc/u/Koepel)\
**Post date:** [December 12, 2015, 2:19am UTC](https://forum.arduino.cc/t/working-ethernet-sketch-but-stops-after-sd-card-info-code-added-in/352062/4 "2015-12-12T02:19:42Z")

</div>

Meanwhile, use the 'F()' macro.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [May 6, 2021, 10:11am UTC](https://forum.arduino.cc/t/working-ethernet-sketch-but-stops-after-sd-card-info-code-added-in/352062/5 "2021-05-06T10:11:35Z")

</div>


