cancel
Showing results for 
Search instead for 
Did you mean: 

How to detect STM32H573I-DK link status by HAL_ETH_ReadPHYRegister?

EyckHuang
Associate II

Hi supporter,

I'm developing STM32H573I-DK and trying HAL_ETH_ReadPHYRegister to check link status. But this API seems be changed.

Previous prototype is:

HAL_StatusTypeDef HAL_ETH_ReadPHYRegister(ETH_HandleTypeDef *heth, uint16_t PHYReg, uint32_t *RegValue)

But now is:

HAL_StatusTypeDef HAL_ETH_ReadPHYRegister(ETH_HandleTypeDef *heth, uint32_t PHYAddr, uint32_t PHYReg,uint32_t *pRegValue)

I have no idea what PHYAddr is. And PHY_BSR is also not defined in STM32H5. So, I don't know how to fill PHYReg

Is there any example? 

I've referenced to GitHub - STMicroelectronics/STM32CubeH5.

But there are no examples about this API. Thanks for your help.

1 ACCEPTED SOLUTION

Accepted Solutions
EyckHuang
Associate II

Hi all,

I found that the Ethernet chip on STM32H573I-DK is LAN8742A. So, I referenced document and understood the registers map. 

 

HAL_ETH_ReadPHYRegister(&heth, 0, 1, &tempReg)

 

where 1 is Basic Status Register and Bit 3 is Link Status. 

But I don't know why PHYAddr is 0.

 

 

Hope this can help others.

 

 

View solution in original post

2 REPLIES 2
EyckHuang
Associate II

Hi all,

I found that the Ethernet chip on STM32H573I-DK is LAN8742A. So, I referenced document and understood the registers map. 

 

HAL_ETH_ReadPHYRegister(&heth, 0, 1, &tempReg)

 

where 1 is Basic Status Register and Bit 3 is Link Status. 

But I don't know why PHYAddr is 0.

 

 

Hope this can help others.

 

 

Pavel A.
Evangelist III

But I don't know why PHYAddr is 0.

IIRC the "PHY address" is documented in the PHY chip datasheet. Otherwise you can scan all 32 addresses and find who responds.