Make Ethernet Shield report its MAC

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

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.

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?

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.

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

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:

 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

EthernetServer server(8248);

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

 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

SurferTim:
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.
Can SD Card be used to store ip address/MAC configs? - #22 by SurferTim - Networking, Protocols, and Devices - Arduino Forum

Try this. Declare the server globally, then reassign the port in setup. It worked for me.

// global declaration on port 80
EthernetServer server(80);

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

Thanks.
I'll try it.

Tim:

That worked.
Thanks !