Detect Ethernet connection fails

cancel
Showing results for 
Search instead for 
Did you mean: 

Detect Ethernet connection fails

Jump to solution
556 Views
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

Labels (1)
0 Kudos
1 Solution
116 Views
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

View solution in original post

0 Kudos
8 Replies
117 Views
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

View solution in original post

0 Kudos
116 Views
kappa74
Contributor IV

Hi David,

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

There is something of strange.

0 Kudos
116 Views
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 Kudos
116 Views
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 Kudos
116 Views
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 Kudos
116 Views
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 Kudos
116 Views
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 Kudos
116 Views
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