Detect Ethernet connection fails

取消
显示结果 
搜索替代 
您的意思是: 
已解决

Detect Ethernet connection fails

跳至解决方案
1,041 次查看
kappa74
Contributor IV

Good morning,

I use K60 with MQX4.1 and KDS2.0 and I have a problem with detecting Ethernet link. I have the layer KSZ8721BL and the communication works fine only with the MQX lybraries phy_83xxx.c.

But the function "static boolean phy_dp83xxx_get_link_status" doesn't work properly: I have always connection actived even if the Ethernet cable is disconnected.

Why?

Do you have any suggest?

Thank you

Best Regards

Mirko

标签 (1)
0 项奖励
1 解答
601 次查看
DavidS
NXP Employee
NXP Employee

Hi Mirko,

Have you successfully been able to read the PHY so you know you have the correct PHY Address?

Regards,

David

在原帖中查看解决方案

0 项奖励
8 回复数
602 次查看
DavidS
NXP Employee
NXP Employee

Hi Mirko,

Have you successfully been able to read the PHY so you know you have the correct PHY Address?

Regards,

David

0 项奖励
601 次查看
kappa74
Contributor IV

Hi David,

I read the first three registers but all their values was 0xFF.

There is something of strange.

0 项奖励
601 次查看
tsi-chung_liew
NXP Employee
NXP Employee

Mirko,

You need to use ksz8041 instead of dp83xxx, ksz8041 and KSZ8721BL are the same manufacturer - Micrel. Some registers may shared the same features. Also, make sure you have pull up on MDIO - either by external (resistor) or internal (GPIO setting).

Regards,

TsiChung

0 项奖励
601 次查看
DavidS
NXP Employee
NXP Employee

Good information Tsi-Chung.

Also once ksz code implemented ...

rtcs.c in the web_hvac example in the MQX_4.1.1/demos folder you can test following on twr-k60d100m tower kit:

    ip_data.ip = ENET_IPADDR;

    ip_data.mask = ENET_IPMASK;

    ip_data.gateway = ENET_IPGATEWAY;

   

    ENET_get_mac_address (DEMOCFG_DEFAULT_DEVICE, ENET_IPADDR, enet_address);

    error = ipcfg_init_device (DEMOCFG_DEFAULT_DEVICE, enet_address);

//New code to test Ethernet cable connection.

{

  int tries = 10;

  bool found = false;

  // Ethernet is device 0.  Check for ethernet cable

  while(tries-- && !found)

  {

  if(ipcfg_get_link_active(BSP_DEFAULT_ENET_DEVICE)) found = true;

  else _time_delay(400);

  }

  if(!found)

  {

  printf("No Ethernet cable found.\n");

  }

}

{
printf("No Ethernet cable found.\n");
}

}

Sorry...cut-n-paste messed up the "{}" but you get the idea.

Regards,

David

0 项奖励
601 次查看
kappa74
Contributor IV

Good morning,

- I tried the ksz8041 but the problem is not solved

- it is present an external pullup of 4.7kohm on MDIO

- I tried the function of David but I don't solve the problem

The ping function from DOS shell is working well.

I noted that reading the first three registers of the Ethernet driver, I always read the value 0xFF: this is very strange.

Regards

0 项奖励
601 次查看
DavidS
NXP Employee
NXP Employee

Hi Mirko,

I think you need to look at your hardware configuration (schematics) to determine why you are not able to read PHY registers.

Regards,

David

0 项奖励
601 次查看
kappa74
Contributor IV

Hi all,

the problem is not right setting of the PHY address with pull-up and pull-down in my hardware. After correcting this the detecting of the link is working well.

Thanks to all.

Best Regards

Mirko

0 项奖励
601 次查看
tsi-chung_liew
NXP Employee
NXP Employee

Mirko,

David is right. You may need to check your hardware configuration.

1. RMII or MII - whether you need 50MHz reference clock when RMII is used.

2. MDIO uses bus clock to divide down to 2.5 MHz. If the MDIO clock is not within 2.5MHz you will have issue communicating the PHY.

pastedImage_0.png

3. Is PHY held in reset? check the PHY reset_in, is there GPIO/jumper put the PHY in reset.

Regards,

TsiChung