Thursday, January 9, 2014

TX, RX, and UART - The Ethernet Cable

I am tasked with an objective to acquire an internet signal over 500 feet away from the internet source. The owner is hesitant to use Ethernet cabling and is unwilling to go through the trouble of setting up wireless router hopping. The first concept that immediately comes to mind, I waited months to try: Google Fiber. Now, this feature isn't yet available in Alaska, however, I could emulate it! After all, all I would need is a 570 foot fiber reel, a computer, internet, and some way to put everything together... At first glance, this is pretty strait forward, but when I go to look inside of that Ethernet cable, I am baffled. Which wire does what?!

There are a total of eight (8) wires in an Ethernet cable, where there are a total of four pairs. Each pair does it's own thing:

  • Wire 1 & 2: Transmit information (otherwise known as the TX line)
  • Wire 3 & 6: Receive information (otherwise known as the RX line)
The remaining two pairs (4 & 5 and 7 & 8) vary upon application.
In the first (common) application, the pairs function as follows:
  • Wire 4 & 5: Power ( + VAC)
  • Wire 7 & 8: Ground ( - GND)
And in the second application, common to servers and other high data communication applications, two pairs will transmit and two will receive:
  • Wire 4 & 5: TX (unofficial)
  • Wire 7 & 8: RX (unofficial)

Okay, next: why is there a pair for TX and the same for RX. Or in other words, what does TX+ and TX- mean (the same for RX)? The answer is simple: the data that runs through D+ and D- is the same. The only difference is that D- is the exact opposite of D+. (Imagine drawing a graph of D+ and then flipping it upside down - this is what the graph would look like for D-) What use is this? Over long distances, wires can pick up 'noise' just like an antenna to a radio. What is cool about this design is what happens to that noise on the other end. When the data is received on the other end, the graph of D- is flipped over again and then added to D+ essentially canceling out the noise - aka noise cancellation. After all 1 + -1 = 0 and 2 + -2 = 0 as well. See this demonstration below:

Great, we solved for noise, but I still don't know how little bits are sent along this wire... don't you need a clock or something? Yes you do! In fact, you need two and a bit of asynchronization. Welcome the magic of UART (Universal Asynchronous Receiver/Transmitter)! From the transmitting end, the bits are clocked out, but only the bits and not the clock its self. As for the receiving end, it samples the bits with its own clock and then makes sense of the full picture. Take a look at this Wikipedia article for an in depth review of this data handling: https://en.wikipedia.org/wiki/Universal_asynchronous_receiver/transmitter

WOW, that was much simpler than I thought! Well... now that I have been enlightened. And of course, I did have to run through several hours of research and reading, but now I can present it here, all in one comprehensible piece!

Oh, and did I mention that USB works in a similar manner? It's a half duplex instead of a full duplex (which is the Ethernet cable). Also get to know about buffer rings!


Ethernet Speeds:
Cable Type
Maximum Data TX Speed
Maximum Bandwidth
Category 3
UTP
10 Mbps
16 MHz
Category 5
UTP
10/100 Mbps
100 MHz
Category 5 e
UTP
1000 Mbps
100 MHz
Category 6
UTP or STP
1000 Mbps
250 MHz
Category 6 a
STP
10,000 Mbps
500 MHz
Category 7
SSTP
10,000 Mbps
600 MHz
To see your computer's bandwidth:
Windows:
Go to Start>Control Panel>Hardware and Sound>Device Manager
Look for your Network Device(s) under Network Adapters
Right-click on the device and select Properties
Select the tab titled Link Speed
Under Speed and Duplex, you can see a selection listing all speeds for that particular device.

Linux:
Go to a Terminal and type:
lspci | grep Ethernet
# or sudo lshw
When you find the name of the port, type: ethtool name_of_port   # ex: ethtool eth0
Under Supported link modes you'll see all speeds for that particular device.

I have a 10-year-old HP Compaq that supports 1000baseT/Full or in other words, 1Gb/sec.
I also have the same for an HP Z1 (1.0 Gbps Full Duplex).