Go Down

Topic: Ethernet ENC28J60 MAC Address & IP (Read 3288 times) previous topic - next topic

moataz

Jun 06, 2013, 10:24 am Last Edit: Jun 06, 2013, 10:27 am by moataz Reason: 1
please anyone can help me to find out the mac address for my ethernet enc28j6o or how to find it and its IP address ??

and how can i use it for make a hello world page ??

thanks in advance.

pylon

You have to specify the MAC address in your sketch, the module doesn't have a fixed one. The IP address is either also fixed in the sketch or provided by a DHCP server on your network (usually in the router).

Quote
and how can i use it for make a hello world page ??


By using any of the available libraries for this chip and use the provided examples.

Erdin

#2
Jun 06, 2013, 11:53 am Last Edit: Jun 06, 2013, 09:33 pm by Erdin Reason: 1
I suggest the Ethercard library, https://github.com/jcw/ethercard

The rbbb server is a webserver, https://github.com/jcw/ethercard/blob/master/examples/rbbb_server/rbbb_server.ino

You can set the IP yourself (static IP), but the Ethercard library has also DHCP (to let the router give the IP for the Arduino board).

Guess what ? The ENC28J60 does not have a mac, you set the mac yourself.

moataz

thanks a lot appreciate these answers a lot  :)

But how to specify the MAC address in the sketch ??

and how enable the router to make an IP address for my arduino ?

Erdin

If you look at the "rbbb_server.ino" file in the link in my previous post, you see that the mac (variable 'mymac') is set to a certain value. You can use any value you like.

Almost every router will be a DHCP server, to assign new IP address to devices that request it. You don't have to do something, it should be enabled in the default settings.

In Windows you can set the ip to a static value (somewhere in the network settings for IPv4) but it is almost always set to 'automatic'. That is DHCP. So you use DHCP every time you turn on the PC.

This example of the Ethercard library,
https://github.com/jcw/ethercard/blob/master/examples/testDHCP/testDHCP.ino
shows how to get an IP from the router.
The sketch prints its own IP (it was given by the router DHCP service) to the serial monitor.

I combined both example sketches (some time ago) for a webserver with DHCP and it works.

moataz

thanks a lot for your post :) , but i tried https://github.com/jcw/ethercard/blob/master/examples/testDHCP/testDHCP.ino

and that what appeared in the attachment
what is the problem ??



Go Up