2024-07-03 10:28 PM
My hardware design has finalized STM32H563 MCU (from ST Microelectronics) to interface 5-port managed Ethernet Switch (KSZ8795 from Microchip). I'm tried to use orix board library code but unable to make it run.
I have following questions,
1. Is KSZ8795 intended to work with Microcontrollers as opposed to microprocessor which used Linux/Windows as a de-facto OS.
2. Is KSZ8795 compatible with STM32H563 MCU?
3. Is KSZ8795 driver port available for FreeRTOS?
2024-07-05 6:57 AM
Hi All,
This post has been escalated to the ST Online Support Team for additional assistance. We'll contact you directly.
Regards,
Jake
ST Support
2024-07-05 8:10 AM
@PrabhakarRPatil The KZ Microchip switches are designed to work with any microcontroller that has compatible RMII or MII interface. For example, with STM32. Note that MII or RMII may be lacking in some STM32 variants with low pin number. Check the data sheet of your selected STM32H5 model what it supports.
The KZ switch has a dedicated port for connection of the microcontroller, this port does not have a PHY.
Especially note that these switches have SPI interface to the registers, in addition to the MDIO. Make sure to connect this SPI interface to the STM32 in your design.
2025-12-15 9:03 AM
@Pavel A. I have seen you state something similar to this in a couple places. Can you expand on this? It seems that the HAL assumes use of the MDIO interface. What needs to be done to use the SPI interface? Do you have example code?
2025-12-15 3:12 PM
@mattr I don't have a 'H5 yet - assuming the ETH of H5 is similar to one in 'H7:
> It seems that the HAL assumes use of the MDIO interface.
The software "HAL" driver is not bound to MDIO. HAL_ETH_Init prepares to use the MDIO
but whether to use the MDIO to talk to the PHY is up to the application. Examples for the ST boards have simple PHY chips with MDIO interface, the relevant code is usually in the file ethernetif.c.
> What needs to be done to use the SPI interface?
With the SPI interface one does exactly the same as with MDIO: detect the cable connection state and speed/duplex, then pass these parameters to the ETH and start the MAC operation. Inform the network interface layer that the link is UP. When cable disconnection is detected, stop the MAC and inform the network layer that the link is DOWN.
Again, if the PHY is "dummy", that's, a direct connection to multi-port switch - assume that the "cable" is permanently connected with permanent speed and duplex. No need to poll for link state events.
> Do you have example code?
Not for KSZ8795 unfortunately. We used Broadcom and Marvel switches.
The SPI interface is quite simple. For example of SPI setup see this or similar examples.