How to decode ethernet signals from scratch ? - Page 1
Forum section: electronics / projects

author: homemadecpu1986
author_rank: Contributor
timestamp: November 03, 2020, 05:11:14 am
content: Hi friends,I would like to take an ethernet cable, and then decode the signals from scratch. Is that too hard to do?Would a serial port connected to the ethernet cable work?Actually my homebrew CPU runs at 2.5Mhz. Is this too slow for ethernet signals?Basically I'd like to connect my homebrew CPU/Computer to the internet, but without using an ESP8266 kind of device,and decode the signals myself. Is this impossible?How about designing a fast digital circuit in 74 series to take in the signals, and write to a buffer memory for the CPU to use? Would that work?

author: retiredfeline
author_rank: Frequent Contributor
timestamp: November 03, 2020, 05:29:13 am
content: Here's a guy who decoded Ethernet (10BT though) without an Ethernet chip.https://hackaday.io/project/168551-etherpicI don't think you will have much luck with 100M or 1G without a chip.

author: Berni
author_rank: Super Contributor
timestamp: November 03, 2020, 05:57:18 am
content: To make things easier you probably want to stick to 10Mbit twisted pair ethernet.It uses manchester encoding so you need to sample the signal at 20MHz for it to work, so bitbanging it is out of the question on your particular CPU.So if you want to do it from scratch you need to build your own network card. To make things easier i would suggest using an existing Ethernet PHY chip such as the KSZ8061. It takes care of all the dirty work required to talk to ethernet, things like levelshifting, PLL clock recovery, preamble detection, deserialization, idle signals..etc These are things you really don't want to deal with as implementing it in raw logic and analog circuitry is a lot of work to design and then get it working reliably. In the old days of computer networking this was not actually even part of the network card, instead it was a external box that did all this and presented data over a Dsub connector using the MII bus(Media-independent interface). This is the exact same bus that modern 10Mbit 100Mbit and even 1Gbit ethernet PHYs use to communicate between the PHY and the rest of the network card. The only difference is that the job of that whole external box is now inside a single chip and this chip is located directly on the network card. So if you want to be more period correct in your oldschool homebrew computer you can try hunting down one of these 10Mbit Eternet MII adapters on ebay, but the functionality will be similar to modern Ethernet PHY chips.But using a Ethernet PHY chip still does not magically give you a network card. The chip is just a glorified serialiser/deserialiser for twisted pair Ethernet. It spits out a 2.5MHz clock and a 4bit bus for TX and RX. You still need to put together the raw bits barfing out of the 4bit bus into an actual ethernet frame. So at the very least you will need 2 FIFO buffers to hold the data and present it onto the CPUs memory bus. Typically network cards will also have MAC filtering built, so the card can look at the ethernet frame, pick out the destination MAC address and ignore it if it does not match its own MAC, this avoids buffering junk data meant for other devices, but modern LANs always have routers and switches so this is not really needed anymore as the network switch will already figure out what data is for you and only send you the packets you actually want.But if you want a really easy way of getting your computer online, just get a dialup modem and plug that into your serial port.