diff --git a/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_MCU_K64F/TARGET_FRDM/mbed_overrides.c b/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_MCU_K64F/TARGET_FRDM/mbed_overrides.c index e04dd08d53..a0c8838315 100644 --- a/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_MCU_K64F/TARGET_FRDM/mbed_overrides.c +++ b/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_MCU_K64F/TARGET_FRDM/mbed_overrides.c @@ -34,6 +34,7 @@ void NMI_Handler(void) // Provide ethernet devices with a semi-unique MAC address from the UUID void mbed_mac_address(char *mac) { + // Making a random-as-possible MAC from 3 16 bit seeds and load of XOR'ing uint16_t MAC[3]; // 3 16 bits words for the MAC uint32_t UUID_LOC_BASE = 0x40048054; @@ -50,20 +51,22 @@ void mbed_mac_address(char *mac) } } + + mac[0] = MAC[2] >> 8; + mac[1] = MAC[2]; + mac[2] = MAC[1] >> 8; + mac[3] = MAC[1]; + mac[4] = MAC[0] >> 8; + mac[5] = MAC[0]; + // we only want bottom 16 bits of word1 (MAC bits 32-47) // and bit 9 forced to 1, bit 8 forced to 0 // Locally administered MAC, reduced conflicts // http://en.wikipedia.org/wiki/MAC_address // uint32_t word1 = *(uint32_t *)UUID_LOC_WORD1; - MAC[2] |= 0x0002; - MAC[2] &= 0xFFFE; - - mac[0] = MAC[0]; - mac[1] = MAC[0] >> 8; - mac[2] = MAC[1]; - mac[3] = MAC[1] >> 8; - mac[4] = MAC[2]; - mac[5] = MAC[2] >> 8; + + mac[0] |= 0x02; + mac[0] &= 0xFE; }