Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
9 years, 8 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
9 years, 8 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 15 Jun 2015the 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 17 Jun 2015