Skip to main content
Mahendra Sondagar
Associate III
May 10, 2019
Question

HAL_ETH_ReadPHYRegister always returns HAL_TIMEOUT

  • May 10, 2019
  • 2 replies
  • 1619 views

Hello there....

On one of my product has LAN8742A phy ic for the Ethernet. for me everything is working great. in-fact i can create TCP server and client application with FreeRTOS

Now the problem is, i just need to check the link status by reading the PHY register that is PHY_BSR .

I have made the function to get the Eth link status as follow

if((HAL_ETH_ReadPHYRegister(&VapEth, PHY_BCR, &phyreg)) == HAL_OK){
	if((phyreg & PHY_LINKED_STATUS)==0){
		/* Return Link Down status */
		printf("LAN8742_STATUS_LINK_DOWN");
	}
	if((phyreg & PHY_LINKED_STATUS)==1){
		/* Return Link Up status */
		printf("LAN8742_STATUS_LINK_UP");
	}
 }

Now the problem is HAL_ETH_ReadPHYRegister always returns HAL_TIMEOUT!

I need some help from the community

Thanks...

    This topic has been closed for replies.

    2 replies

    u_2man
    Associate II
    May 11, 2019

    Hi...

    Last time also I have project with LAN8742...my problem maybe different, because TCP function can not work...

    after some trial and error, I finally solve the problem by control the ETH_NRST with GPIO, not linked together with MCU reset..

    Maybe you can try with my solution...

    Thanks

    MTeun
    Associate
    August 15, 2019

    A HAL_TIMEOUT is caused most likely to some missing clocks. Check the call made to HAL_ETH_Init from the low_level_init function in ethernetif.c.

    This probably already returns a HAL_TIMEOUT during SWR.

    ​

    Also, you are reading the wrong register, you should read the PHY_BSR (status register), not PHY_BCR (control register).

    Good luck.