As a hobby project, I want to create a two-port router, and I want to do it from as low as level as possible. I want to program it in C.
Ethernet cables consist of 8 pairs of wires, and from what I know, only 4 of the pairs are used.
So let's say I approached this project form the very most fundamental level, let's say I decided to use a run-of-the-mill microcontroller such as a PIC that has 8 IO pins. Would this be an absolute mammoth of a task to do? Would I go insane trying to synchronise start and stop bits, reading frame check sums, sending Manchester-encoded data? Something tells me I'd be biting off a bit more than I can chew.
So what would be just up from that? Well how about if I had some sort of "callback function" that was magically invoked whenever a frame was received, something like:
void ProcessFrame(char unsigned const *data) { char unsigned mac_dest[6], mac_src[6];
memcpy(mac_dest,data,sizeof mac_dest);
data += 6;
memcpy(mac_src,data,sizeof mac_src);
/* I increment the pointer taking the data I need from the frame. */ }
That's pretty much all the functionality I would need. I'd write the network protocol stack myself.
I've heard about things like the "rabbit embedded ethernet" but it sounds way too advanced for what I want; it'd take all of the fun out of the project. Plus it's expensive.
Looking at other more basic devices though, I was very interested when I read the following article:
It involves using the ENC28J60 chip, but as far as I know it can only do 10 Mbps. That's great and all, but since this is my own little hobby project I see no reason why I can't opt for 100 Mbps or perhaps even gigabit (depending on the price of the chip!).
Anyone got any suggestions for what chip(s) I should use? Basically I just need the following functionality:
1) Analyse frames when they're received 2) Send out my own framesOf course, all the stuff like CDMA/CD would be handled under the hood and I wouldn't have to bother with it.
Also, as far as is possible, I like to program in Standard C (particularly to the 1989 standard), sot it'd be helpful if there was a pretty standard-compliant compiler for the chip.