-1
\$\begingroup\$

I am having a hard time understanding ethernet communications between devices. Does it use protocols like I2C or is it a unique protocol itself? Could two chips on the same PCB use ethernet connection to communicate, like we do with SPI?

I know in I2C we connect SDA and SCL of devices, and UART TXD and RXD but for ethernet would there be different pins to connect?

edit:

This link (OSI 7-layer) lists ethernet in the layer1 and layer2

For layer1 (physical layer) this description was given: "The physical layer defines the means of transmitting raw bits1 over a physical data link connecting network nodes." Examples of ethernet varieties in layer1: 10BASE-T, 10BASE2, 10BASE5, 100BASE-TX, 100BASE-FX, 100BASE-T, 1000BASE-T, 1000BASE-SX...

For layer2 (data link layer) this description was given: "This layer is the protocol layer that transfers data between nodes on a network segment across the physical layer.1 The data link layer provides the functional and procedural means to transfer data between network entities and might provide the means to detect and possibly correct errors that may occur in the physical layer."

This question discusses how SPI, I2C, ..etc. relates to OSI model question short answer it isn't really a good fit/comparison.

\$\endgroup\$
16
  • 2
    \$\begingroup\$ Ethernet doesn't use I2C/SPI/USB, there are many different protocols defined. Take a look at the OSI standard 7-layer model as a starting framework. As noted in the ethernet tag wiki, there are different standards for the different physical (datalink) connection types, as well as different protocols on the transmission control layer (TCP vs UDP) and different addressing protocols (IPv4 vs IPv6). There are also a lot of RFC documents from the early days of the internet. There's a lot to research, but I2C/SPI/USB are unfortunately not a good starting point for understanding ethernet \$\endgroup\$ – MarkU Mar 26 at 4:51
  • \$\begingroup\$ Suggest that after you read the wikipedia article on OSI 7-layer model, come back and edit this question to reflect what you've learned and where you're stuck. \$\endgroup\$ – MarkU Mar 26 at 4:52
  • 1
    \$\begingroup\$ Ethernet is "peer to peer"; one of its innovations is determining how to share the bus without a bus master: en.wikipedia.org/wiki/… \$\endgroup\$ – pjc50 Mar 26 at 15:59
  • 1
    \$\begingroup\$ @MituRaj, to get a simple basics answer on Ethernet, you recommend the OP reads a 508-page book. Is that would you'd do yourself with a new subject: no intro, just into a 500-page book? \$\endgroup\$ – TonyM Mar 26 at 17:09
  • 1
    \$\begingroup\$ I would not have minded unless you judge a book based on the page numbers rather than actually reading it. Even now, if somebody asks here " I want to build strong fundamentals in Electronics", most people suggest here "The Art of Electronics", which is a 1000+ page book rather than online articles. They know why they suggest it, because they have read it and helped them on their way. You can question their logic and be judgemental, IFF you have read the same book. Either way, you can't question their opinions. \$\endgroup\$ – Mitu Raj Mar 26 at 18:20
1
\$\begingroup\$

Ethernet is a way to connect, mostly, two computers, or a computer or many computers to a printer, or scanner, and so on.

Ethernet specifies how its OSI Layer 2 is, and it can be implemented via several different OSI Layer 1: for example, 10BASE-T, 100BASE-T, 1000BASE-T are very similar, but with different speeds.

Ethernet is used between computers, printers and so on because it is a very high level protocol, transmitting (relatively) big chunks of data, protecting them with checksum, telling where the data comes from, where data has to go (one node or multiple nodes), and so on.

Because it is a complex protocol, it is not used for simple devices like, say, a PCB-mounted ADC converter: the ethernet interface would cost more that the converter itself.

SPI and i2c are much more simple, often slower, they don't have checksum, they don't tell you where the data come from (SPI not even says where they have to go, you decide that with additional hardware). Moreover, their physical layer is designed for much shorter distances than Ethernet. I.E.: SPI and i2c are designed to connect simple devices inside a more complex device; Ethernet is designed to connect complex high level devices, bigger and intelligent, in the range of tens of meters (depends on specific implementation).

Hope this helps.

--- UPDATE --- A funny idea comes to my mind. Why Ethernet is not used to interface a eeprom memory chip to a CPU is obvious: the interface would be more complicated and expensive than the memory itself. Let's try the contrary: use an i2c to connect 3 computers in your house.

i2c: you lay a bus between three computers. Terminate the line, otherwise the reflection of the signals will be too high, with lots of errors. Then you discover that you need big voltages to go far enough: the voltage drop and the line terminators are a problem. Then you discover that your i2c wires must stay well apart from other wires, especially 230V ones. Even so, every time the washing machine washes, the computers communicate badly. Then you discover that i2c is too slow to stream films from a computer to another. So, you substitute the lines with differential lines, more immune to noise, and construct special hardware to rise the speed. Much better. But then you discover that even so, as you are using hald-duplex, it is not possible to reach very high speeds, because of the latencies of the computers; a single error causes big delays: greater the speed greater the possibility of errors. So you implement full-duplex. Then you add a higher level software protocol, with some checksum and other amenities, and you have just begun to re-invent the ethernet...

With SPI it would be even funnier: you can not make a simple bus: you would need a master computer (say, PC A) with outgoing wires to every other "slave PC". Moreover, the slaves can not talk when they need: they must be asked by the master. So to send data from PC B to PC C, all the data must pass through PC A. In fact, i2c is more similar to ethernet than SPI is...

\$\endgroup\$
1
\$\begingroup\$

This is a rather vague and broad question, but I’ll attempt an answer.

Ethernet IEEE 802.3 was originally and primarily intended for remote communication between devices using coax, twisted pair, fiber, and even radio. Ethernet may be used for local networks such as within a building, or regional metropolitan networks (MAN). Ethernet is also used for very long distance wide area networks (WAN) that may be intercontinental.

I2C, SPI, UART etc are intended for short distances typically on a PCB or within a product. Yes they can be extended a few meters with special care but that’s in a sense not practical or reliable.

Ethernet uses the data link layer protocol as defined in IEEE 802.1. SPI and UART have no such link layer protocol standard. I2C may arguably have a standard link layer definition as it specifies an addressing and acknowledgement scheme, but the low level communication is largely up to the user to implement.

USB does have a link layer protocol definition, but it is intended to connect devices within a short range as you know. You can’t use USB to network a building.

Ethernet can also be used to communicate within a PCB or product as is done with I2C, SPI, UART. There are flavors of Ethernet that even allow for multiple devices to be connected to the same shared bus. These connections are made via differential PCB traces or short cable interconnects between boards. See IEEE 802.3 Clause 147. These networks do not use transformers for galvanic isolation.

One of the largest advantages of Ethernet over the other technologies mentioned is that the data link layer protocol remains the same while changing the physical layer transceiver (PHay) is all that is needed to allow for different speeds and distances. The physical layer is therefore conveniently hidden from the application and network layers above.

CAN is used for short range control and sensor networking. It is widely used, but has some limitations including speed and lack of acknowledged delivery (packets are sent multiple times). Ethernet allows for faster speeds using a similar multi-drop physical layer that leverages the common Ethernet data link layer protocol.

\$\endgroup\$
0
\$\begingroup\$

You can have a look at this question which explains the difference between Ethernet and CAN.

Ethernet, CAN, RS232, RS485 are Buses used to carry information over cables that can be disconnected. They usually are protected against ESD and uses some sort of transceiver. It is basically buses that goes over longer distance and communicate between different boards or devices.

SPI, I2C are the two most common inter-chip communication Buses, they are designed to communicate between chips within a single PCB. They are not by default protected against ESD and usually not used for wired communication.

SPI is simpler to implement on a firmware level than I2C, but I2C is more flexible.

UART isn't really a bus by itself, it's a serial communication output/input of a chip. UART can be used with a transceiver to have an RS232 bus or be used as a TTL Serial to connect a debugger.

To summarize:

  • Ethernet, CAN, RS232, RS485 -> Board to board or device to device communication
  • I2C, SPI -> intra-board communication
\$\endgroup\$
2
  • \$\begingroup\$ I am confused by this. Can ethernet allow multiple computers/processors to communicate? And I2C/SPI is just one computer/processor controlling peripherals/slave, or could two computers communicate via I2C? \$\endgroup\$ – Feynman137 Mar 26 at 14:11
  • 3
    \$\begingroup\$ @Feynman137 - With the proper hardware you can make two computers communicate via smoke signals. So could 2 computers communicate via I2C? Yes. Is it done in practice? No. There are much better interfaces for this, such as Ethernet. \$\endgroup\$ – Wesley Lee Mar 26 at 15:05
-2
\$\begingroup\$

I edited this answer because it contained errors.

Ethernet is one of the most important I/O interface.

Ethernet was invented in the 70's.

Ethernet is nowadays galvanically isolated.

Ethernet is meant for high distances: up to 100 m on copper.

Ethernet is a high speed differential interface on copper.

Ethernet is an IEEE standard interface: 802.3

Ethernet is the default interface of Local Area Networks.

The software stack is quite complex.

SPI and I2C are meant for 1:N inter-board master-slave communications. Master and slave are not galvanically isolated interfaces. You need PCB traces to interconnect 2 or more integrated circuits.

USB is identical to SPI and I2C interfaces except that it is meant for high speed communications. It may be used for inter-board and extra-board communications.

\$\endgroup\$
9
  • \$\begingroup\$ You must be talking about a specific Ethernet physical layer interface so your answer just creates more confusion. Ethernet interfaces comes in various forms such as twisted pair or coaxial or optical fiber interfaces. So not all are differential, and the fiber goes for 100km instead of just 100m. There are even many twisted pair types of interfaces, too many to list here. What is common is the Ethernet data frames sent over the interface. \$\endgroup\$ – Justme Mar 26 at 7:38
  • 3
    \$\begingroup\$ i strongly suspect they had serial interfaces before Ethernet \$\endgroup\$ – user253751 Mar 26 at 9:34
  • 1
    \$\begingroup\$ There are a number of issues with this answer. Ethernet is not always galvanically isolated with transformers as there are many different flavors of Ethernet. Ethernet is not the father of other serial protocols. There is a case of master/slave in Ethernet (see Clause 148). Ethernet is the default for Ethernet LANs, but a local area network may be created using any number of networking technologies. (Plus “default” for what?). The software stack complexity is an opinion. The base 802.1 is pretty small; the complexity comes from whatever non-Ethernet (TCP/IP) higher layer protocols you add. \$\endgroup\$ – TimB Mar 26 at 15:36
  • 1
    \$\begingroup\$ The OP is simply a newcomer, not an idiot, so welcome and encourage them, don't patronise them. Meanwhile, since when was Ethernet 'the father of all I/O interfaces'? That's a ridiculous claim, amongst the many errors. There have been a lot of buses over a lot of years and Ethernet's just one of them. Downvoting for those reasons. \$\endgroup\$ – TonyM Mar 26 at 15:56
  • 2
    \$\begingroup\$ Ethernet doesn't run on Fiber, there is ethernet converter that will translate Ethernet over fiber, but then it's another protocol on the fiber itself that includes wave modulation and all sorts of fiber-related stuff, as you can have USB over ethernet or USB over fiber or IP over pigeon en.wikipedia.org/wiki/IP_over_Avian_Carriers . \$\endgroup\$ – Damien Mar 29 at 4:56

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