Pages: [1]   Go Down
Author Topic: Newbie - MEGA 2560 r3 + Ethernet R3 Shield  (Read 968 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Guys,

I have been looking round the forum and general internet to find a solution. I hope that this hasnt been answered before, but nothing came up in the search

I have connected the Ethernet shield to the MEGA but I cannot get a connection to the network using any of the Example codes in the IDE 1.0.3 - Both units have been purchased in the last two weeks so should be the latest versions.

Is there something I am doing wrong - all code compiles and gets sent correctly to the board.

Things I have tried:
I make sure that the MAC address is correctly assigned (I have tried assigning a made up one as well but no joy)

Setting static IP and DHCP assigned ones - no joy

removed SD card

I have seen a couple of posts regarding pins and patching them to other connections but surely the R3 shields should work directly with a mega R3 board without having to do this (the idea of a shield?)

Any ideas
« Last Edit: February 22, 2013, 11:12:34 am by slothy » Logged

Offline Offline
Full Member
***
Karma: 2
Posts: 138
W9LZ
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Are you absolutely sure that the MAC address matches the device? Try using the TELNET Client example. Does ipconfig /all give you any more info? I've got a clone MEGA and the Arduino Ethernet shield comes dangerously close to the electrolytic cans (ground?) over by the power connector pins. I'm using my MEGA clone in a production environment, or I'd give it a try.
Logged

Offline Offline
Edison Member
*
Karma: 57
Posts: 2078
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Please show us your code.
Did you set pin 53 as output ?
Code:
// Set SPI SS pin as output.
// It is not used but it needs to be output for the SPI.
pinMode(53, OUTPUT);        // Only for the Mega

Use DHCP and what is the IP address ?
Code:
Serial.println(Ethernet.localIP());
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Erdin,

thanks for the Reply.

I am using the standard DHCPAddressPrinter that comes with the software.  I have added your SPI code but still no joy.
Code:
/*
  DHCP-based IP printer
 
 This sketch uses the DHCP extensions to the Ethernet library
 to get an IP address via DHCP and print the address obtained.
 using an Arduino Wiznet Ethernet shield.
 
 Circuit:
 * Ethernet shield attached to pins 10, 11, 12, 13
 
 created 12 April 2011
 modified 9 Apr 2012
 by Tom Igoe
 
 */

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

// Enter a MAC address for your controller below.
// Newer Ethernet shields have a MAC address printed on a sticker on the shield
byte mac[] = { 
  0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x02 };

// Initialize the Ethernet client library
// with the IP address and port of the server
// that you want to connect to (port 80 is default for HTTP):
EthernetClient client;

void setup() {
  // Set SPI SS pin as output.
  // It is not used but it needs to be output for the SPI.
  pinMode(53, OUTPUT);        // Only for the Mega 
 
  pinMode(53, OUTPUT); 
  // Open serial communications and wait for port to open:
  Serial.begin(9600);
  // this check is only needed on the Leonardo:
   while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }

  // start the Ethernet connection:
  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // no point in carrying on, so do nothing forevermore:
    for(;;)
      ;
  }
  // print your local IP address:
  Serial.print("My IP address: ");
  for (byte thisByte = 0; thisByte < 4; thisByte++) {
    // print the value of each byte of the IP address:
    Serial.print(Ethernet.localIP()[thisByte], DEC);
    Serial.print(".");
  }
  Serial.println();
}

void loop() {

}

Logged

Miramar Beach, Florida
Offline Offline
Faraday Member
**
Karma: 115
Posts: 5380
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Here is a test sketch to determine if the SPI is working ok.
http://arduino.cc/forum/index.php/topic,143488.msg1077510.html#msg1077510
It should work ok with the SD card in the slot. Does it work ok on your setup?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok.

Tried that code and in the serial window I get

Quote
Starting W5100
0.0.0.0

It repeats if I press any of the reset buttons

Logged

Miramar Beach, Florida
Offline Offline
Faraday Member
**
Karma: 115
Posts: 5380
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Then you have either an SPI fail or w5100 fail. Check the connector pins closely, especially the ICSP pins. That is how the SPI data lines get to the Mega.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok,

I have just had a look at the two boards and I noticed this (see attached picture)

Now it's time to test my soldering skills out!!!

Fingers crossed that this fixes the problem!



* arduino spi pin problem.png (2184.38 KB, 1498x1743 - viewed 25 times.)
Logged

0
Offline Offline
Tesla Member
***
Karma: 114
Posts: 8921
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

When I first put an ethernet shield on a mega, I had the pin alignment on one side off by a pin. A close inspection of correct pins in the correct holes solved the issue.
Logged

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Bingo - or should I say PING!!

Thanks guys for all the help smiley-wink Still surprised that this got through the QA stage of manufacture (or do they not test a shield against it?)

Time to get a smaller soldering tip, but initial testing says that the join is good smiley-grin

Pinging 192.168.100.36 with 32 bytes of data:
Reply from 192.168.100.36: bytes=32 time=352ms TTL=1
Reply from 192.168.100.36: bytes=32 time<1ms TTL=128
Reply from 192.168.100.36: bytes=32 time<1ms TTL=128
Reply from 192.168.100.36: bytes=32 time<1ms TTL=128

Now I can try some stuff out -

Logged

Miramar Beach, Florida
Offline Offline
Faraday Member
**
Karma: 115
Posts: 5380
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I've not seen that before. It appears it is not soldered, also not trimmed? I don't know about QA. It is not mil spec, so they do not test every part. But you think they would have caught that.
Logged

0
Offline Offline
Tesla Member
***
Karma: 114
Posts: 8921
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Still surprised that this got through the QA stage of manufacture (or do they not test a shield against it?)

The board has "made in italy", so what are the expectations?
Logged

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I've not seen that before. It appears it is not soldered, also not trimmed?

I think it was the first time the shield was attached it pushed the pin through, I just didn't notice! Looks like the solder hole was never filled (it is now smiley )

Logged

Miramar Beach, Florida
Offline Offline
Faraday Member
**
Karma: 115
Posts: 5380
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

That makes sense. It was aligned (not soldered) until you attached the shield. Good deal on the repair.  smiley
Logged

Pages: [1]   Go Up
Jump to: