Hello,
Regarding the Keil documentation, for changing the MAC address we can use the netIF_SetOption function. I configured my STM MCU network like this:
uint8_t mac_addr[NET_ADDR_ETH_LEN]; netInitialize (); //Set New mac_addr value netIF_SetOption (NET_IF_CLASS_ETH | 0, netIF_OptionMAC_Address, mac_addr, sizeof (mac_addr));
It successfully changed my Mac address but in Wireshark, I saw that it created a duplicate IP address device ( one with the old Mac address "1E-30-6C-A2-45-5F" and the new one with the new Mac address "6a:ad:d5:59:52:19")
I need to know how I can change the MAC address while the old value is being removed(prevent from a duplicate IP)
I appreciate your help.
Dear Franc Urbanc ,
I really appreciate your response and your explanations.
Sorry for the late in my response due to I was checking your explanation in different conditions. Actually, our device works excellent in sending the data to a PC but it has problem with connecting to another embedded board( our device can send the UDP data but it doesn't respond to any ping command when we connected it to an embedded board).
I am still waiting for getting a managed router to see the network problem and continue this question.
I am thankful for your help.
When a device has already communicated with another evaluation board, the MAC addresses are cached on both ends. If you change the MAC address but not the IP address, the second evaluation board still caches the old MAC address. The default ARP cache timeout is 150 seconds. This means you need to clear the ARP cache (netARP_ClearCache) on the evaluation board or wait for the entry to time out.
Changing the default MAC address is usually at device startup, but not while the device is running, as it may cause communication issues.
Dear Franc,
I really appreciate it. Excellent Point.