Teensy 4.1 to MagJack wiring schematic (wanted)

Status
Not open for further replies.

nmz787

Member
Hi, I just got my DigiKey parts for the ethernet dongle for my Teensy 4.1... but haven't received my OSHPark order yet.

I wanted to wire up the jack to the cable, but I'm not clear on the connections needed. I searched and searched, but didn't find this clearly defined anywhere, and will need to resort to using GIMP on the few OSHpark images, as well as the MagJack pinout (which uses a different naming convention).

If there's someone that can quickly provide an existing schematic for my needs, it would save me some time.

Thanks,
-Nathan


Top of PCB view
https://www.pjrc.com/teensy/beta/k41_ethernet_placement.png
https://644db4de3505c40a0444-327723...kcdn.com/68a412d2881be6c68eef512d913aa1e4.png

Bottom of PCB view:
https://644db4de3505c40a0444-327723...kcdn.com/1c4fd10914f99882bc2c8eb7fe68119a.png

Recommended MagJack (RB1-125BAG1A) data sheet:
https://media.digikey.com/pdf/Data Sheets/WIZnet PDFs/RB1-125BAG1A_ApprovalSheet.pdf
 
Last edited:
Here's what I came up with... please correct me if I've miswired something ethernet_cable.jpg
 
Here's the schematic from my CNC Breakout board. The 6 pin header on the left is on the T4.1. The magjack pinout is from the datasheet.

ethernet.png
 
That looks good.

While probably not strictly necessary, you should probably also connect the connector shield to GND, so that 1000 pF capacitor inside the connector gets connected to GND.
 
Thanks for the confirmations, and the recommendation on adding another GND connection.
I got the "web server" demo running after downloading the FNET and NativeEthernet libs by vjmuzik, and swapping the
Code:
#include <Ethernet.h>
line to
Code:
#include <NativeEthernet.h>
. As well as adding the code to grab the Teensy's fused MAC:
Code:
/*
  Web Server
 
 A simple web server that shows the value of the analog input pins.
 using an Arduino Wiznet Ethernet shield. 
 
 Circuit:
 * Ethernet shield attached to pins 10, 11, 12, 13
 * Analog inputs attached to pins A0 through A5 (optional)
 
 created 18 Dec 2009
 by David A. Mellis
 modified 9 Apr 2012
 by Tom Igoe
 
 */


#include <NativeEthernet.h>

// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
//byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
uint8_t mac[6];
IPAddress ip(192,168,1,177);

// Initialize the Ethernet server library
// with the IP address and port you want to use 
// (port 80 is default for HTTP):
EthernetServer server(80);


static void teensyMAC(uint8_t *mac) {
  uint32_t m1 = HW_OCOTP_MAC1;
  uint32_t m2 = HW_OCOTP_MAC0;
  mac[0] = m1 >> 8;
  mac[1] = m1 >> 0;
  mac[2] = m2 >> 24;
  mac[3] = m2 >> 16;
  mac[4] = m2 >> 8;
  mac[5] = m2 >> 0;
}


void setup() {
  // Open serial communications and wait for port to open:
  Serial.begin(9600);
   while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }
  Serial.println("About to start Ethernet, apparently the cable needs plugged in before it will proceed!");
  teensyMAC(mac);
  static char teensyMacString[23];
  sprintf(teensyMacString, "MAC: %02x:%02x:%02x:%02x:%02x:%02x", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
  Serial.println(teensyMacString);
  
  // start the Ethernet connection and the server:
  Ethernet.begin(mac, ip);
  server.begin();
  Serial.print("server is at ");
  Serial.println(Ethernet.localIP());
}


void loop() {
  // listen for incoming clients
  EthernetClient client = server.available();
  if (client) {
    Serial.println("new client");
    // an http request ends with a blank line
    boolean currentLineIsBlank = true;
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();
        Serial.write(c);
        // if you've gotten to the end of the line (received a newline
        // character) and the line is blank, the http request has ended,
        // so you can send a reply
        if (c == '\n' && currentLineIsBlank) {
          // send a standard http response header
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println("Connection: close");
          client.println();
          client.println("<!DOCTYPE HTML>");
          client.println("<html>");
          // add a meta refresh tag, so the browser pulls again every 5 seconds:
          client.println("<meta http-equiv=\"refresh\" content=\"5\">");
          // output the value of each analog input pin
          for (int analogChannel = 0; analogChannel < 6; analogChannel++) {
            int sensorReading = analogRead(analogChannel);
            client.print("analog input ");
            client.print(analogChannel);
            client.print(" is ");
            client.print(sensorReading);
            client.println("<br />");       
          }
          client.println("</html>");
          break;
        }
        if (c == '\n') {
          // you're starting a new line
          currentLineIsBlank = true;
        } 
        else if (c != '\r') {
          // you've gotten a character on the current line
          currentLineIsBlank = false;
        }
      }
    }
    // give the web browser time to receive the data
    delay(1);
    // close the connection:
    client.stop();
    Serial.println("client disonnected");
  }
}
 
Awesome! Thanks!
Just noticed 2 small text errors on the MagJack page.
Untitled.png
Untitled1.png
 
Last edited:
Thank you! Saved me a bunch of time.

My application requires 100FX (LC Fiber) and I have a Cu-Fiber media converter, but it would be nice if I could interface a Fiber transceiver directly to the PHY. I've been looking into this, and it seems like it should work, but the PHY datasheet makes me wonder if the PHY would reject the transceiver due to it's built-in diagnostics. The transceiver I have is the Avago HFBR-5961ALZ, but I would also like to interface an SFP transceiver, if possible. Can it work?
 
Great, I was just going to ask when the kit would be available. Soldering a through hole capacitor is easier than SMT.

I assume the resistors listed in the original OSH park board aren't needed?

I personally will be soldering in the longer headers so that I can use my normal stacking headers for the normal outer row pins:

But it is good to have everything together as a kit. When I'm buying parts at digikey or mouser, I always wonder if I got the right resistor or capacitor, particularly getting the right sized versions that can be soldered in.
 
Last edited:
Those other parts aren't needed.

For the final kit I tried to keep it as simple and affordable as possible.

Great! Note in the Teensy 4.1 page, you have the link for the ethernet kit up top, but if you scroll down to the ethernet section, it only says the kit will be offered in the future.

As I understand it, the native ethernet support is not (yet) in 1.53. You might want to add a link for the library until it makes it into an official release.
 
That looks like a very good deal. I expect a lot of people will get one.

I have a question about the MagJack in the kit. It is a different part number from the one specified in the OSHPark version. Are they not interchangeable?
 
I have a question about the MagJack in the kit. It is a different part number from the one specified in the OSHPark version.

There are 2 designed shared on OSH Park, each with a different magjack.

Newer version:
https://oshpark.com/shared_projects/wUFt1emZ

Old version:
https://oshpark.com/shared_projects/5epewE3O


Are they not interchangeable?

Sadly, no, these 2 magjacks have different pinouts, even though functionally they are equivalent. That's why a new PCB design was needed.

I was about to find a vendor with a really good 1000 qty price on the Cetus part. Had we stayed with RB1-125BAG1A, the kit would have come in with a retail price around $5. I wanted to keep the kit affordable and also all simpler through hole soldering, so we delayed the kit by a few weeks and a 2nd board was designed.
 
Status
Not open for further replies.
Back
Top