Critical phy issue


I am facing a very critical issue using the W7500P:

I have several W7500P units and most of them work fine, but ~20% of the units cannot establish link. (Phy link status always return 0).

I have created a very simple code that allows the issue to be reproduced (In units that are ok, it prints “1” and in the others, it prints “0”:

#include "mbed.h"
#include "W7500x_toe.h"
#include "w7500x_gpio.h"
#include "w7500x_wztoe.h"
#define MDIO    		GPIO_Pin_15
#define MDC     		GPIO_Pin_14
#define GPIO_MDC        GPIOB
#define PHY_ADDR_IP101G 0x01 
#define PHY_ADDR 		PHY_ADDR_IP101G
#define SVAL 			0x2 //right shift val = 2 
#define PHYREG_CONTROL  0x0 //Control Register address (Contorl basic register)
#define PHYREG_STATUS   0x1 //Status Register address (Status basic register)

Serial pc(PC_10, PC_11);

int main() {	
	pc.printf("\r\nPHY Debug\r\n");
	wait_ms(10);//for S/W reset
	wait_ms(10);//for MDC I/F RDY

	mdio_init(GPIO_MDC, MDC, MDIO);
	mdio_write(GPIO_MDC, PHYREG_CONTROL, 0x8000);
		wait_ms(500);//for S/W reset
		pc.printf("%d\r\n",(mdio_read(GPIO_MDC, PHYREG_STATUS)>>SVAL)&0x01);

Can someone please assist me? Is it a MCU issue? Am I doing something wrong?

Additional note: I have downloaded the IP101G datasheet and I developed this code based on it.

Adding more info:
I have performed more tests using 5 different boards (3 have worked fine and 2 have presented the issue) and I notice that the label in the W7500P component is almost erased in the ones with the issue.

We have switched the W7500P of 2 boards (One with the issue and one working fine) and the issue changed from one board to the other, which means the problem is in the W7500P and not in the boards.

I really need assistance from Wiznet! Can you please assist me?


I am sorry for sending one more message, but we are facing this issue with several W7500P units. Can you please help me?

I noticed it is an intermittent problem in some W7500P units. Can you please detail what are the W7500 pins that are connected to the phy and how we should set their pad control registers?

I have been able to find the issue and to solve it.

For those facing the same issue: LED1 and LED2 of the W7500P phy are floating when the MCU is turned on, which means they can assume any value and they are responsible for defining the PHY address. Based on that, it is necessary to test the odd phy addresses between 1 and 7 every time you start the MCU.

Notice that, some examples from Wiznet does solve this issue inside the function phy_id (I believe a separate function would be more adequate), but the mbed libraries from Wiznet (WIZnetInterface or WIZnetInterface-OS5) does not implement the correction.