EmbeddedRelated.com
Forums

Ethernet in its most basic form

Started by Unknown May 2, 2008
On May 3, 1:22 pm, Tom=E1s =D3 h=C9ilidhe <t...@lavabit.com> wrote:

> There's a complication in my two-port router project, namely that I'll > have two ethernet ports. I wonder will I end up needing two separate > ethernet microcontrollers that will communicate with each other? Or > perhaps even four microcontrollers?
I suggest getting one controller with ethernet, and making a simple project where some hardware can be controlled over an ethernet connection. Making your own router is a complex project for a beginner, and not very useful. Routers can be obtained in any PC store for less than you'd need for the parts.
On May 3, 7:22 am, Tom=E1s =D3 h=C9ilidhe <t...@lavabit.com> wrote:
> Thanks for all the replies. > > I see now that there's two ways of going about this: > > 1) Getting an independant ethernet controller that will connect to my > separate microcontroller > 2) Getting a micrcontroller that has built-in Ethernet > > I definitely want to go with the built-in Ethernet! > > I was thinking to myself that it would be cool get a chip that can do > gigabit, but I've been googling and I haven't found one. > > So far, I've looked at these two chips: > 1) PIC18F97J60 : It can only do 10 Mbps and its core is 8-Bit. > 2) MCF5223x : It can do 100 Mbps and its core is 32-Bit. > > My own electronics provider lists them at the around about the same > price for a single unit: $10. > > So far I'm thinking of going with the MCF5223X. I'll have to find out > if I can get a handy little kit for programming it that will connect > to my PC via USB. > > There's a complication in my two-port router project, namely that I'll > have two ethernet ports. I wonder will I end up needing two separate > ethernet microcontrollers that will communicate with each other? Or > perhaps even four microcontrollers?
Do either of these parts include the PHY? One part that I know of which does is the Luminary Micro LM3S6xxx or LM3S8xxx part. Both of these include an Ethernet MAC and PHY for 10 or 100 Mbit/s operation, along with a lot of other peripherals. They have an eval board for around $50, IIRC. The Motorola parts tend to have expensive boards and the LM parts run a lot faster than the PICs. If you want to know cost effective ways of building a router, you could buy one and open it up. In fact, if you dig around, many routers have been hacked and info is available for booting them with Linux. That would be the ultimate inexpensive development system!
On Fri, 2 May 2008 17:02:25 -0700 (PDT), Tom&#4294967295;s &#4294967295; h&#4294967295;ilidhe
<toe@lavabit.com> wrote:

>On May 3, 12:17&#4294967295;am, "robertwess...@yahoo.com" ><robertwess...@yahoo.com> wrote: > >> If what you're wanting to do is implement the protocol stack, then you >> definitely want to use a canned Ethernet controller. &#4294967295;And that will >> give you exactly what you want. &#4294967295;You hand it a frame, and it sends it, >> and it will let you know when it's received one. &#4294967295;Just pick one that >> easy to interface with the CPU of your choice. > > >This is exactly what I'm looking for, a microcontroller that sends >frames when I tell it to, and also hands frames to me when they're >received. I want to write all the protocol stuff myself. > >You say "pick one that's easy to interface with the CPU of your >choice"; I thought that these devices were fully-fledged >microcontrollers and so I wouldn't have the option of mix-matching >CPU's.. ? Do I misunderstand? > >Can anyone suggest a very simple Ethernet micrcontroller that will do >what I want? I've considering going with the ENC28J60 which can do 10 >Mbps, but I just want to check first to see if there's anything that >does 100 Mbps or maybe even gigabit.
If you google Fred Eady (Circuit Cellar), you'll find a bunch of his projects that deal w/ ethernet at a basic level where you can learn quite a bit w/o going nuts... Your basic chips are the ENC28J60, 18F67J60, the Realtek 8019as, National 83848i, and the Cirrus CS8900. I'm sure there are others but these are the ones I've played with, & there is plenty you can do w/ these w/o dropping big $$$. Don't forget, you still need a PHY+magnetics. Best, Tom
I just want to run a design past you. I only thought of it a few
minutes ago so I'm not certain if it'll work.

A normal ethernet-capable microcontroller works with only one Ethernet
port, but of course I'll want it to work with two ports if I'm to have
a two-port router.

My two-port router will have very basic functionality. A packet that's
received on port 1 will be forwarded out on port 2 (but with a altered
target MAC address of course). Also, a packet that's received on port
2 will be forwarded out on port 1 (again with an altered target MAC
address).

Now how about this:

Let's say I get two ethernet microcontrollers, uc1 and uc2. And let's
say I get two ethernet ports, p1 and p2.

Now let's say I use uc1 to recieve data from p1, and to send data out
on p2.
In the same fashion, I'd use uc2 to receive data from p2 and send data
out on p1.

I'd do this simply by connecting one wire pair of p1 to uc1, and the
other pair to uc2. Similarly I'd attach one wire pair of p2 to uc1,
and the other to uc2.

Now the first thing that comes to mind is how I'd deal with
colissions, but I don't think this is of concern if I use Full Duplex
mode.

Is this go-er, do you think?
> Is this go-er, do you think?
Ah crap I just realised I'd have no way of replying to ARP requests for the router ports. How else could I go about operating two separate ethernet ports?
Tom&#4294967295;s &#4294967295; h&#4294967295;ilidhe <toe@lavabit.com> writes:

> So far I'm thinking of going with the MCF5223X. I'll have to find out > if I can get a handy little kit for programming it that will connect > to my PC via USB.
There are a couple MCF5223X kits available from Freescale. They cost $100 and $300 if I remember correctly. They both come with a USB base programming solution. http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=M52233DEMO&parentCode=MCF5223X&fpsp=1&nodeId=0162468rH3YTLC00M95448 http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=M52235EVB&parentCode=MCF5223X&fpsp=1&nodeId=0162468rH3YTLC00M95448 Most developers use CodeWarrior, but I've been using the GNU tools under Linux distributed by Codesourcery: http://www.codesourcery.com/gnu_toolchains/coldfire/download.html Petter -- A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? A: Top-posting. Q: What is the most annoying thing on usenet and in e-mail?
On May 3, 6:22=A0am, Tom=E1s =D3 h=C9ilidhe <t...@lavabit.com> wrote:
> I definitely want to go with the built-in Ethernet! > > I was thinking to myself that it would be cool get a chip that can do > gigabit, but I've been googling and I haven't found one.
There's no point at all for most of these chips to support Gb-E, since there's no possible way they could come anywhere remotely close to driving that kind of bandwidth. And since your typical switch will happily connect to any of those, it make no difference there either. But if you can't find a controller with two built in ports, you'll want to pick a controller that makes it easy to add an external controller (up thread I mentioned a SPI Ethernet chip from Microchip which you can add to any PIC with an SPI port). You don't really want to have two separate controllers, since that just adds the issue of how the two chips then exchange information (like the packets you're hoping to forward). Anyway, you'll probably want to start by supporting static routes only (which is trivial to program), just blindly forwarding packets is going to make a mess. But if I may suggest - get yourself and old PC, and a couple of simple to program Ethernet cards (NE2000 compatibles are very simple), and then write your router software to run under DOS. If you get a motherboard with actual ISA slots, you can even avoid the minor issue of having to track down the PCI address assignments. Your development and testing environment will be much better, and certainly a lot more understood and well documented. Although you might have to get a floppy drive for your development PC.