Wiz850IO + 3.6, Ethernet Adapter Not Recognized

Status
Not open for further replies.

finchamp

Active member
I am testing a Teensy 3.6 with Wiz850IO board connected with jumpers via pins 10-13. When I run the WebClient_test example sketch below, the Teensy always prints "Ethernet shield was not found." The same adapter and sketch works fine on a Mega2560, pins 50-53. The adapter seems to be powered up, and I've tried reversing the MISO/MOSI just in case. Am I on the wrong SPI bus?

Arduino 1.8.7 and Teensyduino 1.4.4

Code:
/*
  Web client

 This sketch connects to a website (http://www.google.com)
 using an Arduino Wiznet Ethernet shield.

 Circuit:
 * Ethernet shield attached to pins 10, 11, 12, 13

 created 18 Dec 2009
 by David A. Mellis
 modified 9 Apr 2012
 by Tom Igoe, based on work by Adrian McEwen

 */

#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[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

// if you don't want to use DNS (and reduce your sketch size)
// use the numeric IP instead of the name for the server:
//IPAddress server(74,125,232,128);  // numeric IP for Google (no DNS)
char server[] = "www.google.com";    // name address for Google (using DNS)

// Set the static IP address to use if the DHCP fails to assign
IPAddress ip(192, 168, 1, 177);
IPAddress myDns(192, 168, 1, 1);

// 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;

// Variables to measure the speed
unsigned long beginMicros, endMicros;
unsigned long byteCount = 0;
bool printWebData = true;  // set to false for better speed measurement

void setup() {
  // You can use Ethernet.init(pin) to configure the CS pin
  Ethernet.init(10);  // Most Arduino shields
  //Ethernet.init(53);  // Mega SPI
  //Ethernet.init(5);   // MKR ETH shield
  //Ethernet.init(0);   // Teensy 2.0
  //Ethernet.init(20);  // Teensy++ 2.0
  //Ethernet.init(15);  // ESP8266 with Adafruit Featherwing Ethernet
  //Ethernet.init(33);  // ESP32 with Adafruit Featherwing Ethernet

  // Open serial communications and wait for port to open:
  Serial.begin(115200);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }

  // start the Ethernet connection:
  Serial.println("Initialize Ethernet with DHCP:");
  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // Check for Ethernet hardware present
    if (Ethernet.hardwareStatus() == EthernetNoHardware) {
      Serial.println("Ethernet shield was not found.  Sorry, can't run without hardware. :(");
      while (true) {
        delay(1); // do nothing, no point running without Ethernet hardware
      }
    }
    if (Ethernet.linkStatus() == LinkOFF) {
      Serial.println("Ethernet cable is not connected.");
    }
    // try to congifure using IP address instead of DHCP:
    Ethernet.begin(mac, ip, myDns);
  } else {
    Serial.print("  DHCP assigned IP ");
    Serial.println(Ethernet.localIP());
  }
  // give the Ethernet shield a second to initialize:
  delay(1000);
  Serial.print("connecting to ");
  Serial.print(server);
  Serial.println("...");

  // if you get a connection, report back via serial:
  if (client.connect(server, 80)) {
    Serial.print("connected to ");
    Serial.println(client.remoteIP());
    // Make a HTTP request:
    client.println("GET /search?q=arduino HTTP/1.1");
    client.println("Host: www.google.com");
    client.println("Connection: close");
    client.println();
  } else {
    // if you didn't get a connection to the server:
    Serial.println("connection failed");
  }
  beginMicros = micros();
}

void loop() {
  // if there are incoming bytes available
  // from the server, read them and print them:
  int len = client.available();
  if (len > 0) {
    byte buffer[80];
    if (len > 80) len = 80;
    client.read(buffer, len);
    if (printWebData) {
      Serial.write(buffer, len); // show in the serial monitor (slows some boards)
    }
    byteCount = byteCount + len;
  }

  // if the server's disconnected, stop the client:
  if (!client.connected()) {
    endMicros = micros();
    Serial.println();
    Serial.println("disconnecting.");
    client.stop();
    Serial.print("Received ");
    Serial.print(byteCount);
    Serial.print(" bytes in ");
    float seconds = (float)(endMicros - beginMicros) / 1000000.0;
    Serial.print(seconds, 4);
    float rate = (float)byteCount / seconds / 1000.0;
    Serial.print(", rate = ");
    Serial.print(rate);
    Serial.print(" kbytes/second");
    Serial.println();

    // do nothing forevermore:
    while (true) {
      delay(1);
    }
  }
}
 
Pins 10-13 are correct.

Maybe there's a wiring mistake or misunderstanding? Sometimes we can spot the problem if you post photos.
 
Thanks, Paul. Here's the specific wiring and some photos. This board is a generic clone as it turns out, but it does work with Mega. I confirmed that the compiler is using the library versions included with Teensyduino. The jumpers are roughly 6.5" long. There's two brown jumpers, because that was what I had. I triple-checked that they are not mixed up.

Teensy 3.6 -- Wiz850IO
------------------------
3.3V red 3.3V
GND brown G
10 brown CS/SCN
11 orange MOSI
12 yellow MISO
13 green SCK
 

Attachments

  • IMG_20181016_151356000.jpg
    IMG_20181016_151356000.jpg
    68.2 KB · Views: 107
  • IMG_20181016_152916853.jpg
    IMG_20181016_152916853.jpg
    67.9 KB · Views: 126
  • IMG_20181016_152943396.jpg
    IMG_20181016_152943396.jpg
    57.7 KB · Views: 98
Orange and yellow wires are wrong/swapped at the WIZ850io in the 1st photo, but correct in the 3rd photo.

RST isn't connected. I've used the genuine WIZ850io without it, but this board looks like a clone. Maybe you need to pulse RST low on this one and then make sure it stays at 3.3V when using the Ethernet lib?
 
Thanks for looking at that. I should have mentioned that I tried pulsing reset in various configurations. Just gave it another shot to no avail. I guess I'm going to order one up from WizNet.
 
This is strange. I got a genuine Wiz850IO in from Mouser today. Still nothing. Tried with different MAC. Nothing.

For giggles, I tested all the relevant pins with an LED (Blink-type program), and no hardware problems.

I tested my 3.6 with a known-good W5200 Seeed Arduino shield. Doesn't work with that either. Is there some issue with the code I'm using? (below)

(Confirmed that both SPI and Ethernet libraries are compiling from the teensy\avr\libraries folder; SPI V1.0.0, Ethernet V2.0.0)

Code:
/*
  Web client

 This sketch connects to a website (http://www.google.com)
 using an Arduino Wiznet Ethernet shield.

 Circuit:
 * Ethernet shield attached to pins 10, 11, 12, 13

 created 18 Dec 2009
 by David A. Mellis
 modified 9 Apr 2012
 by Tom Igoe, based on work by Adrian McEwen

 */

#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[] = { 0xA1, 0xAD, 0xBE, 0xEF, 0xB2, 0x01 };

// if you don't want to use DNS (and reduce your sketch size)
// use the numeric IP instead of the name for the server:
//IPAddress server(74,125,232,128);  // numeric IP for Google (no DNS)
char server[] = "www.google.com";    // name address for Google (using DNS)

// Set the static IP address to use if the DHCP fails to assign
IPAddress ip(192, 168, 1, 177);
IPAddress myDns(192, 168, 1, 1);

// 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;

// Variables to measure the speed
unsigned long beginMicros, endMicros;
unsigned long byteCount = 0;
bool printWebData = true;  // set to false for better speed measurement

void setup() {
  pinMode(9, OUTPUT);   //Ethernet adapter reset pin
  digitalWrite(9, LOW);
  delay(100);
  digitalWrite(9, HIGH);
  delay(700);
  // You can use Ethernet.init(pin) to configure the CS pin
  Ethernet.init(10);  // Most Arduino shields
  //Ethernet.init(53);  // Mega SPI
  //Ethernet.init(5);   // MKR ETH shield
  //Ethernet.init(0);   // Teensy 2.0
  //Ethernet.init(20);  // Teensy++ 2.0
  //Ethernet.init(15);  // ESP8266 with Adafruit Featherwing Ethernet
  //Ethernet.init(33);  // ESP32 with Adafruit Featherwing Ethernet

  // Open serial communications and wait for port to open:
  Serial.begin(115200);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }

  // start the Ethernet connection:
  Serial.println("Initialize Ethernet with DHCP:");
  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // Check for Ethernet hardware present
    if (Ethernet.hardwareStatus() == EthernetNoHardware) {
      Serial.println("Ethernet shield was not found.  Sorry, can't run without hardware. :(");
      while (true) {
        delay(1); // do nothing, no point running without Ethernet hardware
      }
    }
    if (Ethernet.linkStatus() == LinkOFF) {
      Serial.println("Ethernet cable is not connected.");
    }
    // try to congifure using IP address instead of DHCP:
    Ethernet.begin(mac, ip, myDns);
  } else {
    Serial.print("  DHCP assigned IP ");
    Serial.println(Ethernet.localIP());
  }
  // give the Ethernet shield a second to initialize:
  delay(1000);
  Serial.print("connecting to ");
  Serial.print(server);
  Serial.println("...");

  // if you get a connection, report back via serial:
  if (client.connect(server, 80)) {
    Serial.print("connected to ");
    Serial.println(client.remoteIP());
    // Make a HTTP request:
    client.println("GET /search?q=arduino HTTP/1.1");
    client.println("Host: www.google.com");
    client.println("Connection: close");
    client.println();
  } else {
    // if you didn't get a connection to the server:
    Serial.println("connection failed");
  }
  beginMicros = micros();
}

void loop() {
  // if there are incoming bytes available
  // from the server, read them and print them:
  int len = client.available();
  if (len > 0) {
    byte buffer[80];
    if (len > 80) len = 80;
    client.read(buffer, len);
    if (printWebData) {
      Serial.write(buffer, len); // show in the serial monitor (slows some boards)
    }
    byteCount = byteCount + len;
  }

  // if the server's disconnected, stop the client:
  if (!client.connected()) {
    endMicros = micros();
    Serial.println();
    Serial.println("disconnecting.");
    client.stop();
    Serial.print("Received ");
    Serial.print(byteCount);
    Serial.print(" bytes in ");
    float seconds = (float)(endMicros - beginMicros) / 1000000.0;
    Serial.print(seconds, 4);
    float rate = (float)byteCount / seconds / 1000.0;
    Serial.print(", rate = ");
    Serial.print(rate);
    Serial.print(" kbytes/second");
    Serial.println();

    // do nothing forevermore:
    while (true) {
      delay(1);
    }
  }
}
 
Ran the Webclient example just now on a Teensy 3.6 with a genuine WIZ850io using Arduino 1.8.7 and Teensyduino 1.44. Works fine. Here's a screenshot.

sc.jpg

Here's the hardware on my desk.

DSC_0248_web.jpg

Nothing special here, just a Teensy 3.6, this adaptor and the WIZ850io connected by headers and sockets.
 
I found 1 of the green clones. Plugged it in and ran WebClient again. Works fine.

Looking at the clone, I had never noticed it has a LED on the bottom side of the board. Let's see if I can get a quick photo...

DSC_0251_web.jpg
 
Thanks Paul. You're some kind of customer support superhero. Like the Flash, but with microcontrollers. :D

I guess my issue has to be with the length of the jumpers, so I'm ordering up your adapter for testing. Will update.

Yes, my clone has the red LED as well. Handy for diagnosis on the bench, I suppose.
 
I have a bookshelf filled with ready-to-go hardware for most of the commonly used Arduino libraries, so a test just running the examples is quick & easy!

This really should be able to work with that length wire, as long as they're all really connected and the WIZ850io really does get 3.3V power.

Maybe check those jumper wires with an ohm meter? And check the 3.3V power arriving at the end?

The only other difference I can imagine is the adaptor connects GND to all 3 GND pins and 3.3V to both the 3.3V pins. Seems like only 1 ought to be needed... but maybe try wiring up to all 5 of the pins?
 
That's a good suggestion. I did try different combinations of power and ground pins, but the red LED told me they were all working on the clone. Oh, well.

I'm sure the adapter board will work out of the gate, and that will suffice for proof of concept, which is what I was really after.
 
Thanks for the followup. I'm a bit surprised the wires don't work, but then I will confess I've never really tried them since I have a good supply of the adaptor boards here. ;)
 
finchamp, did you get this resolved?
I am spending way too much time wrestling with a similar setup.
I have several teensies (3.2, 3.6, 4.0) and would like to connect a seeed ethernet shield 2.0 (W5500).
Only because it is W5500.

Here is my pinout:
Arduino Teensy
Shield 3.2 3.6 4.0
D10 (SSn*) 10 (CS) 10 10 (CS)
D11 (MOSI) 11 (DOUT) 11 11 (MOSI)
D12 (MISO) 12 (DIN) 12 12 (MISO)
D13 (SCK) 13 (SCK) 13 13 (SCK)
GND GND GND GND
5v VIN 5v 5v

* SSn = W5500 Chip select


When I put the same shield on my Arduino Uno, it just works.
I also have a couple green shields that say they are MEGA compatible and they work with the Uno with no issues.
I have ordered a WIZ850IO from digikey and plan on mounting that on the adapter Paul referenced (WIZ820).
There are several references to needing the Ethernet2 library, which I later discovered had been bundled into the standard Arduino library.
Much later...

I am beginning to research whether I need to connect to the shield pin 4 and drop it low to disable the shield SD adapter.
Pin 10 tells the adapter to enable the ethernet.

This shield does not like 3v.
The lights only come on with 5v.

I had not considered cable length until I ran into this discussion.
Making some cables would be an easy concession.

This is not the part of the project I expected to be a problem!
Any tips, handholding, snarky comments, are welcome.
 
Status
Not open for further replies.
Back
Top