cancel
Showing results for 
Search instead for 
Did you mean: 

How to configure PHY in MII mode using cubeMX?

PSrin
Associate

I want to work on ethernet using MII mode. At times i am getting struck in clock configuration also. In lwip.c file, the link is getting up but while pinging the board from pc am getting destination host unreachable. Please help to resolve the problem.

3 REPLIES 3
Piranha
Chief II

Is it a custom board or what? Which PHY chip? What software components and how it is made? What have been tested and debugged already? Why do I have to ask all of this and it is not already written here?

Pinging is L3 (IP packets) level thing. Start with checking hardware and Ethernet level - whether it is possible to send and receive Ethernet frames.

PSrin
Associate

Thank you for your response

It is a customized board for our project and i am testing the Ethernet working . It is DP83848 PHY chip. when i started testing, i generated code using cubeMX and enabled ETH MII mode, LWIP and RCC HSE with master clock output1. Input frequency is 25 MHZ. The link is setting up.

 if (netif_is_link_up(&gnetif))

 {

  /* When the netif is fully configured this function must be called */

  netif_set_up(&gnetif); // It is setting up

 }

while pinging the board, reply is destination host unreachable and ping statistics is as follows:

packets: sent =4; received = 4; Lost = 0%

I want to know whether is there any software level configuration or changes needed or hardware problem?

Kindly share your views to how to proceed with this. Thanks in advance.

Piranha
Chief II

How did You checked that link is working? netif_set_up() is not setting up link but enabling netif (software) interface. netif_is_link_up() is not checking physical link status but only flag in netif interface structure. Physical link status can be read from PHY BSR register and then netif_set_link_up()/netif_set_link_down() must be called.

Those "received" ping responses are from Your own computer and mean that ARP was not able to resolve MAC address for given IP address. If IP address and network in between is correct, then either receiving or sending (or both) frames doesn't work. Start with checking if You can receive any frames at all. Every ping attempt sends a broadcast packet as ARP is trying to resolve MAC address - set a breakpoint on low_level_input() and check if You can receive at least those.