Is my teensy4.1 ethernet broken?

Status
Not open for further replies.

Johannes

Active member
I have just received my new teensy 4.1 with ethernet kit, soldered everything together as described, but it does not work: the green LED stays dark, and from the "DhcpAddressPrinter" example I just get:

Code:
20:41:16.844 -> Initialize Ethernet with DHCP:
20:41:17.407 -> Failed to configure Ethernet using DHCP
20:41:17.407 -> Ethernet shield was not found.  Sorry, can't run without hardware. :(

whether I connect it to ethernet or not. Even when I unplug the ribbon cable the output stays the same.
I double checked the soldering, and I think it is well done.

Software: I use Arduino on Linux. Installation as described, many other sketches work, just ethernet does not work at all.

Can anybody please tell me what to expect from the green LED: when is it supposed to light up? When power is on?
I am worried because of "Ethernet shield was not found", even then the ribbon cable is disconnected. The ethernet shield is onboard, isn't it?
I wonder if I have ruined the ethernet HW already. :(

Thanks in advance!

Forum rule says to post the code, so here it is:

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
  modified 02 Sept 2015
  by Arturo Guadalupi

 */

#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
};

void setup() {
  // You can use Ethernet.init(pin) to configure the CS pin
  //Ethernet.init(10);  // Most Arduino shields
  //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(9600);
  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");
    if (Ethernet.hardwareStatus() == EthernetNoHardware) {
      Serial.println("Ethernet shield was not found.  Sorry, can't run without hardware. :(");
    } else if (Ethernet.linkStatus() == LinkOFF) {
      Serial.println("Ethernet cable is not connected.");
    }
    // no point in carrying on, so do nothing forevermore:
    while (true) {
      delay(1);
    }
  }
  // print your local IP address:
  Serial.print("My IP address: ");
  Serial.println(Ethernet.localIP());
}

void loop() {
  switch (Ethernet.maintain()) {
    case 1:
      //renewed fail
      Serial.println("Error: renewed fail");
      break;

    case 2:
      //renewed success
      Serial.println("Renewed success");
      //print your local IP address:
      Serial.print("My IP address: ");
      Serial.println(Ethernet.localIP());
      break;

    case 3:
      //rebind fail
      Serial.println("Error: rebind fail");
      break;

    case 4:
      //rebind success
      Serial.println("Rebind success");
      //print your local IP address:
      Serial.print("My IP address: ");
      Serial.println(Ethernet.localIP());
      break;

    default:
      //nothing happened
      break;
  }
}
 
Code:
#include <Ethernet.h>

I replaced this with
Code:
#include <NativeEthernet.h>

and the output now has changed to:
Code:
23:46:45.115 -> Initialize Ethernet with DHCP:
23:47:45.100 -> Failed to configure Ethernet using DHCP
23:47:45.100 -> Ethernet cable is not connected.

And for a short blink I have seen the green LED flash up!
I got new hope and tried the "UDPSendReceiveString" Example and received some packets on the other side (linux box with tcpdump) with massive blinking!

DhcpAddressPrinter still gets no IP address via DHCP, but this may be due to a bad ethernet cable.

Now I know the ethernet part is not totally broken! :D
This is what I wanted to know, thanks for your patience!
 
And with a good cable and restarting dnsmasq on the linux box I finally got an IP address via DHCP!
I am very happy and sorry to have you worried. tcpdump is a good friend.

For those who are interested: the yellow LED is always dark (not connected) and the green led seem to only light up when Ethernet.begin(...) has been called and a cable is connected. Then it flashes when there is traffic. When it is already shining it will go dark when you disconnect the ethernet cable and light up again when you reconnect.

Yours,
Johannes
 
Status
Not open for further replies.
Back
Top