Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 3 of 3

Thread: Teensy 4.1 Ethernet link status won't connect

  1. #1
    Junior Member
    Join Date
    Aug 2021
    Posts
    2

    Teensy 4.1 Ethernet link status won't connect

    Hello,

    I've just finished soldering the provided ethernet kit for the Teensy 4.1, and began trying to test it. I connected the breakout ethernet board to the teensy via the ribbon cable, and began some basic tests (source code down below). However, the program fails at the linkStatus check, and additionally I notice the light on the ethernet is port is not lighting up - the ethernet cable itself is fine, and works for a similar Arduino Uno program.

    I'm wondering what the best way to troubleshoot this is. I'm not very experienced with such fine soldering, so maybe my soldering job (pictures attached) damaged something? I have a spare ethernet kit, but would rather try and diagnose what I did wrong before possibly repeating that mistake on my remaining spare. I should note that the ribbon cable connection seems pretty loose to me, if that matters.

    Code:
    #include <SPI.h>
    #include <NativeEthernet.h>
    
    const int led = LED_BUILTIN;
    byte mac[] = {
      0xA4, 0xE9, 0xE5, 0x0F, 0xC3, 0x3D };
    
    EthernetClient client;
    
    void setup() {
      Serial.begin(9600);
      pinMode(led, OUTPUT);
      // 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) {
        // Code fails here!
        Serial.println("Ethernet cable is not connected.");
      }
      
      Serial.println(Ethernet.localIP());
    }
    Solder job:
    Click image for larger version. 

Name:	PXL_20210831_220503289.jpg 
Views:	41 
Size:	134.5 KB 
ID:	25730Click image for larger version. 

Name:	PXL_20210831_220512074.jpg 
Views:	96 
Size:	107.6 KB 
ID:	25731Click image for larger version. 

Name:	PXL_20210831_220524046.jpg 
Views:	44 
Size:	81.9 KB 
ID:	25732Click image for larger version. 

Name:	PXL_20210831_220542726.jpg 
Views:	50 
Size:	135.5 KB 
ID:	25733

  2. #2
    Don't know if you are still messing with this, but it looks like your R- pin solder did not flow correctly.

    Click image for larger version. 

Name:	Teensy 4.1 Ethernet link status won't connect - R- Pin.jpg 
Views:	35 
Size:	151.3 KB 
ID:	25753

  3. #3
    Senior Member
    Join Date
    Mar 2017
    Location
    Oakland, CA, USA
    Posts
    708
    You need to start the Ethernet driver with Ethernet.begin() before the link state will work correctly. In QNEthernet, you don't need to specify the MAC address (because it internally reads the bullt-in one) and can use the `begin()` version with no arguments (for DHCP). With NativeEthernet (QNEthernet has the MAC versions of `begin()` too), you need to call `begin(mac)` with either the Teensy's built-in MAC address or something else of your choosing. There are equivalent methods if you instead want to use a static address configuration.

    (I just tried NativeEthernet's LinkStatus example and it doesn't work unless `Ethernet.begin(mac)` is called in `setup()` with some 6-byte MAC address. It's the most similar example to your code above.)

    In QNEthernet, the SNTPClient example shows a simple way of starting up the system (it then uses UDP). The ServerWithAddressListener example shows how to start the system using a listener approach for the link state and for address changed. I plan to add an upcoming "AppWithListenersTemplate" template example that shows a few ways of starting the system using the listener approach.

    P.S. I love your username.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •