No Ethernet ping

I can successfully ping my Mega 2560 with a W5100 from my laptop as long as I am connected to the same switch/router. I cannot ping the 2560 when I connect my laptop to another switch on the same network. Here is the URL to the W5100: TOP Mini W5100 LAN Ethernet Shield Network Module Board for Arduino Best NEW | eBay

Here is my startup code:

Ethernet.init(ENET_SS);				// change the SS pin
pinMode(ENET_RESET, OUTPUT);
digitalWrite ( ENET_RESET, 0 );			// reset the W5100
delay(10);
digitalWrite ( ENET_RESET, 1 );
delay(250);							//<--important for W5100 module

Serial.print("  Ethernet.begin: ");
Ethernet.begin(s.MyMAC, s.MyIP, s.MyGateway, s.MyGateway);
for ( i = 0; i < 6; i++)
{	Serial.print(s.MyMAC[i], HEX);
	if (i < 5)
	{	Serial.print('-');
	}
}
Serial.print ( "    " );
Serial.print(Ethernet.localIP());
Serial.print ( "    " );
Serial.println(Ethernet.gatewayIP());

Enet = Ethernet.hardwareStatus();
Enet = Ethernet.hardwareStatus();
if ( Enet )
{	Serial.println("    Udp.begin");
	Udp.begin(localPort);	// start UDP
	Serial.println ( "    Ethernet OK" );
}
else
{
	Serial.println ( "    Hardware error" );
}

Any ideas?

What make/model are the router/switches you are trying with?

I remember seeing a problem like this previously with a Cisco switch (no idea on model) that would not work properly with an Arduino shield, but some cheap switches would.

I assume that the laptop is using ethernet only and that WIfi is disabled?

Can you post the whole of the code you are testing with that way there is a chance that someone else can also try an reproduce the problem.

What else is in your network when you cannot ping the Arduino? Any other Arduinos? Could they have the same MAC address?

Hi countrypaul,
I do not have that info yet. I will check either Wednesday or Thursday. I am also writing a short program that does nothing but respond to pings - just to make everything simpler.

Hi again
I tried a test with a simple program. It responds fine in my home network which is a D-Link router. I tried it on a bigger system with a Cisco/Meraki MS120-48 switch. I connected both my laptop and my Arduino into adjacent ports. The laptop is set to DHCP and I set the IP and gateway addresses in the Arduino appropriately. It still would not ping. I did successfully ping the gateway device so I know the laptop is accessing the network. Is it possible I have the MAC address bytes backwards? Note that bit 1 of byte 0 is set so that it becomes a "local" address.
Here is my program:


#define BAUD_RATE	19200

#define ENET_SS		2							// W5100 /SS
#define ENET_RESET	3							// W5100 /Reset

int Enet;											// 0 = no Ethernet

#include <SPI.h>
#include <Ethernet.h>
#include <EthernetUdp.h>

unsigned int localPort = 8888;				// local port to listen on

EthernetUDP Udp;			// EthernetUDP instance to let us send and receive UDP packets

// bit 1 of MSByte = 1 = Local MAC address
const byte	MyMAC[6] = {0x4B, 0x33, 0x50, 0x54, 0x4F, 0x00}

IPAddress MyIP(192, 168, 0, 155);
IPAddress MyGateway(192, 168, 0, 1);

void setup()
{ int i, j, k;
	byte macBuffer[6];

	Serial.begin(BAUD_RATE);					// start serial port 0
	delay(100);
	Serial.println ("Start setup");

	Ethernet.init(ENET_SS);						// change the SS pin
	pinMode(ENET_RESET, OUTPUT);
	digitalWrite ( ENET_RESET, 0 );			// reset the W5100
	delay(10);
	digitalWrite ( ENET_RESET, 1 );
	delay(250);										//<--important for W5100 module

	Serial.print ( "  Ethernet.begin: " );
	Ethernet.begin(MyMAC, MyIP, MyGateway, MyGateway);
	Ethernet.MACAddress(macBuffer);
	for ( i = 0; i < 6; i++)
	{	Serial.print ( MyMAC[i], HEX );
		if (i < 5)
		{	Serial.print ( '-' );
		}
	}
	Serial.print ( "  " );
	Serial.print ( Ethernet.localIP() );
	Serial.print ( "    " );
	Serial.println ( Ethernet.gatewayIP() );
	Enet = Ethernet.hardwareStatus();
	if ( Enet )
	{	Serial.println ( "    Udp.begin" );
		Udp.begin(localPort);	// start UDP
		Serial.println ( "    Ethernet OK" );
	}
	else
	{
		Serial.println ( "    Hardware error" );
	}
	Serial.println("  End setup");
} // setup

void loop()
{
}

HI countrypaul,
WiFi is disabled on my laptop. There are no other Arduinos in the system. There are about 50 other devices in the system including laptops and security cameras.

Moderator:
@k3pto read How to get the best out of this forum and next time use </> tags to post codes.

If you have concerns about your MAC address why not try using the one as per the examples ie:
const MyMac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

Interesting that you have problem when using the Cisco switch but not when trying the home router - as I mentioned problems have been reported before with using a Cisco switch.

I know that linking 2 Arduinos directly does not appear to work due to an error in the auto-negotiation just wondering if that could be the cause with the Cisco switch (the error is on the Arduino side). If you connect the Arduino to a cheap switch (or home router) and connect that switch to the Cisco switch does that then work?

Hi countrypaul,
The problem was the MAC address. I had bit 1 set in the most significant byte so it would e a locally administered address. However, I did not realize that bit 0 is also important. I had it set to a 1 which made it multicast. Changing it to 0 (unicast) fixed it.

Thanks for your help in locating this solution.