Skip to main content
Visitor II
June 4, 2024
Question

Custom PCB, STM32H7 and KSZ8863RLL, RMII

  • June 4, 2024
  • 10 replies
  • 7404 views

Hi

I have made a custom PCB based on STM32H723VGT MCU and KSZ8863RLL with interface RMII. I have followed the Hardware Design Guide for the KSZ8863. Including 100 Ohm impedance from RJ45 to PHY and 50 Ohm impedance from PHY to STM32. Length matching is also done with meanders. 

Without any configuration from CubeMx I am expecting some activity on the LEDS when I plug a ethernet cable in the RJ45 connector.

Are there anyone with experience with the KSZ8863 3-port switch, that have any suggestions? I have added a picture of the schematic. The crossed is not implemented on the board, so please ignore those.

Any help is much appreciated!

Friendly regards, David

 

    This topic has been closed for replies.

    10 replies

    Graduate II
    June 4, 2024

    I'll get my H7 + KSZ8863 board in a few weeks...

    Have you checked the crystal and all clock settings? There's an extra pdf for it.

    And compare your schematics to the KSZ8863 development board (I haven't found a problem on the ETH side).

    Visitor II
    June 4, 2024

    Thank you for the tips! :)
    And exited to hear about your own project!
    By comparing the development board schematic I found it very similar with my own. There are a lot of jumpers on the board to configure, for instance auto-negotiation etc... Not sure what settings is actually important for my application though....

    I measure 25MHz on the crystal and 50Mhz on the RMII interface from the PHY. No activity on the differential signals and no led activity either side og the RJ45 cable...


    Please update when you receive and test your own PCB :)

    Graduate II
    June 4, 2024

    Getting 50 MHz out of the PHY is a good start.

    Can your H7 talk to the PHY via the SMI or I2C interface?

    What's connected on the other side of the ethernet cable? Mind that a direct PC connection might not do anything.

    Graduate II
    June 8, 2024

    Heyho,

    I received the boards yesterday.

    The good:

    I can read and write the PHY's registers.

    The bad:

    Communication via ethernet is completely... whacky. I see lots of failed retransmissions in Wireshark, most of the time PING fails, so does the access to the STM's webserver.

    Super User
    June 8, 2024

    This switch has SPI interface to access the registers. It's very much recommended to use it and get full insight of the switch state, instead of limited MDIO interface.

    Graduate II
    June 9, 2024

    Yes, I know, sigh... I have it on I2C, but haven't used that yet on H7.

    Graduate II
    June 13, 2024

    I did such a *** mistake - once more copy & paste, this time from my LAN8742 "driver":

    When restarting auto-negotiation, I actually completely reset BCR register and thus turned OFF recommended "HP Auto MDI/MDI-X mode".

    Ouch...

    Now all is running smoothly - although I could not yet test high data rates.

    Graduate II
    June 13, 2024

    ... and that was seemingly not the solution. :(

    Graduate II
    June 18, 2024

    Finally found the problem on my board, maybe it's at least related to yours @DavidWahlberg 

    I wanted to set it up without I2C or SPI, which means no access to all registers, especially register 198d, which needs bit 3 to be set (default = 0) to use its own RMII reference clock internally.
    So maybe your problem is that you have not set that bit, as it looks that you want to use the clock internally.

    So I set the strap options so that I can use the clock externally extra routing via R221, which was originally 33 Ohms, as the other RMII resistors.
    But even that value is too big, seemingly causes a tad too much phase shift or whatever, replacing the 33R with 0R solved the problem, now it's really running smoothly.

    I will switch the interface to I2C, so that I can use the clock internally, because this small change sounds like it's timing-wise "on the edge".

     

     

    Visitor II
    August 28, 2024

    Hi @LCE 

    Happy to hear that you got it working! :)

    Some other project came on my desk over the summer, but now I have returned to this project.

    I have thought of your suggestion of setting 3-bit in register 198, which would make sense. On my custom PCB I have routed the SMI interface, but as @Pavel A.  mentioned about the limited register access, I am trying getting the SPI interface up and running. For that reason I ordered the ksz8863 daughter board (https://www.microchip.com/en-us/development-tool/ac320004-7) to have access the pins as well as multiple strap options. I have wired it up and made the strap option for [P2LED1, P2LED0] = [1 , 0] to enable SPI slave mode. However, still no good response on the MISO line when trying to read 0x00 register (I am expecting a response of 0x88 according to datasheet).

    How far have you come you your project? Can you confirm that my SPI transfer is correct?

     

    Friendly regards, David

    Graduate II
    September 2, 2024

    Hello @DavidWahlberg ,

    my project is up and running, no problems anymore with the KSZ.

    But I use the I2C interface, not SPI, which I have on idea about concerning the KSZ.

    Have you checked that the MCU side is working correctly?

    Visitor II
    September 4, 2024

    Okay, cool! Then I know it is a possible task to have a working connection between ksz8863 and STM32H7 :p

    I also have exposed I2C interface on my custom PCB and tried with that interface instead of SPI, still no luck...

    code_screendump.png

     

    My simple code is above ^. Using the logic analyzer I can see this:

     

    logic_analyzer_screendump.png

    I never received any ACK from the ksz8863. I am trying to read register 0x01 to return 0x3, as stated in the datasheet.

    Can you confirm that I am on the right track, @LCE ?

    Graduate II
    September 5, 2024

    I have no idea about HAL I2C, I can only say that the I2C addresses are correct.

    Have you strapped the interface selection pins correctly?

    On the logic analyzer we see 0xBE and 0xBF sent out directly after each other, which does not make sense, unless you want to write register 0xBF.

    But yeah, first try to get an ACK.

    Visitor II
    September 6, 2024

    My original design did not have strap, so I have soldered a resistor on 1KOhm as shown in the picture. When pulling reset low, the LEDS on  P2LED1 and P1LED0 lights up and then turns off when releasing nRST pin. I can measure 1.8V on pin 32 and 42. I can measure 25MHz from the crystal and 50Mhz on pin 26. But sadly still cant get a ACK when writing to pin 37 and 36... :( 

    Can you confirm the straps for I2C-slave mode?

    schematic_strap_options.png

    Graduate II
    September 6, 2024

    Don't have time now, check the DS and the pdf for the eval board.

    You might need an extra pull-up an P2LED0.

    Here's a screenshot of my working setup:

    LCE_0-1725615842190.png