Skip to main content
Graduate II
February 28, 2024
Solved

ETH: anybody used KSZ8863RLL?

  • February 28, 2024
  • 14 replies
  • 7438 views

Heyho,

until now I only used STM32 with the LAN8742, in a few weeks I'll get my 2nd custom board, but this time with the "dual" PHY KSZ8863RLL.

It's connected via RMII, for setup MDIO (and optionally I2C for the registers not accessible via MDIO).

Are there any known issues or "pitfalls" with this PHY?

Thanks in advance,
LCE

PS: interesting that there is no "ETH" label... :D

    This topic has been closed for replies.
    Best answer by LCE

    I have my board with STM32H733, KSZ8863RLL, LAN9512 up and running.

    Here's the most important advice:

    a) use internal RMII clock

    b) use I2C (or SPI) - which is a must for a)

    MDIO only allows access to a few basic registers (as already mentioned by Pavel), but to enable internal RMII clock (recommended by datasheet), a register only accessible via I2C / SPI must be written. (Bad design IMO).

    14 replies

    LCEAuthorAnswer
    Graduate II
    August 12, 2024

    I have my board with STM32H733, KSZ8863RLL, LAN9512 up and running.

    Here's the most important advice:

    a) use internal RMII clock

    b) use I2C (or SPI) - which is a must for a)

    MDIO only allows access to a few basic registers (as already mentioned by Pavel), but to enable internal RMII clock (recommended by datasheet), a register only accessible via I2C / SPI must be written. (Bad design IMO).

    Visitor II
    August 30, 2024

    would you be willing to share the ethernet portion of your project? 

    I would like to use the ksz8863rll with the STM32F107 IC in one of my projects but I'm not quite sure how to configure the ethernetif.c file produced by LWIP. Or are you using the mongoose library or something similar to work with this PHY?

    LCEAuthor
    Graduate II
    September 2, 2024

    Sorry, I am not allowed to share.

    Oryx has a lot of useful stuff, it seems:

    https://www.oryx-embedded.com/doc/ksz8863__driver_8c_source.html

    LCEAuthor
    Graduate II
    September 2, 2024

    ... but I can tell you the steps I use for "bringing up" the KSZ:

    1) hardware reset by MCU, pulling down KSZ's RSTN pin, then release it (this step is probably not required)

    2) I2C: first communication "alive check": read the chip ID

    3) I2C: set RMII clock to internal (bit 3 in reg 198d (?))

    4) I2C: check LINK status (KSZ8863_PORT1_STAT0 and KSZ8863_PORT2_STAT0)

    5) I2C: power down unused port

     

    Have you checked all the "strap" pins with pull-resistors?

    LCEAuthor
    Graduate II
    September 18, 2024

    The main lessons learned:

    1) as always, try to keep some ("strap") options open, e.g. at some pins place options for pull-up and pull-down resistors - if can afford it space-wise, better one too many (I had to fiddle the pull-down onto the board at P2LED1 to enable I2C)

    2) make sure you have the option to use not only the MDIO, but also the I2C or SPI interface

    3) do NOT feed REFCLKI from its own REFCLKO, but use the internal clock -> you must use I2C / SPI to set register 198d / bit 3

    Again: with external feed the complete RMII was whacky with only 33R between REFCLKI / REFCLKO, it worked with 0R, but I don't want to rely on that, come on, only 33R and such a big impact? No thanks...

    So I am using "mode 5", 25 MHz dedicated crystal for the KSZ at X1/2, RMII_REF_CLK output to STM32.