TCP STACKS – The Evil That Can Destroy Your EtherNet/IP Project
Note: This is Part 1 of two blogs on TCP/IP Stacks
I am often asked why RTA doesn’t supply our own TCP/IP stack. Many of our customers are developing EtherNet/IP applications and need a TCP/IP Stack for EtherNet/IP or a TCP/IP Stack for Modbus TCP or even a TCP/IP Stack for Profinet IO. That’s a fair question. Honest Answer: it’s really impractical and costly to do that. Let me explain.
A TCP/IP stack is the software that provides the basics of Ethernet operation. It is a suite of protocols and software that implement all the abbreviations we kick around every day; HTTP, TCP, UDP, PING and all the rest.
The TCP/IP Stack is the link between every single one of your applications including your web browser and email and the RJ45 plug in the back of your computer. It provides all the know how to make connections with other devices, route messages through an Ethernet network, packetize large streams of data and much more. The TCP/IP Stack is critical software not only for email and web browsing but for EtherNet/IP, Profinet IO and Modbus TCP.
At RTA we use uCoS and the TCP/IP stack inherent in it for all our Ethernet Gateways. For example, we have a box that moves data between a Modbus Client device like a Modicon PLC and Ethernet TCP. Both those protocols use the same uCoS TCP/IP stack to make the TCP/IP connection and transfer data.
If you think about this for a minute, you’ll see why a TCP/IP Stack is not directly adaptable from one piece of hardware to the next. The TCP/IP Stack has to understand exactly what kind of hardware you have in your computer and how to transfer a message back and forth to that hardware. At the lowest levels a TCP/IP Stack builds a message and then must send it bit by bit to an Ethernet MAC (Media Access Controller) after which it will be converted to electrical signals by a PHY (Physical Interface). This means that the TCP/IP Stack has to be really intimate with your hardware.
For that reason you can’t just pick up one TCP/IP Stack and reuse it for another device. It has to have the right drivers for that device.
There are companies that provide TCP/IP Stacks but most silicon vendors that incorporate MACs into their silicon provide a TCP/IP stack at no charge. For example, Freescale provides something called OPENTCP. OPENTCP knows how to address the MACs used in Freescale controllers but not controllers from other Silicon vendors like Phillips or Intel.
The problem for an outside vendor who would want to provide these stacks is to create all the drivers for all the different pieces of hardware. And then supporting new pieces of hardware. Of course, by Murphy’s law, you will never have a stack that is exactly what a customer needs. So, it’s a mess that I haven’t wanted to jump into.
But that’s not the end of the story. No way. The problem with the free stacks from people like Freescale and Keil and others is that they often don’t work quite right. They are usually close. But not many vendors in the Industrial Automation world like “close”. Perfect is usually their choice so at RTA we’ve fixed a lot of these free TCP/IP Stacks. When people order ANSI C EtherNet/IP Scanner source code or ANSI C EtherNet/IP Adapter Source code we can give them a working TCP/IP Stack for their controller.