Merge pull request #14838 from katherrafi/set_mac_address

Eth: STM32:  Updating documentation on mbed_otp_mac_address()
pull/14897/head
Martin Kojtal 2021-07-08 14:20:09 +02:00 committed by GitHub
commit 97b9754141
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 2 deletions

View File

@ -136,7 +136,7 @@ static ETH_TxPacketConfig TxConfig;
#endif // ETH_IP_VERSION_V2 #endif // ETH_IP_VERSION_V2
__weak uint8_t mbed_otp_mac_address(char *mac); MBED_WEAK uint8_t mbed_otp_mac_address(char *mac);
void mbed_default_mac_address(char *mac); void mbed_default_mac_address(char *mac);
#ifdef __cplusplus #ifdef __cplusplus
@ -852,7 +852,7 @@ void mbed_mac_address(char *mac)
return; return;
} }
__weak uint8_t mbed_otp_mac_address(char *mac) MBED_WEAK uint8_t mbed_otp_mac_address(char *mac)
{ {
return 0; return 0;
} }

View File

@ -458,7 +458,40 @@ https://github.com/ARMmbed/mbed-os/blob/master/connectivity/drivers/emac/TARGET_
Option is also to define your own `HAL_ETH_MspInit` function, Option is also to define your own `HAL_ETH_MspInit` function,
you then have to add **USE_USER_DEFINED_HAL_ETH_MSPINIT** macro. you then have to add **USE_USER_DEFINED_HAL_ETH_MSPINIT** macro.
To change the default MAC address in STM32,
If we have the function mbed_otp_mac_address() in the user application,the default ethernet address
can be changed.
Because as this is defined as weak in mbed-os/connectivity/drivers/emac/TARGET_STM/stm32xx_emac.cpp
```
#include "platform/mbed_toolchain.h"
MBED_WEAK uint8_t mbed_otp_mac_address(char *mac).
```
Please find the code snippet here for reference:
```
..
uint8_t mbed_otp_mac_address(char *mac);
uint8_t mbed_otp_mac_address(char *mac)
{
unsigned char ST_mac_addr[6] = {0x00, 0x88, 0xe0,0x90,0x80,0x70}; // New User mac address
// printf("%s:%s\n",__FILE__,__func__);
memcpy(mac,ST_mac_addr,sizeof(ST_mac_addr));
return 1;
}
int main()
{
// Bring up the ethernet interface
printf("Ethernet socket example\n");
uint8_t MyMAC[6];
printf("return of set_mac_address:%d\n",net.set_mac_address(MyMAC,sizeof(MyMAC)));
net.connect();
printf("MAC address %s\n",net.get_mac_address());
...
```
### Asynchronous SPI limitation ### Asynchronous SPI limitation
The current Asynchronous SPI implementation will not be able to support high speeds (MHz Range). The current Asynchronous SPI implementation will not be able to support high speeds (MHz Range).