@@ -458,7 +458,40 @@ https://github.com/ARMmbed/mbed-os/blob/master/connectivity/drivers/emac/TARGET_
458
458
Option is also to define your own ` HAL_ETH_MspInit ` function,
459
459
you then have to add ** USE_USER_DEFINED_HAL_ETH_MSPINIT** macro.
460
460
461
+ To change the default MAC address in STM32,
462
+ If we have the function mbed_otp_mac_address() in the user application,the default ethernet address
463
+ can be changed.
464
+ Because as this is defined as weak in mbed-os/connectivity/drivers/emac/TARGET_STM/stm32xx_emac.cpp
465
+ ```
466
+ #include "platform/mbed_toolchain.h"
467
+ MBED_WEAK uint8_t mbed_otp_mac_address(char *mac).
468
+ ```
469
+
470
+ Please find the code snippet here for reference:
461
471
472
+ ```
473
+ ..
474
+ uint8_t mbed_otp_mac_address(char *mac);
475
+ uint8_t mbed_otp_mac_address(char *mac)
476
+ {
477
+ unsigned char ST_mac_addr[6] = {0x00, 0x88, 0xe0,0x90,0x80,0x70}; // New User mac address
478
+ // printf("%s:%s\n",__FILE__,__func__);
479
+ memcpy(mac,ST_mac_addr,sizeof(ST_mac_addr));
480
+ return 1;
481
+ }
482
+
483
+ int main()
484
+ {
485
+ // Bring up the ethernet interface
486
+ printf("Ethernet socket example\n");
487
+ uint8_t MyMAC[6];
488
+ printf("return of set_mac_address:%d\n",net.set_mac_address(MyMAC,sizeof(MyMAC)));
489
+
490
+ net.connect();
491
+ printf("MAC address %s\n",net.get_mac_address());
492
+ ...
493
+
494
+ ```
462
495
### Asynchronous SPI limitation
463
496
464
497
The current Asynchronous SPI implementation will not be able to support high speeds (MHz Range).
0 commit comments