5
\$\begingroup\$

I wonder if I can use the physical ethernet layer like a serial port. Is it possible? The case would be reading signals with an electronic device without dealing with networking headers.

\$\endgroup\$
  • \$\begingroup\$ My knee-jerk response is to tell you to use an OpenGear. But I'd also call that encapsulation. Though I wonder if what I consider encapsulation isn't really what you mean by it...? \$\endgroup\$ – James T Snell Jan 4 '12 at 23:55
11
\$\begingroup\$

Yes, absolutely you can ditch the network protocol layers and send data "directly". But, you probably don't want to.

What you do is use standard Ethernet Phy's, magnetics, and connectors. But instead of using an Ethernet MAC (media access controller) you use an FPGA to send/receive data without the network overhead. This has been done for several "not quite Ethernet compatible" interfaces like Ethersound, and other industrial protocols.

One thing that you can't ditch is the packet nature. You must still transmit data in packets of 64 to about 1500 bytes (some Phy's allow packets up to 8192 bytes). You can't transmit packets smaller than 64 bytes, or larger than 1500. And you must allow for the proper "gap" between packets. But you have complete control over what is in the packets, and any header (if any).

I am glossing over lots of details, however. It's actually not all that easy, and the requirements are different depending on which Ethernet standard you want to use (10/100/1000 mbps). In some cases there are signal encoding issues to deal with.

I would advise that you not do this to Ethernet. It requires a large amount of skill to design the FPGA logic-- skill that most people do not have. And the benefits of doing this are minimal. It's much easier to simply use the standard Ethernet controllers and the associated protocol stacks than to dream up your own thing.

| improve this answer | |
\$\endgroup\$
  • 1
    \$\begingroup\$ The packet length requirements are imposed to ensure reliable collision sensing and recovery. If one were operating a private network with a different maximum cable length and retry timings, one could allow shorter or longer packets. Nonetheless, the byte-level encoding used on Ethernet requires that bytes of data be sent consecutively without pauses, unlike async serial which can accommodate and preserve arbitrary amounts of timing between bytes. \$\endgroup\$ – supercat Jan 5 '12 at 16:05
  • 2
    \$\begingroup\$ @supercat That's not entirely correct, at least not in this context. Shorter packets might be OK, but longer packets would not be (unless spec'd in the Phy datasheet). The Phy is doing something called "Baseline Wander Correction". Normally the Phy uses the inter-packet gap to recalibrate the baseline. If this is not done frequently enough, it goes out of whack and you get data errors. Modern phys with better BWC allow for longer packet lengths (a.k.a. Jumbo Packets). Collision detection does play into it, but that's not the whole story. \$\endgroup\$ – user3624 Jan 5 '12 at 16:44
5
\$\begingroup\$

You can indeed run RS232 over Cat5 ethernet cable. Routers and similar devices sometimes have serial "console" ports with 8P8C modular sockets (RJ45 jacks).

However if you want to send serial data through an Ethernet NIC without actual Ethernet packets appearing on the wire, you are out of luck.

On the other hand, many manufacturers sell serial-to-ethernet converters which can be used in pairs to transparently connect serial devices using Ethernet infrastructure. Search for "Ethernet Serial"

Example from gridconnect.com

Sometimes these come with "ComPort Redirector Software" that create a Virtual Com port on a computer. These probably work with most applications that expect a real serial port. They may not work if you are doing low-level bit twiddling.

enter image description here

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Also, if there is a switch inbetween, it will get very confused. \$\endgroup\$ – MikeNakis Jan 4 '12 at 23:26
5
\$\begingroup\$

Based on your question I think I know what you want, but I want to clear some things up first.

  • Ethernet (or as the standard is called IEEE 802.3) is on layer 2 (data link layer) of the OSI model.
  • The wire (the cat5/6 cable and RJ45 connectors) are actually defined in Layer 1 (Physical Layer), You may have heard of the term 100BASE-T before, that is defining the physical layer.
  • Ethernet does not have to run over 100BASE-T, and 100BASE-T does not need to carry Ethernet

Now on to your question:

You can buy devices that will carry serial over 100BASE-T but will not do any encapsulation. These devices will not work with your home network as your switch/hub/router is expecting IEEE 802.3 packets to be coming down the wire and not Serial packets.

You can also get devices that will do serial over IP but it does not have to use 100BASE-T cable (or Ethernet).

| improve this answer | |
\$\endgroup\$
4
\$\begingroup\$

Yes and no; copper is copper and RJ45 copper works great for serial connections, but don't confuse it for Ethernet unless it's talking the Ethernet protocol - switches and other ethernet devices won't approve.

Cisco certainly likes this idea, for instance; the standard Cisco serial console cable is RJ45 copper on the device end. enter image description here

| improve this answer | |
\$\endgroup\$
  • 3
    \$\begingroup\$ That isn't using the Ethernet physical layer, that's just using Ethernet cables. The physical layer includes the signalling method, voltage levels, pinout, and so on. \$\endgroup\$ – David Schwartz Jan 4 '12 at 23:13
  • 3
    \$\begingroup\$ @DavidSchwartz "without dealing with network headers" takes one squarely out of the realm of ethernet. Given that, my guess was that he meant he'd like to use CAT5 for a serial connection. Uğur, is that the case? \$\endgroup\$ – Shane Madden Jan 4 '12 at 23:16
  • 1
    \$\begingroup\$ Network headers aren't part of the Ethernet physical layer. You're assuming he meant something non-standard by the technical term "Ethernet physical layer". You'd think he'd have said "Ethernet cables" or something similarly informal. \$\endgroup\$ – David Schwartz Jan 4 '12 at 23:18
  • 1
    \$\begingroup\$ @DavidSchwartz You're absolutely right, but there's a potential language barrier, as well. The phrasing of the question led me to think that ethernet wasn't the term that he was looking for. I'll delete this answer if that turns out to not be the case - and I've upvoted your answer for answering the actual question instead of the imagined question. \$\endgroup\$ – Shane Madden Jan 4 '12 at 23:24
  • 3
    \$\begingroup\$ +1 I think this answers what the OP originally had in mind. \$\endgroup\$ – tyblu Jan 5 '12 at 18:26
3
\$\begingroup\$

No, not with what is usually understood as the "physical layer" of ethernet. This includes the cable, magnetics, and the PHY (stands for "physical"). Even at the physical layer, you're not just sending arbitrary 0 and 1 levels to the other end.

There are also multiple things called "ethernet" that are different at the physical layer. There is the original, 10base-2, 10base-T, 100base-T, etc. The older slower ones used manchester encoding if I remember right. At 100 Mbit/s things were changed to achieve the higher speed. Even if you restricted yourself to the old 10 Mbit/s manchester encoded versions the answer would still be no. Data is inherently sent in packets. These have a preamble private to the phy layer which is used in part for collision detection (in some variants), clock synchronization, and start of packet identification. Then there is some out of packet signalling, like link pulses, which is handle in the physical layer. Since ethernet is transformer coupled, everything has to happen at some minimum frequency since the DC level is lost from one end to the other. This is one reason for manchester encoding.

You could set up a private ethernet with just a phy at each end and send individual packets. Technically you don't need a MAC layer if you just want to get packets of raw bits from one end to the other. In practise, it is probably easier to use a MAC layer at each end too, even if you just want packets of bits from one end to the other. Phy chips are usually designed to be driven only by specific MAC chips, or sometimes you get the PHY and MAC all integrated into one chip, called a MAC/PHY. You can still send packets of raw data at the MAC level by ignoring some of of the wrapper stuff.

| improve this answer | |
\$\endgroup\$
1
\$\begingroup\$

To do that, you'd need to take the physical layer PHYceiver from an Ethernet card and connect it to a serial port rather than an Ethernet controller.

Note that you could only use this point-to-point. You could not use hubs or switches. Some hubs might work by luck, but switches definitely won't.

What's the outer problem? There are likely much better ways to get the job done.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Make your last paragraph a comment. Ideally you should ask all relevant questions before answering. \$\endgroup\$ – Kellenjb Jan 5 '12 at 3:20
  • 1
    \$\begingroup\$ No you can't "simply" take a Phy and connect it to a serial port. The standard MII/GMII/Etc interfaces to Phy's requires certain symbols be transmitted that you can't do with a simple serial connection. \$\endgroup\$ – user3624 Jan 5 '12 at 4:10
  • \$\begingroup\$ @DavidKessner You're right. You'd need clocking and encoding that the PHY could tolerate. The idea's basically a non-starter. \$\endgroup\$ – David Schwartz Jan 5 '12 at 6:26
  • 1
    \$\begingroup\$ @Kellenjb I don't need to know that to answer his question, I'm just suggesting he's asking the wrong question. \$\endgroup\$ – David Schwartz Jan 5 '12 at 6:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.