It has been quite a while since my last update, and the project has moved forward a long way! I’ve made a lot of progress with the operating system software (I’ll be writing a log about this soon) and the hardware has advanced a bit too.
I designed a 10/100Mbps Ethernet peripheral card, based on a Microchip ENC624J600, for the system. This enabled me to validate the motherboard’s peripheral interface design, and - more importantly - to start writing networking code in the operating system. Here’s a picture of the bare pcb next to a populated board.
The bare pcb is actually rev1 (i.e. the second version of the board - I start my revisions at 0). It contains two minor fixes to the rev0 design.
I mentioned in an earlier post that I'm trying to keep the whole design as close as possible to Motorola 68000-era (i.e. 1980s) technology. As time goes by, that's proving to be more of an aspiration than a rule set in stone. When considering designs for a network card, I looked at a few 80s/90s-era Ethernet controllers but - unsurprisingly - none were as capable or as easy to use as the ENC624J600. Also, magnetics (i.e. Ethernet transformers) suitable for these old parts are now really hard to find. I'm keen to avoid using parts that must be scavenged from ancient PCs, or are only obtainable on eBay, so I decided to use a modern part in the design. The ENC624J600, and a few of its decoupling capacitors, are (so far!) the only surface-mount parts I've used in the system. I admit that my desire to get the motherboard attached to a network trumped my desire for that pure '80s look.
The ENC624J600 is a really nice chip. It provides an integrated Ethernet MAC and PHY, has a built-in encryption engine (albeit a slightly buggy one…), has 5V-tolerant inputs, provides 24KB of buffer RAM and is extremely configurable. What's not to like? There is even a 16-bit data bus interface - ideal for the MC68000/68010 - and the chip glues to the system bus very easily. Most importantly of all, Microchip’s data sheet for the part is excellent. It's a 3.3V part, and it's fairly thirsty, hence the enormous TO-220 LDO at the right-hand side of the card.
I've byte-swapped the data bus in this design, meaning that the upper half of the ENC624J600's data bus (D15...D8) is connected to the lower half of the MC68000's data bus (D7...D0), and vice versa. The ENC624J600 is an inherently little-endian device, unlike the big-endian MC68000. Sadly the world is now overwhelmingly little-endian (boo...), so - while Ethernet header and footer data is big-endian (yay!) - the contents inside packets is typically not. Byte-swapping the data bus in this design saves me the effort of swapping received bytes around in memory, thereby increasing the overall performance of the interface. I've used the same byte-swapping trick in the ATA interface on the rev1 motherboard - more on this in a future log.
I have written most of a driver for the ENC624J600; the operating system is able to configure the part, establish an Ethernet link, and transmit and receive packets. The motherboard peripheral interface design incorporates a way for the operating system code to automatically detect and identify plugged-in peripheral cards, so the OS can locate the card and start its driver during the boot process. There's no reason why I couldn't plug additional Ethernet cards into the motherboard, if - for example - I wanted to create an extremely low-performance network router.
Here’s a picture of the Ethernet controller card installed in the motherboard.
I’ve also started work on a network stack in the OS code. So far it’s quite minimal - it knows how to handle incoming Ethernet packets and route them to appropriate protocol handlers (IPv4, ARP, etc.) Eventually I hope to have a working TCP implementation, but that’s going to take some time. For now, I’m happy to have reached a point where the operating system can, using a background process which listens for incoming packets, respond to ARP requests sent by other hosts on the network. It feels like a win.
As always, writing the software takes up far more of my time than the more enjoyable (to me!) hardware work. Still, I’m learning a lot as I go along, and that was the point of the exercise :)