Fixed bug that EthernetInterface doesn't detect change of connection status on ARCH_MAX board.

ARCH_MAX board uses 0x01 as PHY address, different from other NUCLEO STM32 boards. To faciliate change of PHY address of customized boards, a configuration entry eth-phyaddr was added and can be overriden as needed in mbed_app.json by adding "stm32-emac.eth-phyaddr": X. Macro ETH_ARCH_PHY_ADDRESS was also renamed to ETH_PHY_ADDRESS, because it is not only used by ARCH_MAX board but also other boards.
pull/12405/head
Zhiyonh Li 2020-02-10 17:56:09 -08:00
parent 8c51f4f163
commit 884f9c99e3
2 changed files with 4 additions and 3 deletions

View File

@ -2,7 +2,8 @@
"name": "stm32-emac",
"config": {
"eth-rxbufnb": 4,
"eth-txbufnb": 4
"eth-txbufnb": 4,
"eth-phyaddr": 0
},
"target_overrides": {
"NUCLEO_F207ZG": {

View File

@ -43,7 +43,7 @@
#define THREAD_PRIORITY (osPriorityHigh)
#define PHY_TASK_PERIOD_MS 200
#define ETH_ARCH_PHY_ADDRESS (0x00)
#define ETH_PHY_ADDRESS MBED_CONF_STM32_EMAC_ETH_PHYADDR
#define STM_HWADDR_SIZE (6)
#define STM_ETH_MTU_SIZE 1500
@ -282,7 +282,7 @@ bool STM32_EMAC::low_level_init_successful()
EthHandle.Init.AutoNegotiation = ETH_AUTONEGOTIATION_ENABLE;
EthHandle.Init.Speed = ETH_SPEED_100M;
EthHandle.Init.DuplexMode = ETH_MODE_FULLDUPLEX;
EthHandle.Init.PhyAddress = ETH_ARCH_PHY_ADDRESS;
EthHandle.Init.PhyAddress = ETH_PHY_ADDRESS;
#if (MBED_MAC_ADDRESS_SUM != MBED_MAC_ADDR_INTERFACE)
MACAddr[0] = MBED_MAC_ADDR_0;
MACAddr[1] = MBED_MAC_ADDR_1;