EtherCat on Teensy 4.1?

blazini36

Active member
I've seen a few posts from a couple years ago but nothing with much info. I've seen some projects using an Arduino and this ethercat shield:
https://www.bausano.net/en/hardware/easycat.html

It seems like it would be a hell of alot cheaper and probably better to just use a Teensy 4.1 especially if it's already using a custom PCB, then only a magjack is required. I have no idea how this actually works, I'm assuming it would just require porting the library?
 
I'm assuming it would just require porting the library?
Had a quick look at the EasyCAT shield and related library. The shield uses a Microchip LAN9252 EtherCAT device controller, not a 'standard' Ethernet controller.
I assume that the LAN9252 chip probably takes care of the EtherCAT protocol processing, so that is something you need to implement as well when going for a Teensy 4.1 with Ethernet & MagJack.

Paul
 
Yeah, I've been digging into it since yesterday and EtherCAT works a bit differently than I thought it did. The master can run on a standard ethernet port with just some software. The slaves need an EtherCAT Slave Controller or ESC. The ESC has the 2 ethernet PHYs built in and the slave protocol is built into the ESC. They all seem to communicate via SPI with the with the MCU. The slave I presume can't be implemented in software, just ASIC or FPGA.

Looking at that EasyCAT shield info, when it's attached to an STM Nucleo it uses MBed code which they have the source on the MBed site. I'm a little confused as to how it would work with a Teensy 4.1 as it is an ARM....but it uses Arduino. MBed OS looks like it's been ported but nobody really talks about it here so I don't know whether the Arduino stuff or MBed stuff would be useable.

I don't specifically want to use that shield as for 1 it's hard to obtain in the US and for 2 the form factor doesn't really work with what I'm trying to do. I'm sure I could manage getting the LAN9252 going on my Teensy Carrier PCB, I just don't wanna deal with the software too much as I don't do code lol.
 
I'm sure I could manage getting the LAN9252 going on my Teensy Carrier PCB, I just don't wanna deal with the software too much as I don't do code lol.
Getting the hardware integrated on your board is probably the easy part, the coding is the part that is harder to accomplish.
You still may want purchase the shield as a reference for the person is doing the actual coding...

Paul
 
I’m not sure if it helps, but the QNEthernet library can do raw Ethernet frames. I’m also making a small update so that the library can be built without any IP support (IPv4, etc., and any protocols built on top), should you not want those features and want a smaller build.

I can’t speak to the real-time nature of the EtherCAT protocol or its timing requirements, and a library would need to be developed, but the current Teensy 4.1 hardware plus Ethernet kit might be a good platform with which to experiment observing the packets, and possibly responding to them to experiment with timing.
 
I’m not sure if it helps, but the QNEthernet library can do raw Ethernet frames. I’m also making a small update so that the library can be built without any IP support (IPv4, etc., and any protocols built on top), should you not want those features and want a smaller build.

I can’t speak to the real-time nature of the EtherCAT protocol or its timing requirements, and a library would need to be developed, but the current Teensy 4.1 hardware plus Ethernet kit might be a good platform with which to experiment observing the packets, and possibly responding to them to experiment with timing
Unfortunately I don't know enough about anything code related to say but I think an ethercat slave device will probably never work in software. I didn't really know the details when I posted this but I just started working on a PCB design using an STM32 and a LAN9252 ESC so I'm a bit more familiar with it now. Besides the timing issues, unless someone figured out how to reverse engineer the protocol "cleanroom" there will be license issues. An ethercat Master can be implemented in software for a Teensy or anything else without issue but the slave EtherCAT license is built into the cost of the IC, or the FPGA IP core so I don't think it can actually be done legally.

One thing that I've always wanted to see was a port of Mesa HM2 to the Teensy. Mesa is a company that makes FPGA motion control cards that are pretty much targeted exclusively at LinuxCNC. The realtime ethernet protocol in that is much simpler. There's been ports to much less capable MCUs, mostly within a project called "Remora" https://github.com/scottalford75/Remora/tree/feature/ethernet

I've never really messed with Remora because it never supported anything I wanted to use, plus I heard the code is kind of a mess. I had asked them about porting to Teensy but they've blown the request off. It's funny because at some point they actually did do some version for a Chinese CNC controller that uses an IMX1052 or 1062 (I forget), but some random purchases of that controller had a different MCU.

Unfortunately the Teensy and LinuxCNC world never came together because it'd be pretty nice to be able to get a custom controller going by just making a BOB and sticking a Teensy in it and just configuring the firmware. Larger controllers would still be better suited for an FPGA card but the Teensy would be pretty capable with smaller builds.
 
Back
Top