ethernet on 4.1

ajlapp

Member
I've integrated a Teensy 4.1 onto a custom board and I've planned to use the ethernet.

I did not understand that the breakout kit suggests a jack with magnetics. I have a plain RJ45 jack for now.

I "think" this should still work but just be less reliable.

Using the webserver example I"m failing this check:
Code:
Ethernet.hardwareStatus() == EthernetNoHardware

Is this related to not having magnetics?
 
Yes, ethernet uses magnetics, its a hard requirement. The pulse transformers either have to be on the PCB or in the RJ45 jack. There are also resistors in the standard configuration, not having these could be enough to cause problems - the galvanic isolation is essential to avoid ESD or destruction due to PoE.
 
Last edited:
Is the example actually failing because the magnetics aren’t present? I

f yes, how is it actually detecting that no hardware is available?

I’m sorting out the proper jack but now I’m curious how the micro can detect this.

Thanks.
 
Why would the chip know what hardware is present? It's going to see the signal and the signal integrity is probably bearing witness to the hardware.

Well a lack of termination resistors no doubt causes reflections (and thus phase-distortion), and ethernet is a multilevel encoding - you'd have to check with a fast 'scope to see if the eye-pattern is affected - without isolation the DC levels may be all wrong too as the centre-taps provide this at the receiving side - the driver TX dc voltages don't have to match the RX dc voltages because isolation is assumed.

Also the driver chip may do some pre-equalization to compensate for expected distortion due to the magnetics, again this would show as phase distortion.
 
Last edited:
Looping back on this...

The webserver example provided with the Teensy uses this line of code:

Code:
Ethernet.hardwareStatus() == EthernetNoHardware

My example doesn't get past this point and I was curious how this method works? Later in the example I see that it also checks for the cable plug....

Just curious how this stuff works and if not using a jack with magnetics would be a factor.
 
The webserver example provided with the Teensy uses this line of code:

Code:
Ethernet.hardwareStatus() == EthernetNoHardware

The example you are using is for the Ethernet library, which is not intended for T4.1 with built-in Ethernet, but rather for Teensy/Arduino with external Ethernet modules from WizNet. For built-in Ethernet on T4.1, you should be using the QNEthernet library, which you can download here (https://github.com/ssilverman/QNEthernet), and use one of its examples as your starting point. It's well-supported by user @shawn.

hardwareStatus() is in file Ethernet.cpp of the Ethernet library, and is specific to the Wiznet chips.

Code:
EthernetHardwareStatus EthernetClass::hardwareStatus()
{
    switch (W5100.getChip()) {
        case 51: return EthernetW5100;
        case 52: return EthernetW5200;
        case 55: return EthernetW5500;
        default: return EthernetNoHardware;
    }
}
 
Excellent. I assumed this was something dumb on my part...thank you.

To clarify...I was using the NativeEthernet library listed on the teensy page. The webserver example uses this same code snippet...so it appears that some of those examples are not supported.

I do not see a comparable webServer example in the new library but I'm sure I can sort something out.
 
Last edited:
Excellent. I assumed this was something dumb on my part...thank you.

To clarify...I was using the NativeEthernet library listed on the teensy page. The webserver example uses this same code snippet...so it appears that some of those examples are not supported.

I do not see a comparable webServer example in the new library but I'm sure I can sort something out.

I didn't know this, but it looks like NativeEthernet attempts to support both built-in and external Ethernet, because it does have a hardwareStatus() function (shown below), and like the Ethernet library, that function is specific to WizNet chips.

Code:
EthernetHardwareStatus EthernetClass::hardwareStatus()
{
    return EthernetW5500;
}

NativeEthernet is obsolescent and QNEthernet is the way to go. The ServerWithListeners example shows a very simple HTTP server.
 
QNEthernet also supports the hardwareStatus() function with an EthernetTeensy41 type. There’s also an “other” type. I expect to add more of these as I add more drivers.

I’ve made efforts to keep the API the same.
 
Switching libraries worked just fine. ServerWithListeners is solid. A jack with magnetics was not a factor for my system.
 
Back
Top