Ethernet: How/where to start? (Microchip)

Hi all,

I want to be able to use Ethernet in my projects but I'm so overwhelmed by its complexity that I don't know where to go. I've read and watch most of the information at microchip.com. I'm aware of the new PICs that have a MAC built-in and the ENC28J60. I'm also aware of the TCP/IP stack and the rest of the ... stuff (DHCP, ARP, etc.). The reason I say "I'm aware" is because I don't really understand the details of each. I'm aware of the TCP and IP packets. But I don't understand how to use them to connect a PIC from a PC running a custom application. I've seen their demos on the vending machine , Ethernet radio, etc. But I didn't see a demo on a custom application like they have for USB. I do want to be able to make the PC application as well. I have Visual Studio 2005. I'm not thinking that this is going to be quick and easy in fact I think it is going to be painfully slow, which I don't mind as long as I learn the stuff. I don't have a project right now that requires it so I have all the time in the world.

I'm looking for info that would tie all the info together. Like...

How does the PC application find the PIC? How can I TX data from the PIC to the PC? Will DHCP take care of all "handshake" (for lack of a better word) ? if so how does the PIC know where to send the data? etc, etc, etc.

Any books, web sites that can tie all that info would be great.

Thanks a bunch

Reply to
Rodo
Loading thread data ...

y

AC

t

se

P
C

e ,

l.

k

to

) ?

My suggestion is to take using Ethernet is small steps. For get about TCP/IP and concentrate on something simple like just getting/sending Ethernet frames. Work up to using IP using Ping (use fixed IP addresses). Start adding/testing other protocols after that. A good book is TCP/IP Illustrated Volume 1. It doesn't cover Ethernet but it does cover a lot of the important protocols from IP on up.

Reply to
GaryKato

Don't get overwhelmed. It is not that difficult. First thing, you have to come out of the 'microcontroller' mindset of doing everything (all coding) yourself. You do not need to know any of the TCP/IP internals to make this project going. This project is more about integration difficulties. That assured let's see what we can do about your situation !

Do you have hardware ready? If not, that is a different project on its own !

First thing you need to use an operating system. Even if is as simple as FreeRTOS or full blown like Linux. This is essential because the TCP/IP stacks need to work in a separate thread of their own. Hence normally you will get TCP/IP stacks made for particular OSes. See:

formatting link
For more examples:
formatting link

Second thing, you need to know a little about the Ethernet hardware. No need to worry about TCP/IP issues here. Again you will most probably get a ready made driver for you Ethernet chip which you will need to integrate into your OS.

Once you are done with this that's all on the kernel side. You need to do some trivial configurations of your own IP address, subnet mask, gateway address, etc. Thats all ... You have for yourself a LAN enabled board.

No need to write any application for now. All TCP/IP stacks support ICMP. So you can ping the board from your PC. No application need to be created on the PC as yet. Once this task is over you can then learn some socket programming. That's 100 times simpler than above. You do not need to think anything about routing, packet fragmentation, flow control, ARP, DHCP... that magic is the prerogative of the TCP/IP stack.

-Kaustubh

Reply to
ksashtekar

Try "Networking and Internetworking with Microcontrollers" by Fred Eady. The first half of the book covers async serial and I2C; the latter half builds example code to get ARP, UDP, and TCP up and running over IP.

--
Rich Webb     Norfolk, VA
Reply to
Rich Webb

You can avoid most of Ethernet and TCP/IP, if such is your taste, by using chips like the W5100 or W5300 from Wiznet . These effectively package 4 IP sockets into hardware, controllable through an SPI or a memory interface.

Mel.

Reply to
Mel

There was somebody on the FreeRTOS.org forum just today talking about getting lwIP running on a PIC32 - maybe you could try contacting them?

formatting link

uIP is a nice small and easy place to start, but its interface is a bit non-standard.

Regards, Richard.

  • formatting link
    &
    formatting link
17 official architecture ports, more than 6000 downloads per month.

  • formatting link
    Certified by TÜV as meeting the requirements for safety related systems.

Reply to
FreeRTOS.org

Only part of it. DHCP is a way for your device to be assigned an IP address, and told what its default gateway and DNS servers should be.

In the simplest case, the DHCP server simply assigns an IP address out of a pool. For example, if you have a typical SOHO router/gateway product, that's how they are configured by default. Your device will get an IP address, but your PC won't really know how to find it.

On the other hand, it's possible to configure a DHCP server (usually running on a PC rather than a SOHO router/gateway) to give a specific IP address to your device based on recognizing the Ethernet MAC address of the device. If you do that, software running on the PC can more easily find your device to communicate with it (if the PC is going to initiate the communication).

If the PIC is going to initiate the communication, it probably needs to be configured somehow to know a host name or IP address it is intended to communicate with. It is also possible for a device to get its configuration information through DHCP/BOOTP, but as stated above, this requires the DHCP server to be configured specifically for the device.

There are also fancier discovery mechanism such as UPnP, but they are quite complex.

The "Internetworking with TCP/IP" series by Comer are excellent for the IP layer and up.

Reply to
Eric Smith

dress,

,

DHCP can also be used to provide a name for the device. Most (?) low-end routers include a DNS server, so the device can immediately be accessed by name. That's how I access the devices in my office LAN - no need for hardwired IP addresses ! This is an option in both DHCP and the router, so not *always* available...

Hope that helps, Best Regards, Dave

Reply to
drn

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.