WIZnet module, external power and SD card initialization problems

I have a Mega 2560, a WIZnet module like this one WIZnet W5100 Ethernet / Network Module and a cheap no-name SD card reader like this one http://www.ebay.com/itm/1pcs-SD-Card-Module-Slot-Socket-Reader-For-Arduino-ARM-MCU-NEW-/261027156072?pt=LH_DefaultDomain_0&hash=item3cc66e5068
I also use EthernetServer in my sketch to handle incoming connections. All these pieces work together quite well while my Arduino is connected to USB port on my Mac. But when I connect an external power source (1A 5V to Arduino USB , or 12V 2A to Arduino power socket) SD card doesn't want to init. I tried to feed SD card module with 3.3V instead of 5V through a dedicated pin - no changes.
The funniest part is when I comment out m_server.begin(80) in the sketch it magically works fine with external power or with USB power form my Mac.
If I replace EthernetServer init code with an EthernetClient request everything work fine either - so the Ethernet is definitely working along with SD.
What could be the reason? Should I try to use SD card module with a level shifter instead of my cheap resistor-based one? Should I try another Ethernet module/shield? I've actually ran out of ideas myself so any help is appreciated.

Here's the sketch (I use a relay here just for indication purposes):

#include "Arduino.h"
#include "SPI.h"
#include "Ethernet.h"
#include "SD.h"
#include "EthernetServer.h"

EthernetServer m_server(80);

byte mymac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress nodeIPAddress(192,168,1,60);
Sd2Card card;

void setup() {
  pinMode(10, OUTPUT);
  pinMode(53, OUTPUT);
  pinMode(5, OUTPUT); // This is a relay

  digitalWrite(5, HIGH); // Turn off the relay

  digitalWrite(53, HIGH); // Turn off SD card module
  digitalWrite(10, LOW);  // Turn on Wiznet module

  Ethernet.begin(mymac, nodeIPAddress);
  m_server.begin(); // If commented it works with external power

  digitalWrite(10, HIGH); // Turn off Wiznet module
  digitalWrite(53, LOW); // Turn on SD card module

  if (SD.begin(53)) {
    digitalWrite(5, LOW); // Turn on the relay

void loop() {


Should I try another Ethernet module/shield?

That's a really good idea. For less than half what you paid for that junk, you can get a proper Ethernet shield, complete with SD slot at no extra charge. The WIZ is a power hog, and I'm sure that's your problem. The shield gets its power from VIN and has its own regulators. I can't imagine why you would bother but, since you already have them, you might get a result with the 5v feeding the WIZ and 12v feeding Arduino.

Being able to run that lot off USB says quite a lot for the Mac, or you got lucky.

Unfortunately it seems that it's still a problem with sharing SPI bus by WIZnet and SD modules. I don't know why the USB connection affected the logic, maybe the SPI timings were affected in some way.
Anyway, perhaps this particular WIZnet module is made so it doesn't correctly handle device selection. It seems that after it starts listening to connections it just blocks SPI bus. By changing the order of init statements it is possible to init both the WIZnet and SD, but after calling m_server.begin() SD library can't see the card anymore. The only way I see now is try to use software SPI to avoid conflicts.

I use the Wiznet w5100 and SD cards together on a Mega 2560. I presume that is the Arduino you are using. Mine works powered either way, but I use a 7.5v power supply if I use Vin. That keeps the heat down on the regulator.

Actually, I prefer to use the usb cable to supply 5v power even if not connected to a computer. I use a usb cable connected to a 5v 1A phone charger.

I use D4 as the SD slave select since that is the pin used by the ethernet shield. Have you tried that?

Unfortunately it seems that it's still a problem with sharing SPI bus by WIZnet and SD modules.

People do this all the time without a problem, so I think you have left it a bit late in the development history of Arduino to start blaming the hardware. While I'm suss about the power, I submit it might be time to have a look at the code as well. I only say this because I have just done so, and I find it incomprehensible. Far be it for me to say it's my way or the highway, but Arduino.h is conspicuously absent from my library folder, and I don't have a problem. Further, it might sound arrogant, but I think I only need to look at the standard examples supplied with the IDE to get an idea of what standard procedure looks like. I suspect that, in your setup, the second line makes the first redundant, and then not a single line that follows appears to be standard procedure. I therefore submit you might use some code that is less unique and more akin with common practice, as it might remove some hidden nasties.

Thank you guys for suggestions! Well, I chose those modules just because I want to use a sensor shield which has a size of the whole Mega, and most of Ethernet shields are of the Uno form factor so they won't stack together properly. So now I'm looking towards something like EtherMega from Freetronics. A bit expensive but very convenient.
As for the software part I haven't found any really common practice on switching between multiple SPI devices one of them being WIZnet. I've found this thread Problem using both SPI library and SD library in Arduino UNO program - Networking, Protocols, and Devices - Arduino Forum describing a similar problem (shame on me I haven't found it before posting my question). And here is a bit on WIZnet itself Arduino Playground - EthernetShieldSDHardwareSPIMod.
Anyway I'll give these modules a try with SdFat library and a separate power for WIZnet before buying an alternative.

Well, I chose those modules just because I want to use a sensor shield which has a size of the whole Mega, and most of Ethernet shields are of the Uno form factor so they won't stack together properly.

Hah!... I don't know whether that is short-sighted or not, but I have had a Mega proto board sitting around for two years awaiting suitable employement. It is only now that I have encountered a stacking problem and it is only caused by a large LCD. Some of those are Mega-only. You are going to need a lot of sensors to need a Mega board, particularly if there is stuff on busses.

I'm not sure you should have much concern about the playground article, and the most relevant post in the forum thread is #9. If you use standard libraries and standard code and procedures, there shouldn't be a problem.