Forum >Ethernet shield v2.0
ArduinoGeneral

Ethernet shield v2.0

userHead stratosg 2011-12-15 11:26:27 4655 Views2 Replies
Hello,

I have this problem with the shield. I put it on the Mega 2560 arduino and connect the usb. I have my sketch read from the sdcard and I read with no problems. I then put the ethernet cable on, the shield leds light up and I reset my board. Then the sdcard read fails with the error code 1 and the message of "do not reformat. SPI problem?". Is ethernet and SD (the microSD that the new shield has) supposed to work at the same time or is one exclusive of the other?

Also, when I disconnected my ethernet I still couldn't read from the SD (even resetting the board didn't do it) until I took the usb cable off and let it stay for five seconds before plugging in again...

Thanks for any help!

PS: I looked around trying to find if anyone has the same problem but as I see I think I am the first? Maybe I am doing something wrong?
2011-12-20 20:48:12 Hector,

Just to update this thread, maybe someone else will be as clueless as I was :) I searched a lot and found the solution to the problem.

So the problem was in two places: one is setting pin 53 as output and pulling it high in the setup function. Problem number two is, when you call the sd_init function, not only do you have to go with SPI_HALF_SPEED but also you have to give it a second parameter of the sd card pin (number 4 in this case). So the call is sd_init(SPI_HALF_SPEED, 4).

This might be obvious to someone but it wasn't for me. Anyways thanks again for all the help!
userHeadPic stratosg
2011-12-15 20:21:03 Hi Stratosg,


Have you made the necessary modifications to the sample code to make it compatible with the MEGA? You know the SPI pins are different for the MEGA.


Here is some info on the:[url=http://www.shieldlist.org/arduino/ethernet-v5] Ethernet shield[/url]


Here is some info on the: [url=http://www.arduino.cc/en/Main/ArduinoBoardMega2560]Arduino MEGA[/url]

I have not tested the MicroSD card on the ethernet shield myself, but it seems that this new version should be fully functional for both the Ethernet and SD use at the same time.
userHeadPic Hector