Pages: [1]   Go Down
Author Topic: Make Ethernet Shield report its MAC  (Read 1001 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 48
Bald-Headed, Middle-Aged Nerd
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Is there a way to make my Ethernet Shield report what MAC address has been assigned to it ?

I'm giving it its MAC address from a text file on an SD card, and I'd like to give myself some feedback so that I know the proper MAC was installed.

Thanks.

Bob W
Logged

Miramar Beach, Florida
Offline Offline
Faraday Member
**
Karma: 144
Posts: 5974
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It appears the w5100 code has a function to return the mac address, but it is not used by the Arduino ethernet library. So without modifying the library, no (or not easily).

If you have access to the router it is connected to, you should be able to check the ARP table and see what mac it is using.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 48
Bald-Headed, Middle-Aged Nerd
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

My Linksys E4200 shows me the dynamically assigned IP addresses, but I don't see where static IP addresses are displayed.  Do all routers show the ARP table?
Logged

Miramar Beach, Florida
Offline Offline
Faraday Member
**
Karma: 144
Posts: 5974
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

All routers I have show all devices they have dealt with in the arp table. Localnet traffic may not go through the router, so if the device never contacts the router with an WAN (non-localnet) request, it is possible the device mac address may not end up in the arp table. I have the ability to ping from my router. That almost guarantees an entry in the arp table.

What is your concern about the mac address? If you want to know if it is assigning the correct mac address from the SD, then Serial.print() the mac address when you get it from the SD card before assigning it to the w5100.

edit: If you use dhcp to get an ip, you should be able to find the mac address in the dhcp lease records in the router.

Here is a post that shows my code for using the SD card to store network settings.
http://arduino.cc/forum/index.php/topic,128763.msg976118.html#msg976118
« Last Edit: March 08, 2013, 06:01:14 am by SurferTim » Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 48
Bald-Headed, Middle-Aged Nerd
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks Tim.  And thanks for sharing your code.
I don't have a "concern".
I'm just doing what I call "expanding my brain" - i.e. trying to learn something new.
I'm good to go.
Thanks again.

Bob
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 48
Bald-Headed, Middle-Aged Nerd
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

SurferTim:

Re your sketch for loading MAC etc from SD card.

I am also trying to load the server port from the card.
I am able to retrieve this datum from the card with code similar to yours in the setup() module.

BUT - the line:

Code:
EthernetServer server(port number); 

seems to need to be at the top of the sketch, BEEORE the port number has been retrieved.


When I put the line

Code:
EthernetServer server(8248);

at the end of setup(), I (naturally) get the error " 'server' was not declared in this scope" at the line   

Code:
client = server.available();

in loop().

I don't see a way to make the variable "client" be global from within the setup() module.

Do you see a workaround for this ?

Am I supposed to be declaring "client" in the loop?
That instruction will be repeating with every loop cycle then.
Is that OK ?

Bob






All routers I have show all devices they have dealt with in the arp table. Localnet traffic may not go through the router, so if the device never contacts the router with an WAN (non-localnet) request, it is possible the device mac address may not end up in the arp table. I have the ability to ping from my router. That almost guarantees an entry in the arp table.

What is your concern about the mac address? If you want to know if it is assigning the correct mac address from the SD, then Serial.print() the mac address when you get it from the SD card before assigning it to the w5100.

edit: If you use dhcp to get an ip, you should be able to find the mac address in the dhcp lease records in the router.

Here is a post that shows my code for using the SD card to store network settings.
http://arduino.cc/forum/index.php/topic,128763.msg976118.html#msg976118

Logged

Miramar Beach, Florida
Offline Offline
Faraday Member
**
Karma: 144
Posts: 5974
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Try this. Declare the server globally, then reassign the port in setup. It worked for me.
Code:
// global declaration on port 80
EthernetServer server(80);

// then in setup() change to 8081
int serverPort = 8081;
server = EthernetServer(serverPort);
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 48
Bald-Headed, Middle-Aged Nerd
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks.
I'll try it.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 48
Bald-Headed, Middle-Aged Nerd
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Tim:

That worked.
Thanks !
Logged

Pages: [1]   Go Up
Jump to: