stefan-gloor.ch

Custom Ethernet Development Board

An assembled ethernet development board, a unpopulated PCB and a 3D model laying on top of printed schematics

I have always been fascinated by how networking devices work. No matter how complicated the network or how many devices are present on that network, you can just take any good old ethernet cable and plug it into your PC or laptop and boom: you’re now connected to the internet, you can write e-mails, you can print. No configuration necessary, it just works.

To demystify the whole “networks” topic, I began reading into how exactly a network device gets assigned an IP address, what each wire in the ethernet cable was for and what exactly happens if you “ping” something. Wikipedia is a great resource for understanding the OSI model and the individual protocols. The RFCs also helped me lot understanding the details.

At a certain point I thought I had to actually apply what I’ve learned. I also wanted a platform where I could experiment with the different protocols. To fully understand what I was doing, I decided that I want to do as much as possible from scratch.

So I decided that I wanted to challenge my electronics and coding skills and create my own ethernet hardware and to start my own implementation of a networking stack, just to see how far I’d get.

I have used Microchip’s PIC series microcontrollers a lot before, so I decided that building my “EthernetDevBoard” around one of them as well would minimize the design risk of making stupid mistakes with a new microcontroller. I also wanted to demonstrate that you don’t need a lot of processing power to handle networking capabilities.

Since I was getting familiar with FPGAs when I started that project, I decided that I want to make a dual-purpose PCB: depending on the populated components, you would either get an ethernet board that is built around a microcontroller or you get a piggyback board for an Altera DE0 nano FPGA board.

So I visited Altium’s CircuitMaker and started designing the PCB. After populating them by hand, I was happy to see that the microcontroller was alive and could talk to the ethernet chips. So no serious f-ups.

six assembled ethernet development board PBCs

Firmware-wise I was soon happy to see that I was able to send and receive packets using the “hardware” MAC address. Sending and receiving “Pings” using ICMP’s “Echo requests” followed. I got to the point where I could communicate with devices using raw IPv4 frames, with a network stack I hacked together myself on a hardware platform I designed myself.

video showing the counter display on the development board increasing, while a computer in the background represents the reception of packets a colorful rainbow.

In this demo I send UDP packets over the network and receive them with a little program I wrote on my computer. It calculates the delay time inbetween individual packets (around 35 ms) and displays their data payload as a bitmap image. The display on the development board shows the number of packets being sent. In the background, I'm monitoring the traffic with wireshark.

I learned a ton and it was a lot of fun. I’d call this project a success.

EDIT: It has been a few years now and I still like this project very much. My programming skills have improved since then and now I would probably try to adapt (or get strongly inspired by) the Linux kernel for the TCP/IP stack, instead of trying to hack something together myself or spend more time planning and testing the actual implementation.