8 years, 10 months ago.

Change MAC address ?

Hi all, I came across a very strange problem. We got some FRDM-K64F boards, and surprisingly 2 of them got the same Mac address. I need to ask is there any way to change the mac address of the device??

1 Answer

8 years, 10 months ago.

This is the mbed mac address code which I think/assume the K64F also uses: https://github.com/mbedmicro/mbed/blob/master/libraries/mbed/common/mbed_interface.c. If that is te mac address they get you can use the WEAK function to give them another one (maybe the K64F has onboard a unique ID you can use for it). If you get another one it will be defined somewhere else in the ethernet code.

I dont think so they are using this function to generate the MAC address. I tried to change this function to assign my own mac, but nothing is going to change

posted by zain aftab 15 Jun 2015

So which mac address do you have now?

posted by Erik - 15 Jun 2015

the one which comes with the board, actually we can generate mac address from two methods. One is via the etherenet library and one which comes default with the board for example

EthertnetInterface eth
 extern "C" void mbed_mac_address(char * mac);
int main()
{
printf("Print MAC %s \n",eth.getMACaddress);
 char macc[6];
 mbed_mac_address(macc);
 sprintf(id,"%02X:%02X:%02X:%02X:%02X:%02X",macc[0],macc[1],macc[2],macc[3],macc[4],macc[5]); 

}

the one we get using the eth.getmac address can be somehow change using the ethernet but I am not able to change the default mac address which we get using the weak function " void mbed_mac_address(char * mac);" I need to find the way to change it using the weak function

posted by zain aftab 17 Jun 2015

Yes but what is the default one which comes with the board. If it is the same one as the one from the weak function, it is most likely defined by that function. If it is a different one, it is not from that weak function.

posted by Erik - 17 Jun 2015

Both of them are same and I want to change the weak function one, the reason is that, it looks like the ehternet library also try to retrieve it from weak function

posted by zain aftab 17 Jun 2015