2019-05-10 07:36 AM
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...
2019-05-11 03:48 PM
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
2019-08-15 12:06 AM
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.