ESP32-ENC28J60 icon indicating copy to clipboard operation
ESP32-ENC28J60 copied to clipboard

How to configure the mac address manualy ?

Open Hedmilson opened this issue 2 years ago • 3 comments

I need to assign a new MAC number (not default) . tanks

Hedmilson avatar Sep 05 '23 14:09 Hedmilson

hi,

there's a method for that:

ETH.macAddress(uint8_t* mac);

tobozo avatar Sep 05 '23 15:09 tobozo

Thanks for replying, but this method is not working as expected.

How to declare the new mac? ex: mac[] = {0x55,0x34...... and how to call the ETH.macAddress method. Before or after ETH.config ? Thanks again..

Hedmilson avatar Sep 05 '23 20:09 Hedmilson

Thanks for replying, but this method is not working as expected.

"not working" is a very general term and I'm not very good at guessing, does it fail to compile? does it crash? is your custom mac address ignored?

How to declare the new mac?

according to espressif documentation you can declare your ethernet mac as follows:

uint8_t my_eth_mac_address[6] = {0x11, 0x22, 0x33, 0x44, 0x55, 0x66};
ETH.macAddress( my_eth_mac_address );

But I never tested that since this driver is just a quick and dirty proof of concept.

Chances are it's not completely implemented and would inherit from a hardcoded Mac Address instead.

You may have to edit the cpp file in the library folder and hardcode your mac address there.

tobozo avatar Sep 06 '23 12:09 tobozo