cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F767 with KSZ8863 Ethernet PHY and RMII. Clock issue

y.rr
Associate II

Hello there :)

I'm trying to use a KSZ8863 Ethernet PHY with the STM32F767. I'm using the Nucleo F767ZI Board where i unsoldered the jumpers to the onbord PHY. The KSZ8863 is then connected via the Morpho connectors.

I just used the Code generated by the CubeIDE with rtos and lwip.

By now I can configure the PHY via MIIM (MDIO, MDC) with no issue.

but I have no communikation with the Ethernet.

Looking at the RMII interface via logic-analyzer i can see the 50MHz clock. And the data send from the Phy to the STM32 with corresponding frequency.

But when i look at the Date send from the STM32 to the Phy it looks like the µC sends with a to low frequency. (if im right with 2.5MHz) . So it looks like the STM32 uses a wrong clock.

So far the only thing I could find is that

SYSCFG->PMC |= (SYSCFG_PMC_MII_RMII_SEL);

selects the used interface (and with that the clock?).

(See STM32F767 datasheet page 1776 / 42.4.4)

In the Figure 549 Clock Scheme, there is the Sync. divider. bit i cant find anything more about that.

So what am I missing? I'm stuck..

Some help would be very nice :)

Cheers

1 ACCEPTED SOLUTION

Accepted Solutions
y.rr
Associate II

ok

as usual, shortly after asking around I found the issue :)

The HAL Driver does not detect the speed of the PHY and therefore uses 10M.

So to solve that in the stm32f7xx_hal_eth.c in line 443 change to 100M

because the KSZ8863 is a switch and always needs 100M at the RMII to work, one can replace the speed selection in Line 440:

/* Configure the MAC with the speed fixed by the auto-negotiation process */
    if((phyreg & PHY_SPEED_STATUS) == PHY_SPEED_STATUS)
    {  
      /* Set Ethernet speed to 10M following the auto-negotiation */
      (heth->Init).Speed = ETH_SPEED_100M;
    }
    else
    {   
      /* Set Ethernet speed to 100M following the auto-negotiation */ 
      (heth->Init).Speed = ETH_SPEED_100M;
    }

with simply

/* Set Ethernet speed to 100M following the auto-negotiation */ 
      (heth->Init).Speed = ETH_SPEED_100M;

So my question is answerd and maybe it will help others solving it :)

Cheers

View solution in original post

1 REPLY 1
y.rr
Associate II

ok

as usual, shortly after asking around I found the issue :)

The HAL Driver does not detect the speed of the PHY and therefore uses 10M.

So to solve that in the stm32f7xx_hal_eth.c in line 443 change to 100M

because the KSZ8863 is a switch and always needs 100M at the RMII to work, one can replace the speed selection in Line 440:

/* Configure the MAC with the speed fixed by the auto-negotiation process */
    if((phyreg & PHY_SPEED_STATUS) == PHY_SPEED_STATUS)
    {  
      /* Set Ethernet speed to 10M following the auto-negotiation */
      (heth->Init).Speed = ETH_SPEED_100M;
    }
    else
    {   
      /* Set Ethernet speed to 100M following the auto-negotiation */ 
      (heth->Init).Speed = ETH_SPEED_100M;
    }

with simply

/* Set Ethernet speed to 100M following the auto-negotiation */ 
      (heth->Init).Speed = ETH_SPEED_100M;

So my question is answerd and maybe it will help others solving it :)

Cheers