cancel
Showing results for 
Search instead for 
Did you mean: 

KSZ8895 and STM32F107 with RMII MAC to MAC

Renaud1
Associate II

Hi,

I tried to interface a STM32F107 and a 5 port ethernet switch KSZ8895RQXIA with the RMII interface.

I'm not sure about the configuration (strap resistor) on the ksz.

I configure it as SW5-RMII MAC to MAC Conneciton (PHY mode) :

Pin 91 : PD / 86:PD / 87: PU (floating) with external 50Mhz oscillator (Pin 101: PD)

and I connected all RMII signals as p34 said.

The switch is workin on all 4 port, but i have no connection with my STM32.

I'm using HAL library and LwIP.

It fails to do HAL_ETH_Init();

On cubeMX i set the ethernet configuration as if i have a lan8742A. The thing is that I don't have a PHY, but a mac. Is that configuration can work ? Can i Use HAL and lwip ?

Do i Have to add a PHY between the STM and KSZ (I did that previously and it's working, but I wanted to get rif of the lan8742A to simplify the board)

7 REPLIES 7
Renaud1
Associate II

I made some progress,

I set the PHY add to 3 because of the datasheet it says :  bits [2:1] of the PHY address is set to ‘11’

And i have a lot more data through MDIO pin,

Bu i Still have no connexion, no ping.

In MX_LWIP_Init()

the netif_set_up(&gnetif); is called

So the netif is fully configured.

And when I call

netif_is_up(&gnetif)

it is returning 1;

But there is nothing on RMII_RX+- / RMII TX+- pin

EDIT :

Strange thing netif_is_up(&gnetif) is retuning 1 only when there a camera connected on port 2 of the KSZ

Renaud1
Associate II

Hi,

I made some progress

I am able to read / write register with the SMI protocol and MIIM protocol

When I write 1 to the register 1 (Register 1 (0x01): Chip ID1/Start Switch) , the switch start, and all port are working except port 5

I have absolutly no acitivity on RMII_RX0/1 and TX0/1,

and so Auto negotiation failed.

If I force 100Base T Full Duplex, i Still have no activity.

I really don't know why

AFara.2
Associate II

Hi,

I need to connect my STM32F439 with Micrel KSZ8895. Did you solve your issue? Thank you.

Best regards,

Antonio

Hi,

I have a project using STM32f767 interface MAC-MAC with KSZ8863. Most of them work fine, but some are in an unstable condition. The physic register value shows that link up/down is detected, but the switch didn't work at all. I have to unplug the power of the controller, and the switch can work. A thread mentioned that maybe Advanced Control Registers need to be set.

Could you give me any advice, how to solve my problem or how to read Advanced Control Registers via SMI/MIIM protocol?

Hi,

I solved my issue. I interfaced my STM32F439 with KSZ8895 Port 5 MAC to MAC (the same of KSZ8863 Port 3). I simply connected MCU RMII pins to Port 5 and MCU MDC and MDIO pins to KSZ8895 MDC and MDIO pins. KSZ8895 (or KSZ8863) supports the IEEE 802.3 MII Management Interface. So if I want to access to standard MIIM registers (shown in page 36 of KSZ8863 datasheet) I just respect the MII MANAGEMENT (MIIM) FRAME FORMAT (Table 3-8 page 24 of KSZ8863 datasheet). If I want to full configure KSZ8895 (or KSZ8863) I just respect the SERIAL MANAGEMENT INTERFACE (SMI) FRAME FORMAT (Table 3-9 page 24 of KSZ8863 datasheet). Another way to full configure KSZ8895 (or KSZ8863) is via SPI interface. Pay attention, after MIIM configuration, port 5 (or KSZ8863 port 3) in considered as a virtual port. So that port links up if one of the remaining PHYs links up. That's all and it works very fine!

Best regards,

Antonio

hi I have stm32f746 with ksz8863 switch. I can access (read/write)all registers through SPI interface.

Port3 is connected to STm32746 through RMII interface(STM32 MAC ------ KSZ8863 Port3 MAC)

I am trying with STm32 discovery Lwip application code.

When I ping from PC there is no response from STM32 device.

Please give me the KSZ8863 initializing code(Register configuration)that used in your project

that will be very helpful to me.

Thanks in advance

Hi Antonio,

    How do you make it send out OPCode = 0? Isn't the register only allows read or right for the command?