Skip to content

Commit c58631b

Browse files
committed
[NUC472] Adjust locally administered MAC address
1 parent fa0f928 commit c58631b

File tree

1 file changed

+4
-2
lines changed
  • features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_NUVOTON/TARGET_NUC472

1 file changed

+4
-2
lines changed

features/FEATURE_LWIP/lwip-interface/lwip-eth/arch/TARGET_NUVOTON/TARGET_NUC472/nuc472_netif.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ struct ethernetif {
100100
// Override mbed_mac_address of mbed_interface.c to provide ethernet devices with a semi-unique MAC address
101101
void mbed_mac_address(char *mac)
102102
{
103+
uint32_t uID1;
103104
// Fetch word 0
104105
uint32_t word0 = *(uint32_t *)0x7F804; // 2KB Data Flash at 0x7F800
105106
// Fetch word 1
@@ -116,8 +117,9 @@ void mbed_mac_address(char *mac)
116117
SYS_UnlockReg();
117118
FMC_Open();
118119
// = FMC_ReadUID(0);
119-
word1 = FMC_ReadUID(1) >> 8;
120-
word0 = ((FMC_ReadUID(0) >> 4) << 20) | (FMC_ReadUID(2) & 0xFFFFF);
120+
uID1 = FMC_ReadUID(1);
121+
word1 = (uID1 & 0x003FFFFF) | ((uID1 & 0x030000) << 6) >> 8;
122+
word0 = ((FMC_ReadUID(0) >> 4) << 20) | ((uID1 & 0xFF)<<12) | (FMC_ReadUID(2) & 0xFFF);
121123
/* Disable FMC ISP function */
122124
FMC_Close();
123125
/* Lock protected registers */

0 commit comments

Comments
 (0)