ethernet shield + mega 2560 + MAC OS = failure

I have built a project controlling LED’s using the wifly shield, everything works perfectly but due to occasional issues with wifi reliability I have decided to skip wireless and keep everything hardwired. Just received my ethernet shield and so far im not having any luck. Followed all instructions on this link: Arduino Ethernet Shield MEGA hack « MCUKITS

Everything is a go except the part where I modify the SPI.h file. On the mac my SPI.h has none of the lines in it that is in this tutorial. Here is what I have:

// We use the name "_Spi.h" to avoid a clash with the other SPI library which
// the IDE doesn't notice the difference between.

#ifndef ___SPI_H__
#define ___SPI_H__

#include <WProgram.h>

#include <pins_arduino.h>

// TODO: Do we want to use this instead: <>
class SpiDevice {
    void begin();
    void begin(byte selectPin);

    // TODO: Make these private (or protected) in the final library?
    void deselect();
    void select();

    byte transfer(volatile byte data);
    void transfer_bulk(const uint8_t* srcptr, unsigned long int length);

    void _initPins();
    void _initSpi();    
    byte _selectPin;


I was wondering if anyone else has ran into this problem. I have downloaded and installed arduino 22 for pc and ran it in parallels but it keeps crashing so I am stuck at the moment. Any help is appreciated, dont really want to switch to windows for this project.

Basically the sketch loads, and when I do an IP scan the RX and TX lights show activity on the shield, but nothing shows up in the results page. I ping the IP that I set it for in the sketch and find nothing as well


Are you changing the SPI.h file in the Ethernet library as the instructions say?

"Locate the file spi.h in the hardware/libraries/Ethernet/utility directory, under your Arduino 0015 installation."

Which version of the Arduino IDE are you using?

There were some significant changes to the Ethernet libraries recently: my biggest Ethernet project, written for arduino-0017, won't even compile under the latest versions. So it may make a difference to folks who want to help.

I was using 19, but I thought that maybe upgrading would help so last night I tried the latest which I think is 22.

Johnwasser; If you look at the instructions given it says to change

#define SPI0_SS_BIT BIT2
#define SPI0_SCLK_BIT BIT5
#define SPI0_MOSI_BIT BIT3
#define SPI0_MISO_BIT BIT4

with this:

#define SPI0_SS_BIT BIT0
#define SPI0_SCLK_BIT BIT1
#define SPI0_MOSI_BIT BIT2
#define SPI0_MISO_BIT BIT3

If you notice in the code from my spi.h that I posted it doesnt have any of these statements listed. So I did not add them as I am thinking I am looking in the wrong place. The problem is and maybe I am confused, but when I install arduino on Mac, the directory listed in the tutorial does not exist, so I do a search for spi.h in finder and it only returns this one file. So this leaves me stumped on what to do from here, obviously this tutorial was written for windows and it seems after searching for several hours last night, that I am the first person to try this using a mac.

Since the latest Ethernet Shield uses the ICSP connector which works for Arduino Mega as well as other Arduinos it appears that the Ethernet library no longer has the SPI.h file. If you have the older shield, something like the hack should work without changing the software.

On the newer shield the SS line (to select the Ethernet chip) connects to Data Pin 10 for both the regular Arduino and the Mega. It gets the other three lines from the ICSP connector. I think that instead of bending the pins on 10, 11, 12, and 13 you should only bend 11, 12, and 13. Jumper 11, 12, and 13 to 51, 50, and 52 like in the original hack but don't jumper 10 to 53.

So if Im reading this correctly, Keep ten connected and it should work without altering code? Its pretty late so I will give it a try tomorrow night.

Thanks, J