Go Down

Topic: SD Card wont initialize - SainSmart Arduino uno and ethernet shield  (Read 6785 times) previous topic - next topic

Peter_n

I think you have this shield : http://www.sainsmart.com/sainsmart-ethernet-shield-w5100-for-arduino.html
It is not a 'R3' version, but it has the ICSP header at the bottom, so it should work.
But perhaps only if you have set the Uno to 5V.

fat16lib

Sorry, I forgot the sainsmart 3.3 - 5 v switch.  It must be at 5 v.

djx18

Sorry, I forgot the sainsmart 3.3 - 5 v switch.  It must be at 5 v.
Yes, I tried that too. I set it to 5V and it didnt work with the SainSmart shield but the SeedStudio ethernet shield worked fine with the Sain Smart Arduino.

Okay now I have another problem!! The SeedStudio ethernet (the one i bought from Radio Shack) wont initialize!! The SainSmart ethernet has been working with no issues and I was able to reach my server. But the same code doesn't work on the Seed Studio shield. (Do I just have that much bad luck that its another hardware problem??)


Peter_n

You have tell exactly which shield and which board you use together. It might be a compatibility problem. Or did it work before ?

This is indeed getting confusing. When you would have bought the official Arduino boards they are version 'R3', and it should work right out of the box.
The Arduino boards have been updated to version 'R3'. Those boards are compatible with other 'R3' boards and shields, and the shields are able to automatically switch between 5V and 3.3V (the Arduino Due runs at 3.3V).

Perhaps you would have less problems when you bought the cheapest 'R3' compatible boards from Ebay. In my experience only 1 in 10 does not work.

SurferTim

Quote
The SeedStudio ethernet (the one i bought from Radio Shack) wont initialize!!
The newer ethernet shields from Radio Shack have the w5200 ethernet controller onboard. Is it this one?
http://www.seeedstudio.com/wiki/Ethernet_Shield_V2.0
If so, you must download and install the Ethernet Shield V2.0 library for that controller from that page.

djx18

The newer ethernet shields from Radio Shack have the w5200 ethernet controller onboard. Is it this one?
http://www.seeedstudio.com/wiki/Ethernet_Shield_V2.0
If so, you must download and install the Ethernet Shield V2.0 library for that controller from that page.

Yes you are right. I got the sample app working with the Ethernet V2.0 library. I am still struggling to get my application working. ( I need to debug further and see what the problem is). I got it to initialize but it wont serve anything.

SurferTim

I use a w5100 shield and Mega 2560, and my server code with a SD works great.
http://playground.arduino.cc/Code/WebServerST
You can do me a favor and try it with your w5200. Insure you change the includes as specified for the w5200. Let me know if it works ok.

djx18

I use a w5100 shield and Mega 2560, and my server code with a SD works great.
http://playground.arduino.cc/Code/WebServerST
You can do me a favor and try it with your w5200. Insure you change the includes as specified for the w5200. Let me know if it works ok.

SurferTim, yes that sample works great!!

An existing app which I found online uses SD2Card method of reading files. When I use the Sd2Card method the Ethernet doesnt initialize with the new EthernetV2. Using the SD.readfile(...) method works but why wouldnt the other older method work anymore?

Sd2Card card;
SdVolume volume;
SdFile root;
SdFile file;

SurferTim

Be more specific. What is the indication the ethernet initialization doesn't work?

Post a link to the SD2Card app. I'll take a look at it.

Also post the setup() function from your code that doesn't work.

edit: Maybe you can do a favor for me. :) I need someone with the Seeed Studio library installed to test a new function I installed in w5200.h. It allows you to check if the ethernet interface is up or not. That is available only with the w5200, and I have a w5100.

If you are up to the test, let me know and I will post the new w5200.h file and the test sketch. Let me know if you are using Windows or Linux OS.

djx18

Sure would love to help! I am on Windows or OSX.


This is what I am building:

http://forum.arduino.cc/index.php?topic=256405.0

This is the Arduino code I am trying to run. http://forum.arduino.cc/index.php?action=dlattach;topic=256405.0;attach=89519

 But with Ethernet V2 and the SD2 method the server doesn't run meaning the Browser can not connect to the Arduino there is nothing running on port 80 on my Arduino's IP. This Home Audio Ethernet application runs fine when I don't use the SD2 method of reading the card.


SurferTim

First the errors. This is incorrect. You forgot the dns server parameter.
Code: [Select]
// change this
  Ethernet.begin(mac, ip, gateway, subnet);
// to this
  Ethernet.begin(mac, ip, gateway, gateway, subnet);


The only thing I see different from the SD.begin() call and your code is the SPI bus speed. Maybe the speed is too high? Try a slower speed.
Code: [Select]
// charge this
  card.init(SPI_FULL_SPEED, 4);
// to this
  card.init(SPI_HALF_SPEED, 4);


If that doesn't work, try setting D4 HIGH before the Ethernet.begin() call.

Code: [Select]
// add this
  digitalWrite(4,HIGH);

  Ethernet.begin(mac, ip, gateway, gateway, subnet);


Let me know if that makes any difference, then I'll post the new w5200.h file and test sketch.

djx18

Quote
// change this
  card.init(SPI_FULL_SPEED, 4);
// to this
  card.init(SPI_HALF_SPEED, 4);
That did the trick!! The webserver and the SD Card are all finally working now! Thank you so much!
Now time to wire the rest up!


So how can I help you now?? Let me know what you need me to test!!!

SurferTim

I attached the new w5200.h file and the test sketch.
Go to "My Documents/Arduino/libraries/EthernetV2_0/utility" folder.
Rename the current w5200.h file to w5200orig.h. Then move this w5200.h file into that folder.
Then compile and upload the DHCPAddressPrinterW5200.ino sketch.

It should report "interface up" or "interface down", depending on the CAT5 cable. If you leave it inserted, it should report "interface up". If you remove it, it should report "interface down".

Thanks for testing this for me. I'm looking forward to getting a w5200 shield soon.

djx18

I attached the new w5200.h file and the test sketch.
Go to "My Documents/Arduino/libraries/EthernetV2_0/utility" folder.
Rename the current w5200.h file to w5200orig.h. Then move this w5200.h file into that folder.
Then compile and upload the DHCPAddressPrinterW5200.ino sketch.

It should report "interface up" or "interface down", depending on the CAT5 cable. If you leave it inserted, it should report "interface up". If you remove it, it should report "interface down".

Thanks for testing this for me. I'm looking forward to getting a w5200 shield soon.

Just tried it but something breaks after the linkStatus call and I added a logger for the linkStatus as well but it never prints it...

I adding the following loggers and nothing gets printed after "Starting..."

Code: [Select]
Serial.println("Starting....");

byte linkStatus = W5100.getPHYStatus();
 
Serial.println(linkStatus);
 
if(linkStatus & 0x20) Serial.println("interface up");
else Serial.println("interface down");

djx18

Sorry to come back to my issue... but its taking 20 seconds to serve my 20KB KAMDORA.HTM file...
Its extremely slow..

Is it because of the HALF_SPEED setting I set below?

Code: [Select]

  card.init(SPI_HALF_SPEED, 4);

Go Up