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

Thread: Teensy 4.1, Ethernet Interface and SMB Server

Hybrid View

  1. #1
    Junior Member
    Join Date
    May 2020
    Location
    Somerset, UK
    Posts
    4

    Teensy 4.1, Ethernet Interface and SMB Server

    Hi Everyone

    Apologies if these questions have been asked in other threads, but I've done a number of searches and not been able to find any references.

    I have my Teensy 4.1 up and running. Now I want to add an Ethernet socket and talk to my network. I have a Sparkfun MagJack - is there any reason I can't hardwire to that? Do I need any capacitors to make it work? I saw a post which suggested a 0.1uF was required but it wasn't obvious to me which pins to connect it across.

    I want to gather data with the T4.1, connect to an SMB server on my network, create a file and write data to it on the network server. Is there any code out there to help me achieve this?

  2. #2
    Member MorganS's Avatar
    Join Date
    Apr 2015
    Location
    Northern Nevada
    Posts
    63
    I was just looking at the Sparkfun magjack schematic yesterday. It appears to include the required capacitor inside the magjack. So no external components are required.

  3. #3
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    22,250
    Which Sparkfun product? These are the 2 magjacks I was able to find on their site.

    https://www.sparkfun.com/products/8534

    https://www.sparkfun.com/products/13021

    Both of these require you to add a 0.1 uF capacitor, connected to these pins:

    Click image for larger version. 

Name:	magjack.png 
Views:	7 
Size:	44.0 KB 
ID:	20567

    To use these with Teensy 4.1, you need to short the P3 and P6 pins together, and then connect a 0.1 uF capacitor between those wires and the GND pin on Teensy 4.1. The other signal pins, P1, P2, P7, P8 connect directly to the 4 ethernet signal pins.

    You should also connect GND to the shield. But that 1000 pF capacitor connected to the 75 ohm resistors is not enough. It only provides the "Bob Smith termination" for the 4 unused wires in the cable. That's a completely different thing than the 0.1 uF capacitor needed between the transformer center taps and Teensy GND.

  4. #4
    Junior Member
    Join Date
    May 2020
    Location
    Somerset, UK
    Posts
    4
    Hi Paul

    Thanks for your detailed reply which not only worked first time, but also taught me stuff about the Ethernet hardware interface I should have known years ago :-)

    Does anyone knows of any code examples which would let a T4.1 access an SMB server to create files? The alternative is to store data files on an SD card and implement a Web Server on the T4.1 to make them accessible over my local network, but that's been done, so less fun.

  5. #5
    Junior Member
    Join Date
    Jun 2020
    Location
    Hereford, UK
    Posts
    7
    Hi DazedAndConfused (or anyone else who knows), would you mind just clarifying the connections you used to the Sparkfun board (assuming you're using the breakout board)? I've been scratching my head over this for some time this morning!

    I get the bit about shorting P3 and P6 then a cap to GND. But as for the rest, are we talking something like this?


    T+ -> P1
    T- -> P2
    R+ -> P7
    R- -> P8


    And then GND and LED to one of the LEDs (does it matter which?). I've never needed to look at the connections to an ethernet socket before, and just want to minimise the number of things I've possibly got wrong before I start on the code!

  6. #6
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    22,250
    Since this thread was started, we've begun selling a kit for the ethernet connection.

    https://www.pjrc.com/store/ethernet_kit.html

    This is the schematic for the kit (also found at the bottom of those page for the kit). Hopefully it helps clear up the required wiring?


  7. #7
    Junior Member
    Join Date
    Jun 2020
    Location
    Hereford, UK
    Posts
    7
    Thanks Paul - I'd already bought the parts to make my own, before you started selling yours. And, being in the UK, it's a little more tricky (or expensive) to get hold of anyway.

  8. #8
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    22,250
    Perfectly fine to DIY build it. If you get it working with the Sparkfun board or any other hardware, hope you'll share a photo. Might help anyone else who later finds this thread and want to try building it themselves.

  9. #9
    Junior Member
    Join Date
    Jun 2020
    Location
    Hereford, UK
    Posts
    7
    Well that seems to work, so for anyone else using the Sparkfun magjack breakout, here's the connections to the 6-pin ethernet header on the Teensy 4.1:

    Click image for larger version. 

Name:	Teensy Sparkfun Magjack.png 
Views:	7 
Size:	310.9 KB 
ID:	20760

Posting Permissions

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