Pages: [1]   Go Down
Author Topic: TinkerIT Ethernet shield compatibility with 1.0.3 library ??? static == 0.0.0.0  (Read 1020 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I purchased a couple of Arduino Mega (must be 1280), and Ethernet shields from Amazon awhile ago, then due to a change in employment status had to set them aside. Now that I am getting back to them, I am struggling with the Ethernet shields, and questioning the library support for these boards.

I don't recall knowing there were different Ethernet shields at the time I bought them, and the only markings I can find on these say TinkerIT. They do have a W5100 chip, and a layout very close to the v3, though these don't have the SD carrier populated. I have tried a variety of example sketches, as well as trying from scratch but they all fail. That said, the boards do appear to work on the Ethernet side as all the leds flash appropriately (though I never see a DHCP attempt on the TX led), if they could only be configured correctly.

It doesn't matter if I try a DHCP, or a static assignment, addresses don't take. When I ping the subnet broadcast wireshark shows a response from 0.0.0.0 with mac 0:0:0:0:0:0, but only when the Arduino is connected. Then a series of ICMP dst/port unreachable messages from 0.0.0.0, that coorespond to the TX led flashing, in response to port 137/138 traffic from the W7 machine running wireshark. There is also a TX flash every 30 sec, what would appear to be a response to the RIP update sent to subnet broadcast, though that is not getting through the switch to wireshark. This 0.0.0.0 address is consistent with the output from: Serial.println(Ethernet.localIP()), so it would appear that the address being passed through begin(), or acquired from DHCP are not getting to the chip.  There are unsubstantiated claims that the DHCP timeout in 1.0+ is 1 minute, but as far as I can tell in 1.0.3, it is longer than 30 minutes to drop out and print the 0.0.0.0 address.

Since I can't get a static address assigned, and the board responds for the address it has, the next logical place to start looking is the library support. The first annoying thing I stumbled across is Ethernet.h where any parameter passed beyond (mac) causes a status = Ethernet.begin(...) to fail. Why are those parameter options declared with void rather than int so a proper status is returned, even if most people will ignore it? The next was the decision to insert dns before gtw/mask. There are lots of example sketches showing (mac, ip, gtw, subnet), which are all invalid after 1.0 as far as I can tell. On top of that there is the confusing practice of stating a current string as (mac, ip, gtw, gtw, subnet). While I understand that is a handy short-hand for people too lazy to type out IPAddress dns_srv(,,,), it makes it look like a typo when compared to the older examples with only one gtw entry. 3rd is the fact that if you try to just use IPAddress dns(,,,) it fails compiling due to an attempted reasignment of the array. 4th, why do all DHCP examples try once and fail, rather than retry after a reasonable period? (see below)  5th, I understand why the IDE closes the serial monitor during an upload, but why doesn't it remember that it did that and reopen it after the upload completes?     but I digress, so back to the problem at hand...

Is there any code to get full status from the W5100, or perform diagnostics? Search turns up nothing but other people looking for the same. I have been searching for all kinds of errors related to these boards, and/or assignments resulting in 0.0.0.0, with absolutely no luck. Is there some incompatibility between the Mega and this shield? Do I need to do something with ../hardware/arduino/variants/mega/pins_arduino.h, or did declaring the board type to the IDE take care of that? Anyone have a suggestion of what to try next?

Here is the currently loaded sketch:

IDE 1.0.3 on W7
Arduino Mega (1280)  w/ tinkerit ethernet shield both acquired Mar 2010.
=============================================
// pasted together from several sketches  +  edits & insertions

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

boolean status = false;

byte mac[] = {  0x02, 0xAA, 0xBB, 0xCC, 0xDD, 0x02 };

IPAddress ip(192,168,123,24);

EthernetClient client;

void setup() {
  // turn off SD select,  despite lack of socket on this board
  // ambiguous claims all over the place about needing to do this to make 5100 work
  pinMode(4,OUTPUT);
  digitalWrite(4,HIGH);
 
 // Open serial communications and wait for port to open:
  Serial.begin(9600);
   while (!Serial) {
  }

  Serial.println("start the Ethernet connection:");
//  status = Ethernet.begin(mac, ip);   // this fails because ethernet.h has void for parameters beyond (mac)
//  Serial.println(status);    // this makes no sense when the above fails

  Ethernet.begin(mac, ip);   // could do more, but this should be enough for on-subnet ping

/*       comment out above and uncomment below for DHCP
  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");    // never prints this
   
    // keep trying at 1 minute intervals until it works
    while (!Ethernet.begin(mac)) {
      delay( 60000 + random(0,100) );
      Serial.println("Failed DHCP Retrying");
    }
  }
*/

  delay(2000);  // let things settle before moving on...

// print the local IP address:
  Serial.print("My IP address: ");
  for (byte thisByte = 0; thisByte < 3; thisByte++) {
    // print the value of each byte of the IP address:
    Serial.print(Ethernet.localIP()[thisByte], DEC);
    Serial.print(".");
  }
    Serial.print(Ethernet.localIP()[3], DEC);
    Serial.println();

}

void loop() {
  // no point in putting anything here until a valid address gets assigned
}



Serial Monitor output:

start the Ethernet connection:
My IP address: 0.0.0.0

Logged

0
Offline Offline
Tesla Member
***
Karma: 145
Posts: 9636
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You might try the below.

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

byte mac[] = {  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192,168,1,102);

void setup() {
  Serial.begin(9600);

  // disable SD card if one in the slot
  pinMode(4,OUTPUT);
  digitalWrite(4,HIGH);

  Serial.println("Starting w5100");
  Ethernet.begin(mac,ip);

  Serial.println(Ethernet.localIP());
}

void loop() {
}
 
 
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: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I had tried one similar, but ran yours with and without modification of the IP address, and get back:
Starting w5100
0.0.0.0


After the original post I stumbled across a video blog talking about an NKC board that was "not compatible with the MEGA". NKC was the distributer for Amazon on the boards I purchased, but those were clearly different as the chip & RJ45 were on a separate daughter card. In any case, it would appear that boards using a reference design before the MEGA was released might have a problem. Even the description of the official R3 says the prior revision was not compatible as the SPI bus was moved.

If I define 11, 12, & 13 as input can I jumper 50, 51, & 52 to those without damaging anything?
Logged

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

I'd like to see the ethernet shield. Do you have a link to that?

If the ethernet shield has an ICSP connector on the bottom that connects to the ICSP pins on the Mega, then it is Mega compatible and needs no jumpers. If not, you will probably need to jumper the SPI data pins before it will function.
MOSI = D11 -> D51
MISO = D12 -> D50
SCK = D13 -> D52

D10 stays where it is. That is the standard ethernet slave select.
Logged

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

I don't have a pointer to an image, and the Amazon one now shows the official R3 distributed by NKC. It is almost identical, but doesn't have the underside connector to the ICSP pins.

I did do the jumper thing as you indicated and it works both static & DHCP.
  pinMode(11,INPUT);
  pinMode(12,INPUT);
  pinMode(13,INPUT);
  pinMode(50,OUTPUT);
  pinMode(51,OUTPUT);
  pinMode(52,OUTPUT);

start the Ethernet connection:
My IP address: 192.168.123.24

Reply from 192.168.123.24: bytes=32 time<1ms TTL=128


Thanks.
Logged

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

Good deal. I think those pins will be set by the SPI library, but just in case you want to do that without it, the MISO pin should be INPUT on the Arduino (OUTPUT on the shield).
Logged

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

Thanks for the correction. My working sketch now has:
// Mega series w/'incompatible' ethernet shield needs this + jumpers
// MOSI = D11 -> D51   MISO = D12 -> D50   SCK = D13 -> D52
  pinMode(4,OUTPUT);
  digitalWrite(4,HIGH);
  pinMode(10,OUTPUT);
  digitalWrite(10,LOW);
  pinMode(11,INPUT);
  pinMode(12,INPUT);
  pinMode(13,INPUT);
  pinMode(50,INPUT);
  pinMode(51,OUTPUT);
  pinMode(52,OUTPUT);

Logged

Pages: [1]   Go Up
Jump to: