Go Down

Topic: Arduino Ethernet shield and SD card (Read 1 time) previous topic - next topic

megaAD

Hi there!
I'm using Arduino Mega R2 with Ethernet shield R2 for some time now, it works flawlessly.
Now I received new Arduino Mega R3 and Ethernet shield R3 and I started having some issues: the same program that works well with Mega R2 + Ether R2, would start up with error reading SD card. I checked the formatting of the (new) card (using SD Formatter, as adviced in other post), tried to use the old card and still the problem would be there. Then I tested some different setups:
(Mega + Shield)
R2 + R2
R2 + R3
R3 + R3
- I found out that the problem occurs when running with the R3 shield: I will have problem with the SD card not found only if I have no external power supply.
- If I start with USB power, there will be the SD not found error, if I plug the external power and reset the Mega, still the error will come up; If then I take the SD out and put it back again in and reset the Mega, then it will work.
- With R2 + R2 I still get a good result
Does this makes any sense to anyone?
Of course I can run the setup with external power supply, but It would be great to know what might be the issue.
Any ideas?
Thanks you guys!

SurferTim

Can you post the setup() function from your sketch? Sometimes it is the way the two devices are initialized.


megaAD

Hi there!
here goes:

void setup()
{
  Serial.begin(9600);
  pinMode(10, OUTPUT); 
  digitalWrite(10, HIGH); //so that SPI will work
  pinMode(53, OUTPUT); //so that SPI will work
  pinMode(4, OUTPUT);
  delay(100); //some time to stabilize outputs
 
  if (!SD.begin(4))
  {
    Serial.println("SD card failed or not present");.
    return;
   }
  ...
}

Thanks!


megaAD

Yes, and it works perfectly with Mega R2.
Only with the other combinations I need the external power supply to make it work... hmmm :~

Go Up